Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GetStackTrace in Delphi 7?

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 :)

like image 304
Blorgbeard Avatar asked Nov 16 '09 05:11

Blorgbeard


3 Answers

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.

like image 111
moobaa Avatar answered Oct 20 '22 04:10

moobaa


I throw EurekaLog in the game. It's a great tool and not expensive at all.

like image 21
jpfollenius Avatar answered Oct 20 '22 04:10

jpfollenius


MemChk is pretty easy to use (especially to search/find memory leaks) and knows how to render a stack trace from a code address.

like image 21
Stijn Sanders Avatar answered Oct 20 '22 05:10

Stijn Sanders