Zitat von Dominique Louis <dominique@savagesoftware.com.au>:

> Graeme Geldenhuys wrote:
> > ----------------------------------------------------
> > procedure DumpStack;
> > Var
> >   Message : String;
> >   i : longint;
> > begin
> >   writeln(' Stack trace:');
> > //  Dump_Stack(StdOut, get_frame);
> >
> >   Writeln(stdout,'An unhandled exception occurred at
> > $',HexStr(Ptrint(ExceptAddr),sizeof(PtrInt)*2),' :');
> >   if ExceptObject is exception then
> >    begin
> >      Message:=Exception(ExceptObject).ClassName+' :
> > '+Exception(ExceptObject).Message;
> >      Writeln(stdout,Message);
> >    end
> >   else
> >    Writeln(stdout,'Exception object ',ExceptObject.ClassName,' is not
> > of class Exception.');
> >   Writeln(stdout,BackTraceStrFunc(ExceptAddr));
> >   if (ExceptFrameCount>0) then
> >     begin
> >       for i:=0 to ExceptFrameCount-1 do
> >         Writeln(stdout,BackTraceStrFunc(ExceptFrames[i]));
> >     end;
> >   Writeln(stdout,'');
> > end;
> > ----------------------------------------------------
> >
> > Please note that the above needs stdout to be available, so Windows
> > applications must be compiler without gui option enabled (-WG must not
> > be specified).
> >
> > I think there is such a function in LCLProc unit as well...

Yes, it's called the same (DumpStack) and uses Debugln instead of writeln, so it
works even without -WG under windows. And it caches backtraces, which makes it
much faster.


Mattias


