From 9c00526c9e3cd413231566f0141b866370c83dd1 Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 24 Feb 2019 14:01:43 +0000 Subject: [PATCH] LazDebuggerGdbmi: Detect internal gdb errors, while waiting for run/step to end. git-svn-id: branches/fixes_2_0@60485 - --- components/lazdebuggergdbmi/gdbmidebugger.pp | 28 ++++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/components/lazdebuggergdbmi/gdbmidebugger.pp b/components/lazdebuggergdbmi/gdbmidebugger.pp index 202afadce3..85e8ec42b9 100644 --- a/components/lazdebuggergdbmi/gdbmidebugger.pp +++ b/components/lazdebuggergdbmi/gdbmidebugger.pp @@ -2634,7 +2634,7 @@ end; function TGDBMIDebuggerCommandExecuteBase.ProcessRunning(out AStoppedParams: String; out AResult: TGDBMIExecResult; ATimeOut: Integer): Boolean; var - InLogWarning: Boolean; + InLogWarning, ForceStop: Boolean; function DoExecAsync(var Line: String): Boolean; var @@ -2773,6 +2773,11 @@ var FLogWarnings := FLogWarnings + Warning + LineEnding; if Line = '&"\n"' then InLogWarning := False; + + if FTheDebugger.CheckForInternalError(Line, '') then begin + AResult.State := dsStop; + ForceStop := True; + end; (* << TCmdLineDebugger.ReadLn "&"Warning:\n"" << TCmdLineDebugger.ReadLn "&"Cannot insert breakpoint 11.\n"" @@ -2797,6 +2802,7 @@ begin GotPrompt := 0; {$ENDIF} Result := True; + ForceStop := False; AResult.State := dsNone; InLogWarning := False; FGotStopped := False; @@ -2873,7 +2879,7 @@ begin Break; end; - if FTheDebugger.FAsyncModeEnabled and FGotStopped then begin + if ForceStop or (FTheDebugger.FAsyncModeEnabled and FGotStopped) then begin // There should not be a "(gdb) ", // but some versions print it, as they run none async, after accepting "run &" S := FTheDebugger.ReadLine(True, 50); @@ -6859,16 +6865,16 @@ begin FTheDebugger.FSehRaiseBreaks.ClearAll(Self); {$endif} FTheDebugger.FMainAddrBreak.Clear(Self); - end; - if (not ContinueExecution) and (DebuggerState = dsRun) and - (FTheDebugger.PauseWaitState <> pwsInternal) - then begin - // Handle the unforeseen - if (StoppedParams <> '') - then debugln(['ERROR: Got stop params, but did not change FTheDebugger.state: ', StoppedParams]) - else debugln(['ERROR: Got NO stop params at all, but was running']); - SetDebuggerState(dsPause); + if (not ContinueExecution) and (DebuggerState = dsRun) and + (FTheDebugger.PauseWaitState <> pwsInternal) + then begin + // Handle the unforeseen + if (StoppedParams <> '') + then debugln(['ERROR: Got stop params, but did not change FTheDebugger.state: ', StoppedParams]) + else debugln(['ERROR: Got NO stop params at all, but was running']); + SetDebuggerState(dsPause); + end; end; end;