views:

366

answers:

4

Possible Duplicate:
GetStackTrace in Delphi 7?

Does anyone know how to get a nice friendly stack trace into a string when an exception is raised in Delphi 6?

+2  A: 

May be you can take a look at EurekaLog

Hugues Van Landeghem
I'm looking at this now. Seems a bit less controlling than madExcept. It looks like I can assign a procedure to ExceptionNotify, set Handled to True and then call CallStackToStrings(ExcRecord, AStringList) to get the call stack as a stringlist. Also, there's an exciting-looking function called GetCurrentCallStack, which I think I can call anywhere.Am still very open to other suggestions, though. I dream of a free version of GetCurrentCallStack!
cja
In that case you should look at the Jedi vcl. This library contains what you need to get a stacktrace.
Lieven
Lieven, it's the JCL, not the JVCL, which has stack tracing.
Craig Stuntz
I use JCL for logging the callstack and it works well. But it require debug-info to work.
Roland Bengtsson
So do EurekaLog and madExcept. JCL supports different formats of debug info. Also internal or external. JCL also understands runtime package calls without debug info.
Lars Truijens
+5  A: 

madExcept can include the stack trace in the exception log. You can try madExcept free (there is a free non-commercial license).

error dialog

mjustin
Thanks. madExcept seems to do too much. I already have a global exception handler which takes screenshots, writes to log, shows my own dialogue and then puts all error details in database or sends it by email. All I want is a stack trace.
cja
So just use the part that you want! I do similar, but madExcept has hooks that allow you to get the stack as a string, and then you can do what you want. In my app I handle everything else. madExcept is well worth all the extras that come in handy sometime.
mj2008
+2  A: 

This answer by Runner and this blog post from Rob's Technology Corner provides you with all you need to get a stack trace with JCL.

Smasher
We use JCL. Works very well.
Craig Stuntz