Alex Rivera | Logout

Display the call stack in a Delphi Win32 application

Asked 2008-11-03T14:17:29.853
18

I'd like to display a stack trace in an error dialog in Delphi 2007 (Win32).

Ideally, I'd like something like this:

try
  //do something
except on e : exception do
  begin
    //rollback a transaction or whatever i need to do here       
    MessageDlg('An error has occurred!' + #13#10 +
                e.Message + #13#10 +
               'Here is the stack trace:' + #13#10 +
               e.StackTrace,mtError,[mbOK],0);
  end;  //except
end;  /try-except

And for the output to be like the Call Stack in the IDE:

MYPROGRAM.SomeFunction
MYPROGRAM.SomeProcedure
MYPROGRAM.MYPROGRAM
:7c817067 kernel32.RegisterWaitForInputIdle + 0x49
Edit
Report

1 Answer

6

You may be interested in this article: "New Exception class in Delphi 2009 and above".

answered 2010-05-05T12:41:23.380

Your Answer