Denis already explained the stack, here's some more info:

- cv2pdb demangles the function names, but uses '@' instead of '.', because '.' in a symbol confuses the Visual Studio Debugger (I don't know why the '@' is not displayed.)

- the D main function has symbol _Dmain, "main" is the C version in the runtime library

- RegisterWaitForInputIdle is probably just the exported symbol from ntdll.dll closest to the address found on the call stack. A lot of other code might be inbetween.

- you probably don't see the correct location of the throwing statement because the actually called function to do the throw is part of the phobos library. It is built without standard stack frame, so it's hard for a debugger (and probably the dumping function used here) to figure out the correct calling sequence.

- a bug report with patch is here: http://d.puremagic.com/issues/show_bug.cgi?id=4809

Rainer

Austin Hastings wrote:
On 10/8/2010 6:47 PM, Denis Koroskin wrote:
On Sat, 09 Oct 2010 02:36:30 +0400, Austin Hastings <ah0801...@yahoo.com> wrote:

object.Exception: Test
----------------
00 rtdmain2mainrunMain
01 rtdmain2mainrunAll
02 main
03 mainCRTStartup
04 RegisterWaitForInputIdle

Thanks for your help, Benjamin!

My next question would be, why does the stack trace look this way? I'm
throwing the exception from D's main. I assume that's entry #02. But
what are the other two entries, and why are they on the stack?

D main is not the true program entry point, there is a lot of
preparation done (gc_init(), module init, etc) before your main() takes
control, and these entries can be safely stripped since they are usually
not what you are looking for.

Denis,

Sure, there's stuff in assembly that calls main. What I'm asking about is the stuff *inside* main that isn't in my code. As I see it, either:

1. The function I named "main" is at #02 on the above, in which case there are two subroutines that I didn't call on the stack. Then I'd like to know what they are, and whatever else anyone can tell me about them.

2. The function I named "main" is actually "rtdmain2mainrunMain", in which case (a) why was it renamed this horrible value; and (b) what other non-intuitive name manglings (!!) can I expect? (As if there was such a thing as an intuitive name mangling. :-)

3. The function I named "main" is actually "RegisterWaitForInputIdle", which will totally surprise me, in which case please explain why the stack trace is upside down, and why that name was chosen?

=Austin

Reply via email to