Browse Source

* fixed crash when program being debugged in gdb/mi mode receives a signal or
exits due to a signal

git-svn-id: trunk@29784 -

nickysn 10 years ago
parent
commit
7d040cbe3f
1 changed files with 25 additions and 0 deletions
  1. 25 0
      ide/gdbmiint.pas

+ 25 - 0
ide/gdbmiint.pas

@@ -290,12 +290,15 @@ begin
 end;
 
 procedure TGDBInterface.WaitForProgramStop;
+label
+  Ignore;
 var
   StopReason: string;
   Line: LongInt;
   FileName: string = '';
   LineNumber: LongInt = 0;
 begin
+Ignore:
   GDB.WaitForProgramStop;
   if not GDB.Alive then
   begin
@@ -307,6 +310,16 @@ begin
   ProcessResponse;
   StopReason := GDB.ExecAsyncOutput.Parameters['reason'].AsString;
   case StopReason of
+    'signal-received':
+      begin
+        {    TODO: maybe show information to the user about the signal
+          we have:
+               GDB.ExecAsyncOutput.Parameters['signal-name'].AsString (e.g. 'SIGTERM')
+               GDB.ExecAsyncOutput.PArameters['signal-meaning'].AsString (e.g. 'Terminated')
+          }
+        i_gdb_command('-exec-continue');
+        goto Ignore;
+      end;
     'breakpoint-hit',
     'watchpoint-trigger',
     'end-stepping-range',
@@ -329,6 +342,18 @@ begin
           LineNumber := GDB.ExecAsyncOutput.Parameters['frame'].AsTuple['line'].AsLongInt;
         DoSelectSourceLine(FileName, LineNumber);
       end;
+    'exited-signalled':
+      begin
+        DebuggerScreen;
+        current_pc := 0;
+        Debuggee_started := False;
+        {    TODO: maybe show information to the user about the signal
+          we have:
+               GDB.ExecAsyncOutput.Parameters['signal-name'].AsString (e.g. 'SIGTERM')
+               GDB.ExecAsyncOutput.PArameters['signal-meaning'].AsString (e.g. 'Terminated')
+          }
+        DoEndSession(1);
+      end;
     'exited':
       begin
         DebuggerScreen;