[fpc-pascal] How to get a full backtrace in code?
Mattias Gaertner
nc-gaertnma at netcologne.de
Thu Apr 10 16:47:06 CEST 2008
On Thu, 10 Apr 2008 16:39:09 +0200
Graeme Geldenhuys <graemeg.lists at gmail.com> wrote:
> Hi,
>
> I'm trying to create a default exception handler dialog for fpGUI. It
> should display the error message and when the user clicks on the
> 'Details' button, it should show the full backtrace. For some reason
> the backtrace I get is much smaller compared to the one if I don't
> handle exceptions at all (and the program crashes).
>
> Currently I'm simply outputting to the console, until I get this
> right, which should then output to a Memo component. Here is my code
> to output a backtrace... called by my default exception handler
> (try...except block).
>
> procedure DumpStack;
> begin
> writeln(' Stack trace:');
> Dump_Stack(StdOut, get_frame);
> end;
>
> ... which gives the following output to the console.....
>
> $ ./tutoradmin.exe
> exception at 0809DAAA:
> Unknown parameter HELLO.
> Stack trace:
> $080578F3 TFPGAPPLICATION__HANDLEEXCEPTION, line 981 of
> /home/graemeg/programming/fpGUI/src/corelib/fpgfx.pas
> $08057A05 TFPGAPPLICATION__RUNMESSAGELOOP, line 1010 of
> /home/graemeg/programming/fpGUI/src/corelib/fpgfx.pas
> $080570A1 TFPGAPPLICATION__RUN, line 848 of
> /home/graemeg/programming/fpGUI/src/corelib/fpgfx.pas
> $080ED713 MAINPROC, line 70 of tutoradmin.lpr
> $080ED57D main, line 79 of tutoradmin.lpr
> $080ED54D
>
>
> .... Now if I remove the try...except block and let FPC handle the
> exception (and the program terminates), I get the following output to
> the console. As you can see, it's a lot more detailed. How do I
> generate this myself, so I can display this in a Memo component.
Increase Max_Frame_Dump.
Mattias
More information about the fpc-pascal
mailing list