www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to get stack trace on Windows?

reply "Nick Sabalausky" <a a.a> writes:
I'm not getting any of the function names on the stack traces.

I tried everything I found in here: 
http://www.digitalmars.com/d/archives/digitalmars/D/Windows_Stack_Traces_Function_Names_136887.html

- I installed the "Debugging Tools for Windows" to update my dbghelp.dll

- I'm already compiling/linking in one step, and using -g (also tried -gc)

- I tried running the executable through cv2pdb.

None of it's working.
Jul 21 2011
parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 22.07.2011 6:54, Nick Sabalausky wrote:
 I'm not getting any of the function names on the stack traces.

 I tried everything I found in here:
 http://www.digitalmars.com/d/archives/digitalmars/D/Windows_Stack_Traces_Function_Names_136887.html

 - I installed the "Debugging Tools for Windows" to update my dbghelp.dll

 - I'm already compiling/linking in one step, and using -g (also tried -gc)

 - I tried running the executable through cv2pdb.

 None of it's working.

Last time I've seen stack trace it was due to this command: dmd -debug -g ... -- Dmitry Olshansky
Jul 22 2011
next sibling parent reply "Nick Sabalausky" <a a.a> writes:
"Dmitry Olshansky" <dmitry.olsh gmail.com> wrote in message 
news:j0bgt7$176q$1 digitalmars.com...
 On 22.07.2011 6:54, Nick Sabalausky wrote:
 I'm not getting any of the function names on the stack traces.

 I tried everything I found in here:
 http://www.digitalmars.com/d/archives/digitalmars/D/Windows_Stack_Traces_Function_Names_136887.html

 - I installed the "Debugging Tools for Windows" to update my dbghelp.dll

 - I'm already compiling/linking in one step, and using -g (also 
 tried -gc)

 - I tried running the executable through cv2pdb.

 None of it's working.

Last time I've seen stack trace it was due to this command: dmd -debug -g ...

I was already using -debug and -g. No function names.
Jul 22 2011
parent reply Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 22.07.2011 15:02, Nick Sabalausky wrote:
 "Dmitry Olshansky"<dmitry.olsh gmail.com>  wrote in message
 news:j0bgt7$176q$1 digitalmars.com...
 On 22.07.2011 6:54, Nick Sabalausky wrote:
 I'm not getting any of the function names on the stack traces.

 I tried everything I found in here:
 http://www.digitalmars.com/d/archives/digitalmars/D/Windows_Stack_Traces_Function_Names_136887.html

 - I installed the "Debugging Tools for Windows" to update my dbghelp.dll

 - I'm already compiling/linking in one step, and using -g (also
 tried -gc)

 - I tried running the executable through cv2pdb.

 None of it's working.

dmd -debug -g ...


rebuild dmd/druntime/phobos from latest git, at least it's a setup I have right now it works (though I'm on Win7 x64). BTW I haven't touched dbghelp in anyway(at least any that I know of) but I have something like 6 versions of them on harddrive, most "public" ones: 834Kb in C:\Windows\SysWOW64 ( this one should load for 32bit apps I think) 1.03Mb in C:\Windows\System32 (64bit obviously) for others, I'll list only sizes: 747Kb 0.99Mb 1.27Mb 1.30Mb -- Dmitry Olshansky
Jul 22 2011
parent "Nick Sabalausky" <a a.a> writes:
"Dmitry Olshansky" <dmitry.olsh gmail.com> wrote in message 
news:j0boln$1l4i$1 digitalmars.com...
 On 22.07.2011 15:02, Nick Sabalausky wrote:
 "Dmitry Olshansky"<dmitry.olsh gmail.com>  wrote in message
 news:j0bgt7$176q$1 digitalmars.com...
 Last time I've seen stack trace it was due to this command:

 dmd -debug -g ...


rebuild dmd/druntime/phobos from latest git, at least it's a setup I have right now it works (though I'm on Win7 x64).

Just tried that. Still no names :( Just the addresses as before.
Jul 23 2011
prev sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
This is what works for me:

module test;

import std.stdio;

void main()
{
	foo();
}

void foo()
{
    bar();
}

void bar()
{
    assert(0);
}

D:\dev\code\d_code\dtrace>dmd -g test.d

D:\dev\code\d_code\dtrace>cv2pdb test.exe

D:\dev\code\d_code\dtrace>test
core.exception.AssertError test(17): Assertion failure
----------------
D:\dev\code\d_code\dtrace\test.d(18): testbar
D:\dev\code\d_code\dtrace\test.d(13): testfoo
D:\dev\code\d_code\dtrace\test.d(7): D main
----------------

 D:\dev\code\d_code\dtrace>cv2pdb

So it's v0.19, if that matters. Otherwise without cv2pdb I get only addresses. I got the latest dbghelp.dll from here: http://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx
Jul 24 2011
parent reply "Nick Sabalausky" <a a.a> writes:
"Andrej Mitrovic" <andrej.mitrovich gmail.com> wrote in message 
news:mailman.1893.1311501384.14074.digitalmars-d-learn puremagic.com...
 This is what works for me:

 module test;

 import std.stdio;

 void main()
 {
 foo();
 }

 void foo()
 {
    bar();
 }

 void bar()
 {
    assert(0);
 }

 D:\dev\code\d_code\dtrace>dmd -g test.d

 D:\dev\code\d_code\dtrace>cv2pdb test.exe

 D:\dev\code\d_code\dtrace>test
 core.exception.AssertError test(17): Assertion failure
 ----------------
 D:\dev\code\d_code\dtrace\test.d(18): testbar
 D:\dev\code\d_code\dtrace\test.d(13): testfoo
 D:\dev\code\d_code\dtrace\test.d(7): D main
 ----------------

 D:\dev\code\d_code\dtrace>cv2pdb

So it's v0.19, if that matters. Otherwise without cv2pdb I get only addresses. I got the latest dbghelp.dll from here: http://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx

Hmm I guess I must have forgotten to re-try the cv2pdb trick after I updated dbghelp.dll. That works now. Thanks.
Jul 24 2011
parent Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 25.07.2011 1:04, Nick Sabalausky wrote:
 "Andrej Mitrovic"<andrej.mitrovich gmail.com>  wrote in message
 news:mailman.1893.1311501384.14074.digitalmars-d-learn puremagic.com...
 This is what works for me:

 module test;

 import std.stdio;

 void main()
 {
 foo();
 }

 void foo()
 {
     bar();
 }

 void bar()
 {
     assert(0);
 }

 D:\dev\code\d_code\dtrace>dmd -g test.d

 D:\dev\code\d_code\dtrace>cv2pdb test.exe

 D:\dev\code\d_code\dtrace>test
 core.exception.AssertError test(17): Assertion failure
 ----------------
 D:\dev\code\d_code\dtrace\test.d(18): testbar
 D:\dev\code\d_code\dtrace\test.d(13): testfoo
 D:\dev\code\d_code\dtrace\test.d(7): D main
 ----------------

 D:\dev\code\d_code\dtrace>cv2pdb

So it's v0.19, if that matters. Otherwise without cv2pdb I get only addresses. I got the latest dbghelp.dll from here: http://msdn.microsoft.com/en-us/windows/hardware/gg463009.aspx

dbghelp.dll. That works now. Thanks.

Any idea why this trick is needed? For me it works as is, just wondering... -- Dmitry Olshansky
Jul 25 2011