Debugger: Ensure queue lock during gdb communications

git-svn-id: trunk@42450 -
This commit is contained in:
martin 2013-08-22 18:28:55 +00:00
parent 3dbf110c44
commit 13bd274252

View File

@ -302,7 +302,7 @@ type
procedure SetCommandState(NewState: TGDBMIDebuggerCommandState);
procedure DoStateChanged(OldState: TGDBMIDebuggerCommandState); virtual;
procedure DoLockQueueExecute; virtual;
procedure DoUnockQueueExecute; virtual;
procedure DoUnLockQueueExecute; virtual;
function DoExecute: Boolean; virtual; abstract;
procedure DoOnExecuted;
procedure DoCancel; virtual;
@ -522,7 +522,7 @@ type
FStepBreakPoint: Integer;
protected
procedure DoLockQueueExecute; override;
procedure DoUnockQueueExecute; override;
procedure DoUnLockQueueExecute; override;
function ProcessStopped(const AParams: String; const AIgnoreSigIntState: Boolean): Boolean; override;
{$IFDEF MSWindows}
function FixThreadForSigTrap: Boolean;
@ -5223,7 +5223,7 @@ begin
// prevent lock
end;
procedure TGDBMIDebuggerCommandExecute.DoUnockQueueExecute;
procedure TGDBMIDebuggerCommandExecute.DoUnLockQueueExecute;
begin
// prevent lock
end;
@ -10088,7 +10088,7 @@ begin
FTheDebugger.QueueExecuteLock;
end;
procedure TGDBMIDebuggerCommand.DoUnockQueueExecute;
procedure TGDBMIDebuggerCommand.DoUnLockQueueExecute;
begin
FTheDebugger.QueueExecuteUnlock;
end;
@ -10144,6 +10144,8 @@ begin
then ATimeOut := DefaultTimeOut;
try
FTheDebugger.QueueExecuteLock;
if (cfNoThreadContext in AFlags) or (FContext.ThreadContext = ccNotRequired) or
((FContext.ThreadContext = ccUseGlobal) and (not FTheDebugger.FCurrentThreadIdValid)) or
(ContextThreadId = 0) // TODO: 0 is not valid => use current
@ -10179,6 +10181,7 @@ begin
DoTimeoutFeedback;
end;
finally
FTheDebugger.QueueExecuteUnlock;
Instr.ReleaseReference;
end;
@ -11019,7 +11022,7 @@ begin
end;
end;
// No re-raise in the except block. So no try-finally required
DoUnockQueueExecute;
DoUnLockQueueExecute;
ReleaseReference;
end;