Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
720 views
Welcome To Ask or Share your Answers For Others

1 Answer

madExcept has a method StackTrace (in unit madStackTrace) that does that.

JEDI Code Library offers similar functionality in unit JclDebug.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...