Thinking about stack traces in D

Tom S h3r3tic at remove.mat.uni.torun.pl
Sun Sep 16 13:53:49 PDT 2007


If you use DMD on win32, there's the Phobos backtrace hack by shinh: 
http://shinh.skr.jp/d/backtrace.zip

I've tweaked it a little and updated to DMD 1.020. It can be dloaded 
from http://team0xf.com/download/phoboshack/PhobosHackDmd1.20.zip , just 
replace your phobos.lib

If you need a version for DMD 1.021, let me know and I'll recompile it.


If you're a dmd+win32+Tango user, I've just committed a patch into 
Tango's SVN repo, 'patches/BacktraceHack-DMD-Win32.diff', which is a 
port of the original hack with numerous tweaks. I've also created a 
patching program, which can be found at 
http://h3.team0xf.com/tangoTrace.7z and should allow patching of Tango 
installed through DSSS or other means, as long as it's a revision > 2565.

How to use it? Just compile with -g (and in case of Tango, make sure to 
pass tango.lib to the compilation cmd), do not catch the exception at 
the end of the program and you should be given a backtrace when 
something gets thrown. Especially nice is the fact that it can catch 
access violations.

That'd be my 2 cents ;)


-- 
Tomasz Stachowiak
http://h3.team0xf.com/
h3/h3r3tic on #D freenode



More information about the Digitalmars-d mailing list