mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 23:25:56 +02:00
Debugger: refactor added OnExecuted
git-svn-id: trunk@28014 -
This commit is contained in:
parent
f83fa9f0ae
commit
10dadac967
@ -111,11 +111,14 @@ type
|
|||||||
|
|
||||||
TGDBMIDebuggerCommand = class
|
TGDBMIDebuggerCommand = class
|
||||||
private
|
private
|
||||||
|
FOnExecuted: TNotifyEvent;
|
||||||
FState : TGDBMIDebuggerCommandState;
|
FState : TGDBMIDebuggerCommandState;
|
||||||
protected
|
protected
|
||||||
procedure SetState(NewState: TGDBMIDebuggerCommandState);
|
procedure SetState(NewState: TGDBMIDebuggerCommandState);
|
||||||
procedure DoStateChanged(OldState: TGDBMIDebuggerCommandState); virtual;
|
procedure DoStateChanged(OldState: TGDBMIDebuggerCommandState); virtual;
|
||||||
procedure DoFree; virtual;
|
procedure DoFree; virtual;
|
||||||
|
function DoExecute(TheDebugger: TGDBMIDebugger): Boolean; virtual; abstract;
|
||||||
|
procedure DoOnExecuted;
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
// DoQueued: Called if queued *behind* others
|
// DoQueued: Called if queued *behind* others
|
||||||
@ -123,8 +126,9 @@ type
|
|||||||
// DoFinished: Called after processing is done
|
// DoFinished: Called after processing is done
|
||||||
// defaults to Destroy the object
|
// defaults to Destroy the object
|
||||||
procedure DoFinished;
|
procedure DoFinished;
|
||||||
function Execute(TheDebugger: TGDBMIDebugger): Boolean; virtual;
|
function Execute(TheDebugger: TGDBMIDebugger): Boolean;
|
||||||
property State: TGDBMIDebuggerCommandState read FState;
|
property State: TGDBMIDebuggerCommandState read FState;
|
||||||
|
property OnExecuted: TNotifyEvent read FOnExecuted write FOnExecuted;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TGDBMIDebuggerSimpleCommand }
|
{ TGDBMIDebuggerSimpleCommand }
|
||||||
@ -141,13 +145,13 @@ type
|
|||||||
protected
|
protected
|
||||||
procedure DoStateChanged(OldState: TGDBMIDebuggerCommandState); override;
|
procedure DoStateChanged(OldState: TGDBMIDebuggerCommandState); override;
|
||||||
procedure DoFree; override;
|
procedure DoFree; override;
|
||||||
|
function DoExecute(TheDebugger: TGDBMIDebugger): Boolean; override;
|
||||||
public
|
public
|
||||||
constructor Create(const ACommand: String;
|
constructor Create(const ACommand: String;
|
||||||
const AValues: array of const;
|
const AValues: array of const;
|
||||||
const AFlags: TGDBMICmdFlags;
|
const AFlags: TGDBMICmdFlags;
|
||||||
const ACallback: TGDBMICallback;
|
const ACallback: TGDBMICallback;
|
||||||
const ATag: PtrInt);
|
const ATag: PtrInt);
|
||||||
function Execute(TheDebugger: TGDBMIDebugger): Boolean; override;
|
|
||||||
property Result: TGDBMIExecResult read FResult;
|
property Result: TGDBMIExecResult read FResult;
|
||||||
property KeepFinished: Boolean read FKeepFinished write SetKeepFinished;
|
property KeepFinished: Boolean read FKeepFinished write SetKeepFinished;
|
||||||
end;
|
end;
|
||||||
@ -6132,6 +6136,12 @@ begin
|
|||||||
Self.Free;
|
Self.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TGDBMIDebuggerCommand.DoOnExecuted;
|
||||||
|
begin
|
||||||
|
if assigned(FOnExecuted) then
|
||||||
|
FOnExecuted(self);
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TGDBMIDebuggerCommand.Create;
|
constructor TGDBMIDebuggerCommand.Create;
|
||||||
begin
|
begin
|
||||||
FState := dcsNone;
|
FState := dcsNone;
|
||||||
@ -6149,7 +6159,10 @@ end;
|
|||||||
|
|
||||||
function TGDBMIDebuggerCommand.Execute(TheDebugger: TGDBMIDebugger): Boolean;
|
function TGDBMIDebuggerCommand.Execute(TheDebugger: TGDBMIDebugger): Boolean;
|
||||||
begin
|
begin
|
||||||
|
// Set the state first, so DoExecute can set an error-state
|
||||||
SetState(dcsExecuted);
|
SetState(dcsExecuted);
|
||||||
|
Result := DoExecute(TheDebugger);
|
||||||
|
DoOnExecuted;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TGDBMIDebuggerSimpleCommand }
|
{ TGDBMIDebuggerSimpleCommand }
|
||||||
@ -6190,12 +6203,11 @@ begin
|
|||||||
FKeepFinished := False;
|
FKeepFinished := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGDBMIDebuggerSimpleCommand.Execute(TheDebugger: TGDBMIDebugger): Boolean;
|
function TGDBMIDebuggerSimpleCommand.DoExecute(TheDebugger: TGDBMIDebugger): Boolean;
|
||||||
var
|
var
|
||||||
R: Boolean;
|
R: Boolean;
|
||||||
StoppedParams: String;
|
StoppedParams: String;
|
||||||
begin
|
begin
|
||||||
inherited;
|
|
||||||
Result := True;
|
Result := True;
|
||||||
TheDebugger.QueueExecuteLock; // prevent other commands from executing
|
TheDebugger.QueueExecuteLock; // prevent other commands from executing
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user