www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Backtrace in exceptions

reply Serg Kovrov <kovrov no.spam> writes:
Some time ago Shinichiro.h has posted Phobos modification implementing
backtrace in exceptions. Shinichiro.h intended this to be part of Phobos
and Walter seems was pleased with it.

And then discussion thread just stopped... Is this changes got to
Phobos? If yes, how to use exception tracing?

--
serg.
Aug 07 2006
parent reply Sean Kelly <sean f4.ca> writes:
Serg Kovrov wrote:
 Some time ago Shinichiro.h has posted Phobos modification implementing
 backtrace in exceptions. Shinichiro.h intended this to be part of Phobos
 and Walter seems was pleased with it.
 
 And then discussion thread just stopped... Is this changes got to
 Phobos?

I don't think it's been added yet.
 If yes, how to use exception tracing?

Just run a debug build. I'll admit the way the stack trace is generated for this mod is a bit weird, though it may be a necessary part of how Win32 support works. To generate the trace, the try/catch block in dmain2 is not used. Instead, the exception is thrown all the way out of the application, and the trace is generated by some special handler as the app exits. I'd like to believe it would be possible to generate the trace at the throw point or as the exception propagates instead. Sean
Aug 07 2006
parent BCS <BCS pathlink.com> writes:
Sean Kelly wrote:
 Serg Kovrov wrote:
 
 Some time ago Shinichiro.h has posted Phobos modification implementing
 backtrace in exceptions. Shinichiro.h intended this to be part of Phobos
 and Walter seems was pleased with it.

 And then discussion thread just stopped... Is this changes got to
 Phobos?

I don't think it's been added yet.
 If yes, how to use exception tracing?

Just run a debug build. I'll admit the way the stack trace is generated for this mod is a bit weird, though it may be a necessary part of how Win32 support works. To generate the trace, the try/catch block in dmain2 is not used. Instead, the exception is thrown all the way out of the application, and the trace is generated by some special handler as the app exits. I'd like to believe it would be possible to generate the trace at the throw point or as the exception propagates instead. Sean

I have some projects with one of these in each function. debug scope( failure ) writef("Backtrace "__FILE__"(",__LINE__,")\n");
Aug 07 2006