Browse Source

* dump stack when thread terminates because of exception (unix)

git-svn-id: trunk@8093 -
micha 18 years ago
parent
commit
721ae51cd0
1 changed files with 7 additions and 1 deletions
  1. 7 1
      rtl/unix/tthread.inc

+ 7 - 1
rtl/unix/tthread.inc

@@ -104,8 +104,14 @@ begin
        end;
   except
     on e: exception do begin
-      WRITE_DEBUG('got exception: ',e.message);
       LThread.FFatalException := TObject(AcquireExceptionObject);
+      lErrorAddr:=ExceptAddr;
+      lErrorBase:=ExceptFrames^;
+      writeln(stderr,'Exception caught in thread $',hexstr(LThread),
+        ' at $',hexstr(lErrorAddr));
+      writeln(stderr,BackTraceStrFunc(lErrorAddr));
+      dump_stack(stderr,lErrorBase);
+      writeln(stderr);
       // not sure if we should really do this...
       // but .Destroy was called, so why not try FreeOnTerminate?
       if e is EThreadDestroyCalled then LThread.FFreeOnTerminate := true;