mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-30 18:41:43 +01:00
Debugger: fix crash if search for parent-fp is aborted (dcsCanceled, DebuggerState=dsError)
git-svn-id: trunk@42178 -
This commit is contained in:
parent
e02c8ef2c8
commit
a61f67bb91
@ -1190,6 +1190,7 @@ type
|
|||||||
private
|
private
|
||||||
FCommandList: TList;
|
FCommandList: TList;
|
||||||
FParentFPList: Array of TGDBMIDebuggerParentFrameCache;
|
FParentFPList: Array of TGDBMIDebuggerParentFrameCache;
|
||||||
|
FParentFPListChangeStamp: Integer;
|
||||||
procedure DoEvaluationDestroyed(Sender: TObject);
|
procedure DoEvaluationDestroyed(Sender: TObject);
|
||||||
protected
|
protected
|
||||||
function GetParentFPList(AThreadId: Integer): PGDBMIDebuggerParentFrameCache;
|
function GetParentFPList(AThreadId: Integer): PGDBMIDebuggerParentFrameCache;
|
||||||
@ -1197,6 +1198,7 @@ type
|
|||||||
procedure Changed;
|
procedure Changed;
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
procedure InternalRequestData(AWatchValue: TCurrentWatchValue); override;
|
procedure InternalRequestData(AWatchValue: TCurrentWatchValue); override;
|
||||||
|
property ParentFPListChangeStamp: Integer read FParentFPListChangeStamp;
|
||||||
public
|
public
|
||||||
constructor Create(const ADebugger: TDebugger);
|
constructor Create(const ADebugger: TDebugger);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -6365,6 +6367,7 @@ begin
|
|||||||
DoChange(FSourceIndex[n]);
|
DoChange(FSourceIndex[n]);
|
||||||
|
|
||||||
FSourceIndex.Clear;
|
FSourceIndex.Clear;
|
||||||
|
//FRequestedSources.Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGDBMILineInfo.AddInfo(const ASource: String; const AResult: TGDBMIExecResult);
|
procedure TGDBMILineInfo.AddInfo(const ASource: String; const AResult: TGDBMIExecResult);
|
||||||
@ -7990,7 +7993,8 @@ begin
|
|||||||
dcEnvironment: Result := GDBEnvironment(String(AParams[0].VAnsiString), AParams[1].VBoolean);
|
dcEnvironment: Result := GDBEnvironment(String(AParams[0].VAnsiString), AParams[1].VBoolean);
|
||||||
dcDisassemble: Result := GDBDisassemble(AParams[0].VQWord^, AParams[1].VBoolean, TDbgPtr(AParams[2].VPointer^),
|
dcDisassemble: Result := GDBDisassemble(AParams[0].VQWord^, AParams[1].VBoolean, TDbgPtr(AParams[2].VPointer^),
|
||||||
String(AParams[3].VPointer^), String(AParams[4].VPointer^),
|
String(AParams[3].VPointer^), String(AParams[4].VPointer^),
|
||||||
String(AParams[5].VPointer^), Integer(AParams[6].VPointer^));
|
String(AParams[5].VPointer^), Integer(AParams[6].VPointer^))
|
||||||
|
{%H-};
|
||||||
dcStepOverInstr: Result := GDBStepOverInstr;
|
dcStepOverInstr: Result := GDBStepOverInstr;
|
||||||
dcStepIntoInstr: Result := GDBStepIntoInstr;
|
dcStepIntoInstr: Result := GDBStepIntoInstr;
|
||||||
{$IFDEF DBG_ENABLE_TERMINAL}
|
{$IFDEF DBG_ENABLE_TERMINAL}
|
||||||
@ -9375,6 +9379,10 @@ end;
|
|||||||
procedure TGDBMIWatches.DoStateChange(const AOldState: TDBGState);
|
procedure TGDBMIWatches.DoStateChange(const AOldState: TDBGState);
|
||||||
begin
|
begin
|
||||||
SetLength(FParentFPList, 0);
|
SetLength(FParentFPList, 0);
|
||||||
|
if FParentFPListChangeStamp = high(FParentFPListChangeStamp) then
|
||||||
|
FParentFPListChangeStamp := low(FParentFPListChangeStamp)
|
||||||
|
else
|
||||||
|
inc(FParentFPListChangeStamp);
|
||||||
inherited DoStateChange(AOldState);
|
inherited DoStateChange(AOldState);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -12426,6 +12434,17 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function SelectParentFrame(var aFrameIdx: Integer): Boolean;
|
function SelectParentFrame(var aFrameIdx: Integer): Boolean;
|
||||||
|
var
|
||||||
|
CurPFPListChangeStamp: Integer;
|
||||||
|
|
||||||
|
function ParentSearchCanContinue: Boolean;
|
||||||
|
begin
|
||||||
|
Result :=
|
||||||
|
(not (dcsCanceled in SeenStates)) and
|
||||||
|
(CurPFPListChangeStamp = TGDBMIWatches(FTheDebugger.Watches).ParentFPListChangeStamp) and // State changed: FrameCache is no longer valid
|
||||||
|
(FTheDebugger.State <> dsError);
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
R: TGDBMIExecResult;
|
R: TGDBMIExecResult;
|
||||||
List: TGDBMINameValueList;
|
List: TGDBMINameValueList;
|
||||||
@ -12435,6 +12454,8 @@ var
|
|||||||
ParentFpNum, FpNum, FpDiff, LastFpDiff: QWord;
|
ParentFpNum, FpNum, FpDiff, LastFpDiff: QWord;
|
||||||
FpDir: Integer;
|
FpDir: Integer;
|
||||||
begin
|
begin
|
||||||
|
Result := False;
|
||||||
|
CurPFPListChangeStamp := TGDBMIWatches(FTheDebugger.Watches).ParentFPListChangeStamp;
|
||||||
if FWatchValue <> nil
|
if FWatchValue <> nil
|
||||||
then ThreadId := FWatchValue.ThreadId
|
then ThreadId := FWatchValue.ThreadId
|
||||||
else ThreadId := FTheDebugger.FCurrentThreadId;
|
else ThreadId := FTheDebugger.FCurrentThreadId;
|
||||||
@ -12460,6 +12481,8 @@ var
|
|||||||
List := TGDBMINameValueList.Create(R);
|
List := TGDBMINameValueList.Create(R);
|
||||||
ParentFP := List.Values['value'];
|
ParentFP := List.Values['value'];
|
||||||
end;
|
end;
|
||||||
|
if not ParentSearchCanContinue then
|
||||||
|
exit;
|
||||||
if ParentFp = '' then begin
|
if ParentFp = '' then begin
|
||||||
FrameCache^.ParentFPList[aFrameIdx].parentfp := '-'; // mark as no parentfp
|
FrameCache^.ParentFPList[aFrameIdx].parentfp := '-'; // mark as no parentfp
|
||||||
Exit(False);
|
Exit(False);
|
||||||
@ -12499,6 +12522,8 @@ var
|
|||||||
FrameCache^.ParentFPList[aFrameIdx].Fp := '-'; // mark as no Fp (not accesible)
|
FrameCache^.ParentFPList[aFrameIdx].Fp := '-'; // mark as no Fp (not accesible)
|
||||||
Exit(False);
|
Exit(False);
|
||||||
end;
|
end;
|
||||||
|
if not ParentSearchCanContinue then
|
||||||
|
exit;
|
||||||
FStackFrameChanged := True; // Force UnSelectContext() to restore current frame
|
FStackFrameChanged := True; // Force UnSelectContext() to restore current frame
|
||||||
FTheDebugger.FInternalStackFrame := aFrameIdx;
|
FTheDebugger.FInternalStackFrame := aFrameIdx;
|
||||||
|
|
||||||
@ -12509,6 +12534,8 @@ var
|
|||||||
FrameCache^.ParentFPList[aFrameIdx].Fp := '-'; // mark as no Fp (not accesible)
|
FrameCache^.ParentFPList[aFrameIdx].Fp := '-'; // mark as no Fp (not accesible)
|
||||||
Exit(False);
|
Exit(False);
|
||||||
end;
|
end;
|
||||||
|
if not ParentSearchCanContinue then
|
||||||
|
exit;
|
||||||
List.Init(R.Values);
|
List.Init(R.Values);
|
||||||
Fp := List.Values['value'];
|
Fp := List.Values['value'];
|
||||||
if Fp = ''
|
if Fp = ''
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user