From 7d040cbe3fb030c1a59a9017067a0b316f82fcee Mon Sep 17 00:00:00 2001 From: nickysn Date: Sun, 22 Feb 2015 00:33:10 +0000 Subject: [PATCH] * fixed crash when program being debugged in gdb/mi mode receives a signal or exits due to a signal git-svn-id: trunk@29784 - --- ide/gdbmiint.pas | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ide/gdbmiint.pas b/ide/gdbmiint.pas index ad20812f5f..0b15502de1 100644 --- a/ide/gdbmiint.pas +++ b/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;