Using Delphi 7, how can I get a string representing the stack-trace from an Exception
?
try
SomethingDodgy();
except
on E:Exception do begin
// print stack trace
Log.Write(/* ??? */);
end;
end;
I hear there's a GetStackTrace function in the latest delphi, but I can't find anything for delphi 7. No, upgrading is not an option :)
You could try using madExcept, a wonderful Exception handling framework.
madshi has heaps of sample code in there; I'm sure I've used the stack-trace stuff in there before.
As Dmitriy noted, the JCL also has stack-trace code; an old sample is here.
I throw EurekaLog in the game. It's a great tool and not expensive at all.
MemChk is pretty easy to use (especially to search/find memory leaks) and knows how to render a stack trace from a code address.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With