mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 14:29:14 +02:00
* only print exception backtrace at end of unhandled exception in
tthread in case rtl is compiled with -dDEBUG_MT git-svn-id: trunk@8595 -
This commit is contained in:
parent
956d5e1c91
commit
4e78a30ee3
@ -85,7 +85,9 @@ end;
|
|||||||
function ThreadFunc(parameter: Pointer): ptrint;
|
function ThreadFunc(parameter: Pointer): ptrint;
|
||||||
var
|
var
|
||||||
LThread: TThread;
|
LThread: TThread;
|
||||||
|
{$ifdef DEBUG_MT}
|
||||||
lErrorAddr, lErrorBase: Pointer;
|
lErrorAddr, lErrorBase: Pointer;
|
||||||
|
{$endif}
|
||||||
begin
|
begin
|
||||||
WRITE_DEBUG('ThreadFunc is here...');
|
WRITE_DEBUG('ThreadFunc is here...');
|
||||||
LThread := TThread(parameter);
|
LThread := TThread(parameter);
|
||||||
@ -123,6 +125,7 @@ begin
|
|||||||
except
|
except
|
||||||
on e: exception do begin
|
on e: exception do begin
|
||||||
LThread.FFatalException := TObject(AcquireExceptionObject);
|
LThread.FFatalException := TObject(AcquireExceptionObject);
|
||||||
|
{$ifdef DEBUG_MT}
|
||||||
lErrorAddr:=ExceptAddr;
|
lErrorAddr:=ExceptAddr;
|
||||||
lErrorBase:=ExceptFrames^;
|
lErrorBase:=ExceptFrames^;
|
||||||
writeln(stderr,'Exception caught in thread $',hexstr(LThread),
|
writeln(stderr,'Exception caught in thread $',hexstr(LThread),
|
||||||
@ -130,6 +133,7 @@ begin
|
|||||||
writeln(stderr,BackTraceStrFunc(lErrorAddr));
|
writeln(stderr,BackTraceStrFunc(lErrorAddr));
|
||||||
dump_stack(stderr,lErrorBase);
|
dump_stack(stderr,lErrorBase);
|
||||||
writeln(stderr);
|
writeln(stderr);
|
||||||
|
{$endif}
|
||||||
// not sure if we should really do this...
|
// not sure if we should really do this...
|
||||||
// but .Destroy was called, so why not try FreeOnTerminate?
|
// but .Destroy was called, so why not try FreeOnTerminate?
|
||||||
if e is EThreadDestroyCalled then LThread.FFreeOnTerminate := true;
|
if e is EThreadDestroyCalled then LThread.FFreeOnTerminate := true;
|
||||||
|
Loading…
Reference in New Issue
Block a user