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