Artifact f18562976753621a5cc5ea63bc453ba19dd7b917
I wrote a small piece of sourcecode that generates stacktraces in D 2.0 under windows. It works both with the pdb and cv debug symbol format. For Exceptions that are derived from the Error class the trace information is automatically appended, this causes all builtin D errors to get a stacktrace information. The only point where this does not work is the Access Vioaltion error, as it does not call the stacktrace callback function for some reason.
It is very easy to use, just copy the two files from the zip archive to your root source directory and import the stacktrace module inside your main file.
import stacktrace;
void main(string[] argv){
...
}
Now all Errors will get trace information.
If you need a backtrace at a certain point in your code just do the following:
module foo;
import stacktrace;
void blup(){
...
StackTrace trace = new StackTrace();
auto stack = trace.GetCallstack();
foreach(char[] s;stack)
writefln("%s",s);
...
}
It is released under the BSD license. If this licence causes any problems for you, feel free to contact me and we will fix the problem.
XP Users:
If you get a stacktrace with numbers only download a new version of dbghelp.dll and put it into your project root directory. That should fix it.