mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 10:39:30 +02:00
DBG: Prevent potential crash in (dbg-)OnIdle handling
git-svn-id: trunk@37920 -
This commit is contained in:
parent
27ad4cf344
commit
c333eda9b8
@ -370,6 +370,7 @@ type
|
|||||||
FExceptionBreak: TGDBMIInternalBreakPoint;
|
FExceptionBreak: TGDBMIInternalBreakPoint;
|
||||||
FPauseWaitState: TGDBMIPauseWaitState;
|
FPauseWaitState: TGDBMIPauseWaitState;
|
||||||
FInExecuteCount: Integer;
|
FInExecuteCount: Integer;
|
||||||
|
FInIdle: Boolean;
|
||||||
FRunQueueOnUnlock: Boolean;
|
FRunQueueOnUnlock: Boolean;
|
||||||
FDebuggerFlags: TGDBMIDebuggerFlags;
|
FDebuggerFlags: TGDBMIDebuggerFlags;
|
||||||
FSourceNames: TStringList; // Objects[] -> TMap[Integer|Integer] -> TDbgPtr
|
FSourceNames: TStringList; // Objects[] -> TMap[Integer|Integer] -> TDbgPtr
|
||||||
@ -6659,8 +6660,24 @@ begin
|
|||||||
FCurrentCommand := NestedCurrentCmd;
|
FCurrentCommand := NestedCurrentCmd;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (FCommandQueue.Count = 0) and assigned(OnIdle)
|
if (FCommandQueue.Count = 0) and assigned(OnIdle) and (FInExecuteCount=0) and (not FInIdle)
|
||||||
then OnIdle(Self);
|
then begin
|
||||||
|
repeat
|
||||||
|
DebugLnEnter(DBGMI_QUEUE_DEBUG, ['>> Run OnIdle']);
|
||||||
|
LockCommandProcessing;
|
||||||
|
FInIdle := True;
|
||||||
|
try
|
||||||
|
OnIdle(Self);
|
||||||
|
finally
|
||||||
|
R := (FCommandQueue.Count > 0) and (FCommandProcessingLock = 1) and FRunQueueOnUnlock;
|
||||||
|
DebugLn(DBGMI_QUEUE_DEBUG, ['OnIdle: UnLock']);
|
||||||
|
UnLockCommandProcessing;
|
||||||
|
FInIdle := False;
|
||||||
|
end;
|
||||||
|
DebugLnExit(DBGMI_QUEUE_DEBUG, ['<< Run OnIdle']);
|
||||||
|
until not R;
|
||||||
|
DebugLn(DBGMI_QUEUE_DEBUG, ['OnIdle: Finished ']);
|
||||||
|
end;
|
||||||
|
|
||||||
if FNeedStateToIdle and (FInExecuteCount = 0)
|
if FNeedStateToIdle and (FInExecuteCount = 0)
|
||||||
then ResetStateToIdle;
|
then ResetStateToIdle;
|
||||||
@ -7283,6 +7300,7 @@ begin
|
|||||||
FPauseWaitState := pwsNone;
|
FPauseWaitState := pwsNone;
|
||||||
FErrorHandlingFlags := [];
|
FErrorHandlingFlags := [];
|
||||||
FInExecuteCount := 0;
|
FInExecuteCount := 0;
|
||||||
|
FInIdle := False;
|
||||||
FNeedStateToIdle := False;
|
FNeedStateToIdle := False;
|
||||||
Options := '-silent -i mi -nx';
|
Options := '-silent -i mi -nx';
|
||||||
|
|
||||||
@ -8563,7 +8581,7 @@ begin
|
|||||||
and (Debugger.State = dsPause)
|
and (Debugger.State = dsPause)
|
||||||
then RegistersNeeded;
|
then RegistersNeeded;
|
||||||
|
|
||||||
Result := Length(FRegNames)
|
Result := Length(FRegNames);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGDBMIRegisters.GetModified(const AnIndex: Integer): Boolean;
|
function TGDBMIRegisters.GetModified(const AnIndex: Integer): Boolean;
|
||||||
@ -8675,7 +8693,7 @@ end;
|
|||||||
|
|
||||||
function TGDBMIRegisters.GetDebugger: TGDBMIDebugger;
|
function TGDBMIRegisters.GetDebugger: TGDBMIDebugger;
|
||||||
begin
|
begin
|
||||||
Result := TGDBMIDebugger(inherited Debugger)
|
Result := TGDBMIDebugger(inherited Debugger);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGDBMIRegisters.DoGetRegValuesDestroyed(Sender: TObject);
|
procedure TGDBMIRegisters.DoGetRegValuesDestroyed(Sender: TObject);
|
||||||
|
Loading…
Reference in New Issue
Block a user