mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 20:39:14 +02:00
DBG: Fix a possible crash in debugger (history). Issue #0021901
git-svn-id: trunk@37116 -
This commit is contained in:
parent
5465d579a1
commit
d403a03802
@ -2339,6 +2339,7 @@ type
|
|||||||
FRequestsDone: TSnapshotManagerRequestedFlags;
|
FRequestsDone: TSnapshotManagerRequestedFlags;
|
||||||
FCurrentSnapshot: TSnapshot; // snapshot for current pause. Not yet in list
|
FCurrentSnapshot: TSnapshot; // snapshot for current pause. Not yet in list
|
||||||
procedure SetActive(const AValue: Boolean);
|
procedure SetActive(const AValue: Boolean);
|
||||||
|
procedure SetDebugger(AValue: TDebugger);
|
||||||
protected
|
protected
|
||||||
FHistoryCapacity: Integer;
|
FHistoryCapacity: Integer;
|
||||||
FHistoryIndex: Integer;
|
FHistoryIndex: Integer;
|
||||||
@ -2403,7 +2404,7 @@ type
|
|||||||
property Watches: TWatchesMonitor read FWatches write FWatches;
|
property Watches: TWatchesMonitor read FWatches write FWatches;
|
||||||
property CallStack: TCallStackMonitor read FCallStack write SetCallStack;
|
property CallStack: TCallStackMonitor read FCallStack write SetCallStack;
|
||||||
property Threads: TThreadsMonitor read FThreads write FThreads;
|
property Threads: TThreadsMonitor read FThreads write FThreads;
|
||||||
property Debugger: TDebugger read FDebugger write FDebugger;
|
property Debugger: TDebugger read FDebugger write SetDebugger;
|
||||||
property UnitInfoProvider: TDebuggerUnitInfoProvider read FUnitInfoProvider write FUnitInfoProvider;
|
property UnitInfoProvider: TDebuggerUnitInfoProvider read FUnitInfoProvider write FUnitInfoProvider;
|
||||||
end;
|
end;
|
||||||
{%endregion ^^^^^ Snapshots ^^^^^ }
|
{%endregion ^^^^^ Snapshots ^^^^^ }
|
||||||
@ -3665,6 +3666,13 @@ begin
|
|||||||
then DoDebuggerIdle;
|
then DoDebuggerIdle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSnapshotManager.SetDebugger(AValue: TDebugger);
|
||||||
|
begin
|
||||||
|
if FDebugger = AValue then Exit;
|
||||||
|
FDebugger := AValue;
|
||||||
|
FCurrentState := dsNone;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSnapshotManager.DoCallStackChanged(Sender: TObject);
|
procedure TSnapshotManager.DoCallStackChanged(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if FForcedIdle then
|
if FForcedIdle then
|
||||||
@ -4060,7 +4068,9 @@ begin
|
|||||||
if not(smrThreads in FRequestsDone) then begin
|
if not(smrThreads in FRequestsDone) then begin
|
||||||
include(FRequestsDone, smrThreads);
|
include(FRequestsDone, smrThreads);
|
||||||
FThreads.CurrentThreads.Count;
|
FThreads.CurrentThreads.Count;
|
||||||
if (not Debugger.IsIdle) and (not AForce) then exit;
|
if (not(FCurrentState in [dsPause, dsInternalPause])) or
|
||||||
|
(Debugger = nil) or ( (not Debugger.IsIdle) and (not AForce) )
|
||||||
|
then exit;
|
||||||
if CurSnap <> FCurrentSnapshot then exit; // Debugger did "run" in between
|
if CurSnap <> FCurrentSnapshot then exit; // Debugger did "run" in between
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -4074,7 +4084,9 @@ begin
|
|||||||
include(FRequestsDone, smrCallStack);
|
include(FRequestsDone, smrCallStack);
|
||||||
if k > 0
|
if k > 0
|
||||||
then FCallStack.CurrentCallStackList.EntriesForThreads[i].PrepareRange(0, Min(5, k));
|
then FCallStack.CurrentCallStackList.EntriesForThreads[i].PrepareRange(0, Min(5, k));
|
||||||
if (not Debugger.IsIdle) and (not AForce) then exit;
|
if (not(FCurrentState in [dsPause, dsInternalPause])) or
|
||||||
|
(Debugger = nil) or ( (not Debugger.IsIdle) and (not AForce) )
|
||||||
|
then exit;
|
||||||
if CurSnap <> FCurrentSnapshot then exit; // Debugger did "run" in between
|
if CurSnap <> FCurrentSnapshot then exit; // Debugger did "run" in between
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -4086,7 +4098,9 @@ begin
|
|||||||
include(FRequestsDone, smrCallStackCnt);
|
include(FRequestsDone, smrCallStackCnt);
|
||||||
i := FThreads.CurrentThreads.CurrentThreadId;
|
i := FThreads.CurrentThreads.CurrentThreadId;
|
||||||
FCallStack.CurrentCallStackList.EntriesForThreads[i].Count;
|
FCallStack.CurrentCallStackList.EntriesForThreads[i].Count;
|
||||||
if (not Debugger.IsIdle) and (not AForce) then exit;
|
if (not(FCurrentState in [dsPause, dsInternalPause])) or
|
||||||
|
(Debugger = nil) or ( (not Debugger.IsIdle) and (not AForce) )
|
||||||
|
then exit;
|
||||||
if CurSnap <> FCurrentSnapshot then exit; // Debugger did "run" in between
|
if CurSnap <> FCurrentSnapshot then exit; // Debugger did "run" in between
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -4095,7 +4109,9 @@ begin
|
|||||||
i := FThreads.CurrentThreads.CurrentThreadId;
|
i := FThreads.CurrentThreads.CurrentThreadId;
|
||||||
j := FCallStack.CurrentCallStackList.EntriesForThreads[i].CurrentIndex;
|
j := FCallStack.CurrentCallStackList.EntriesForThreads[i].CurrentIndex;
|
||||||
FLocals.CurrentLocalsList.Entries[i, j].Count;
|
FLocals.CurrentLocalsList.Entries[i, j].Count;
|
||||||
if (not Debugger.IsIdle) and (not AForce) then exit;
|
if (not(FCurrentState in [dsPause, dsInternalPause])) or
|
||||||
|
(Debugger = nil) or ( (not Debugger.IsIdle) and (not AForce) )
|
||||||
|
then exit;
|
||||||
if CurSnap <> FCurrentSnapshot then exit; // Debugger did "run" in between
|
if CurSnap <> FCurrentSnapshot then exit; // Debugger did "run" in between
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -4105,7 +4121,9 @@ begin
|
|||||||
j := FCallStack.CurrentCallStackList.EntriesForThreads[i].CurrentIndex;
|
j := FCallStack.CurrentCallStackList.EntriesForThreads[i].CurrentIndex;
|
||||||
w := FWatches.CurrentWatches;
|
w := FWatches.CurrentWatches;
|
||||||
for k := 0 to w.Count - 1 do w[k].Values[i, j].Value;
|
for k := 0 to w.Count - 1 do w[k].Values[i, j].Value;
|
||||||
if (not Debugger.IsIdle) and (not AForce) then exit;
|
if (not(FCurrentState in [dsPause, dsInternalPause])) or
|
||||||
|
(Debugger = nil) or ( (not Debugger.IsIdle) and (not AForce) )
|
||||||
|
then exit;
|
||||||
if CurSnap <> FCurrentSnapshot then exit; // Debugger did "run" in between
|
if CurSnap <> FCurrentSnapshot then exit; // Debugger did "run" in between
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
|
Loading…
Reference in New Issue
Block a user