Debugger: refactor

git-svn-id: trunk@44463 -
This commit is contained in:
martin 2014-03-18 02:45:28 +00:00
parent 3365e9987e
commit c0924d71a4
8 changed files with 329 additions and 292 deletions

View File

@ -670,6 +670,9 @@ type
property CurrentWatches: TWatchesBase read FCurrentWatches write FCurrentWatches; property CurrentWatches: TWatchesBase read FCurrentWatches write FCurrentWatches;
end; end;
TWatchesMonitor = class(TDebuggerDataMonitor)
end;
{%endregion ^^^^^ Watches ^^^^^ } {%endregion ^^^^^ Watches ^^^^^ }
{%region Locals *************************************************************** {%region Locals ***************************************************************
@ -739,6 +742,9 @@ type
property CurrentLocalsList: TLocalsList read FCurrentLocalsList write FCurrentLocalsList; property CurrentLocalsList: TLocalsList read FCurrentLocalsList write FCurrentLocalsList;
end; end;
TLocalsMonitor = class(TDebuggerDataMonitor)
end;
{%endregion ^^^^^ Locals ^^^^^ } {%endregion ^^^^^ Locals ^^^^^ }
{%region Line Info ************************************************************ {%region Line Info ************************************************************
@ -897,6 +903,9 @@ type
property CurrentRegistersList: TRegistersList read FCurrentRegistersList write FCurrentRegistersList; property CurrentRegistersList: TRegistersList read FCurrentRegistersList write FCurrentRegistersList;
end; end;
TRegistersMonitor = class(TDebuggerDataMonitor)
end;
{%endregion ^^^^^ Register ^^^^^ } {%endregion ^^^^^ Register ^^^^^ }
{%region Callstack ************************************************************ {%region Callstack ************************************************************
@ -1028,6 +1037,9 @@ type
property CurrentCallStackList: TCallStackListBase read FCurrentCallStackList write FCurrentCallStackList; property CurrentCallStackList: TCallStackListBase read FCurrentCallStackList write FCurrentCallStackList;
end; end;
TCallStackMonitor = class(TDebuggerDataMonitor)
end;
{%endregion ^^^^^ Callstack ^^^^^ } {%endregion ^^^^^ Callstack ^^^^^ }
{%region ***** Disassembler ***** } {%region ***** Disassembler ***** }
@ -1244,6 +1256,9 @@ type
property CurrentThreads: TThreadsBase read FCurrentThreads write FCurrentThreads; property CurrentThreads: TThreadsBase read FCurrentThreads write FCurrentThreads;
end; end;
TThreadsMonitor = class(TDebuggerDataMonitor)
end;
{%endregion ^^^^^ Threads ^^^^^ } {%endregion ^^^^^ Threads ^^^^^ }
{%region Signals / Exceptions *************************************************} {%region Signals / Exceptions *************************************************}

File diff suppressed because it is too large Load Diff

View File

@ -61,15 +61,15 @@ type
private (* provide some common properties *) private (* provide some common properties *)
FSnapshotManager: TSnapshotManager; FSnapshotManager: TSnapshotManager;
FSnapshotNotification: TSnapshotNotification; FSnapshotNotification: TSnapshotNotification;
FThreadsMonitor: TThreadsMonitor; FThreadsMonitor: TIdeThreadsMonitor;
FThreadsNotification: TThreadsNotification; FThreadsNotification: TThreadsNotification;
FCallStackMonitor: TCallStackMonitor; FCallStackMonitor: TIdeCallStackMonitor;
FCallStackNotification: TCallStackNotification; FCallStackNotification: TCallStackNotification;
FLocalsMonitor: TLocalsMonitor; FLocalsMonitor: TIdeLocalsMonitor;
FLocalsNotification: TLocalsNotification; FLocalsNotification: TLocalsNotification;
FWatchesMonitor: TWatchesMonitor; FWatchesMonitor: TIdeWatchesMonitor;
FWatchesNotification: TWatchesNotification; FWatchesNotification: TWatchesNotification;
FRegistersMonitor: TRegistersMonitor; FRegistersMonitor: TIdeRegistersMonitor;
FRegistersNotification: TRegistersNotification; FRegistersNotification: TRegistersNotification;
FBreakPoints: TIDEBreakPoints; FBreakPoints: TIDEBreakPoints;
FBreakpointsNotification: TIDEBreakPointsNotification; FBreakpointsNotification: TIDEBreakPointsNotification;
@ -81,11 +81,11 @@ type
function GetRegistersNotification: TRegistersNotification; function GetRegistersNotification: TRegistersNotification;
function GetBreakpointsNotification: TIDEBreakPointsNotification; function GetBreakpointsNotification: TIDEBreakPointsNotification;
procedure SetSnapshotManager(const AValue: TSnapshotManager); procedure SetSnapshotManager(const AValue: TSnapshotManager);
procedure SetThreadsMonitor(const AValue: TThreadsMonitor); procedure SetThreadsMonitor(const AValue: TIdeThreadsMonitor);
procedure SetCallStackMonitor(const AValue: TCallStackMonitor); procedure SetCallStackMonitor(const AValue: TIdeCallStackMonitor);
procedure SetLocalsMonitor(const AValue: TLocalsMonitor); procedure SetLocalsMonitor(const AValue: TIdeLocalsMonitor);
procedure SetWatchesMonitor(const AValue: TWatchesMonitor); procedure SetWatchesMonitor(const AValue: TIdeWatchesMonitor);
procedure SetRegistersMonitor(AValue: TRegistersMonitor); procedure SetRegistersMonitor(AValue: TIdeRegistersMonitor);
procedure SetBreakPoints(const AValue: TIDEBreakPoints); procedure SetBreakPoints(const AValue: TIDEBreakPoints);
protected protected
procedure JumpToUnitSource(AnUnitInfo: TDebuggerUnitInfo; ALine: Integer); procedure JumpToUnitSource(AnUnitInfo: TDebuggerUnitInfo; ALine: Integer);
@ -103,11 +103,11 @@ type
protected protected
// publish as needed // publish as needed
property SnapshotManager: TSnapshotManager read FSnapshotManager write SetSnapshotManager; property SnapshotManager: TSnapshotManager read FSnapshotManager write SetSnapshotManager;
property ThreadsMonitor: TThreadsMonitor read FThreadsMonitor write SetThreadsMonitor; property ThreadsMonitor: TIdeThreadsMonitor read FThreadsMonitor write SetThreadsMonitor;
property CallStackMonitor: TCallStackMonitor read FCallStackMonitor write SetCallStackMonitor; property CallStackMonitor: TIdeCallStackMonitor read FCallStackMonitor write SetCallStackMonitor;
property LocalsMonitor: TLocalsMonitor read FLocalsMonitor write SetLocalsMonitor; property LocalsMonitor: TIdeLocalsMonitor read FLocalsMonitor write SetLocalsMonitor;
property WatchesMonitor: TWatchesMonitor read FWatchesMonitor write SetWatchesMonitor; property WatchesMonitor: TIdeWatchesMonitor read FWatchesMonitor write SetWatchesMonitor;
property RegistersMonitor: TRegistersMonitor read FRegistersMonitor write SetRegistersMonitor; property RegistersMonitor: TIdeRegistersMonitor read FRegistersMonitor write SetRegistersMonitor;
property BreakPoints: TIDEBreakPoints read FBreakPoints write SetBreakPoints; property BreakPoints: TIDEBreakPoints read FBreakPoints write SetBreakPoints;
public public
destructor Destroy; override; destructor Destroy; override;
@ -235,7 +235,7 @@ begin
Result := FBreakpointsNotification; Result := FBreakpointsNotification;
end; end;
procedure TDebuggerDlg.SetRegistersMonitor(AValue: TRegistersMonitor); procedure TDebuggerDlg.SetRegistersMonitor(AValue: TIdeRegistersMonitor);
begin begin
if FRegistersMonitor = AValue then exit; if FRegistersMonitor = AValue then exit;
BeginUpdate; BeginUpdate;
@ -268,7 +268,7 @@ begin
end; end;
end; end;
procedure TDebuggerDlg.SetThreadsMonitor(const AValue: TThreadsMonitor); procedure TDebuggerDlg.SetThreadsMonitor(const AValue: TIdeThreadsMonitor);
begin begin
if FThreadsMonitor = AValue then exit; if FThreadsMonitor = AValue then exit;
BeginUpdate; BeginUpdate;
@ -285,7 +285,7 @@ begin
end; end;
end; end;
procedure TDebuggerDlg.SetCallStackMonitor(const AValue: TCallStackMonitor); procedure TDebuggerDlg.SetCallStackMonitor(const AValue: TIdeCallStackMonitor);
begin begin
if FCallStackMonitor = AValue then exit; if FCallStackMonitor = AValue then exit;
BeginUpdate; BeginUpdate;
@ -302,7 +302,7 @@ begin
end; end;
end; end;
procedure TDebuggerDlg.SetLocalsMonitor(const AValue: TLocalsMonitor); procedure TDebuggerDlg.SetLocalsMonitor(const AValue: TIdeLocalsMonitor);
begin begin
if FLocalsMonitor = AValue then exit; if FLocalsMonitor = AValue then exit;
BeginUpdate; BeginUpdate;
@ -318,7 +318,7 @@ begin
end; end;
end; end;
procedure TDebuggerDlg.SetWatchesMonitor(const AValue: TWatchesMonitor); procedure TDebuggerDlg.SetWatchesMonitor(const AValue: TIdeWatchesMonitor);
begin begin
if FWatchesMonitor = AValue then exit; if FWatchesMonitor = AValue then exit;
BeginUpdate; BeginUpdate;

View File

@ -3,10 +3,9 @@ program TestGdbmi;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
uses uses
Interfaces, Forms, GuiTestRunner, CompileHelpers, Interfaces, Forms, GuiTestRunner, CompileHelpers, TestGdbType, TestInstructionQueue,
TestGdbType, TestInstructionQueue, TestDisAss, TestDisAss, TestGDBMIControl, TestBase, TestException, Testwatches, TestBreakPoint,
TestGDBMIControl, TestEnvironment, TestArgV, FpGdbmiDebugger;
TestBase, TestException, Testwatches, TestBreakPoint, TestEnvironment, TestArgV;
{$R *.res} {$R *.res}

View File

@ -200,17 +200,17 @@ type
TGDBTestCase = class(TTestCase) TGDBTestCase = class(TTestCase)
private private
// stuff for the debugger // stuff for the debugger
FCallStack: TCallStackMonitor; FCallStack: TIdeCallStackMonitor;
FDisassembler: TIDEDisassembler; FDisassembler: TIDEDisassembler;
FExceptions: TBaseExceptions; FExceptions: TBaseExceptions;
//FSignals: TBaseSignals; //FSignals: TBaseSignals;
//FBreakPoints: TIDEBreakPoints; //FBreakPoints: TIDEBreakPoints;
//FBreakPointGroups: TIDEBreakPointGroups; //FBreakPointGroups: TIDEBreakPointGroups;
FLocals: TLocalsMonitor; FLocals: TIdeLocalsMonitor;
FLineInfo: TIDELineInfo; FLineInfo: TIDELineInfo;
FWatches: TWatchesMonitor; FWatches: TIdeWatchesMonitor;
FThreads: TThreadsMonitor; FThreads: TIdeThreadsMonitor;
FRegisters: TRegistersMonitor; FRegisters: TIdeRegistersMonitor;
private private
FParent: TGDBTestsuite; FParent: TGDBTestsuite;
FTestBaseName: String; FTestBaseName: String;
@ -279,14 +279,14 @@ type
//property BreakPoints: TIDEBreakPoints read FBreakpoints; // A list of breakpoints for the current project //property BreakPoints: TIDEBreakPoints read FBreakpoints; // A list of breakpoints for the current project
//property BreakPointGroups: TIDEBreakPointGroups read FBreakPointGroups; //property BreakPointGroups: TIDEBreakPointGroups read FBreakPointGroups;
property Exceptions: TBaseExceptions read FExceptions; // A list of exceptions we should ignore property Exceptions: TBaseExceptions read FExceptions; // A list of exceptions we should ignore
property CallStack: TCallStackMonitor read FCallStack; property CallStack: TIdeCallStackMonitor read FCallStack;
property Disassembler: TIDEDisassembler read FDisassembler; property Disassembler: TIDEDisassembler read FDisassembler;
property Locals: TLocalsMonitor read FLocals; property Locals: TIdeLocalsMonitor read FLocals;
property LineInfo: TIDELineInfo read FLineInfo; property LineInfo: TIDELineInfo read FLineInfo;
property Registers: TRegistersMonitor read FRegisters; property Registers: TIdeRegistersMonitor read FRegisters;
//property Signals: TBaseSignals read FSignals; // A list of actions for signals we know of //property Signals: TBaseSignals read FSignals; // A list of actions for signals we know of
property Watches: TWatchesMonitor read FWatches; property Watches: TIdeWatchesMonitor read FWatches;
property Threads: TThreadsMonitor read FThreads; property Threads: TIdeThreadsMonitor read FThreads;
end; end;
@ -526,15 +526,15 @@ function TGDBTestCase.StartGDB(AppDir, TestExeName: String): TGDBMIDebugger;
begin begin
//FBreakPoints := TManagedBreakPoints.Create(Self); //FBreakPoints := TManagedBreakPoints.Create(Self);
//FBreakPointGroups := TIDEBreakPointGroups.Create; //FBreakPointGroups := TIDEBreakPointGroups.Create;
FWatches := TWatchesMonitor.Create; FWatches := TIdeWatchesMonitor.Create;
FThreads := TThreadsMonitor.Create; FThreads := TIdeThreadsMonitor.Create;
FExceptions := TBaseExceptions.Create(TBaseException); FExceptions := TBaseExceptions.Create(TBaseException);
//FSignals := TBaseSignals.Create(TBaseSignal); //FSignals := TBaseSignals.Create(TBaseSignal);
FLocals := TLocalsMonitor.Create; FLocals := TIdeLocalsMonitor.Create;
FLineInfo := TIDELineInfo.Create; FLineInfo := TIDELineInfo.Create;
FCallStack := TCallStackMonitor.Create; FCallStack := TIdeCallStackMonitor.Create;
FDisassembler := TIDEDisassembler.Create; FDisassembler := TIDEDisassembler.Create;
FRegisters := TRegistersMonitor.Create; FRegisters := TIdeRegistersMonitor.Create;
Result := GdbClass.Create(DebuggerInfo.ExeName); Result := GdbClass.Create(DebuggerInfo.ExeName);
Result.OnDbgOutput := @InternalDbgOutPut; Result.OnDbgOutput := @InternalDbgOutPut;

View File

@ -42,16 +42,16 @@ type
TTestDisAss = class(TTestCase) TTestDisAss = class(TTestCase)
protected protected
FCallStack: TCallStackMonitor; FCallStack: TIdeCallStackMonitor;
FExceptions: TBaseExceptions; FExceptions: TBaseExceptions;
//FSignals: TBaseSignals; //FSignals: TBaseSignals;
//FBreakPoints: TIDEBreakPoints; //FBreakPoints: TIDEBreakPoints;
//FBreakPointGroups: TIDEBreakPointGroups; //FBreakPointGroups: TIDEBreakPointGroups;
FLocals: TLocalsMonitor; FLocals: TIdeLocalsMonitor;
FLineInfo: TIDELineInfo; FLineInfo: TIDELineInfo;
FWatches: TWatchesMonitor; FWatches: TIdeWatchesMonitor;
FThreads: TThreadsMonitor; FThreads: TIdeThreadsMonitor;
FRegisters: TRegistersMonitor; FRegisters: TIdeRegistersMonitor;
published published
procedure RangeMap; procedure RangeMap;
procedure Disassemble; procedure Disassemble;
@ -335,14 +335,14 @@ var
IdeDisAss := TIDEDisassembler.Create; IdeDisAss := TIDEDisassembler.Create;
IdeDisAss.Master := Gdb.Disassembler; IdeDisAss.Master := Gdb.Disassembler;
FWatches := TWatchesMonitor.Create; FWatches := TIdeWatchesMonitor.Create;
FThreads := TThreadsMonitor.Create; FThreads := TIdeThreadsMonitor.Create;
FExceptions := TBaseExceptions.Create(TBaseException); FExceptions := TBaseExceptions.Create(TBaseException);
//FSignals := TBaseSignals.Create(TBaseSignal); //FSignals := TBaseSignals.Create(TBaseSignal);
FLocals := TLocalsMonitor.Create; FLocals := TIdeLocalsMonitor.Create;
FLineInfo := TIDELineInfo.Create; FLineInfo := TIDELineInfo.Create;
FCallStack := TCallStackMonitor.Create; FCallStack := TIdeCallStackMonitor.Create;
FRegisters := TRegistersMonitor.Create; FRegisters := TIdeRegistersMonitor.Create;
//TManagedBreakpoints(FBreakpoints).Master := FDebugger.BreakPoints; //TManagedBreakpoints(FBreakpoints).Master := FDebugger.BreakPoints;
FWatches.Supplier := Gdb.Watches; FWatches.Supplier := Gdb.Watches;

View File

@ -107,17 +107,17 @@ type
TBaseDebugManager = class(TBaseDebugManagerIntf) TBaseDebugManager = class(TBaseDebugManagerIntf)
protected protected
FDestroying: boolean; FDestroying: boolean;
FCallStack: TCallStackMonitor; FCallStack: TIdeCallStackMonitor;
FDisassembler: TIDEDisassembler; FDisassembler: TIDEDisassembler;
FExceptions: TIDEExceptions; FExceptions: TIDEExceptions;
FSignals: TIDESignals; FSignals: TIDESignals;
FBreakPoints: TIDEBreakPoints; FBreakPoints: TIDEBreakPoints;
FBreakPointGroups: TIDEBreakPointGroups; FBreakPointGroups: TIDEBreakPointGroups;
FLocals: TLocalsMonitor; FLocals: TIdeLocalsMonitor;
FLineInfo: TIDELineInfo; FLineInfo: TIDELineInfo;
FWatches: TWatchesMonitor; FWatches: TIdeWatchesMonitor;
FThreads: TThreadsMonitor; FThreads: TIdeThreadsMonitor;
FRegisters: TRegistersMonitor; FRegisters: TIdeRegistersMonitor;
FSnapshots: TSnapshotManager; FSnapshots: TSnapshotManager;
FManagerStates: TDebugManagerStates; FManagerStates: TDebugManagerStates;
function GetState: TDBGState; virtual; abstract; function GetState: TDBGState; virtual; abstract;
@ -216,14 +216,14 @@ type
property BreakPoints: TIDEBreakPoints read FBreakpoints; // A list of breakpoints for the current project property BreakPoints: TIDEBreakPoints read FBreakpoints; // A list of breakpoints for the current project
property BreakPointGroups: TIDEBreakPointGroups read FBreakPointGroups; property BreakPointGroups: TIDEBreakPointGroups read FBreakPointGroups;
property Exceptions: TIDEExceptions read FExceptions; // A list of exceptions we should ignore property Exceptions: TIDEExceptions read FExceptions; // A list of exceptions we should ignore
property CallStack: TCallStackMonitor read FCallStack; property CallStack: TIdeCallStackMonitor read FCallStack;
property Disassembler: TIDEDisassembler read FDisassembler; property Disassembler: TIDEDisassembler read FDisassembler;
property Locals: TLocalsMonitor read FLocals; property Locals: TIdeLocalsMonitor read FLocals;
property LineInfo: TIDELineInfo read FLineInfo; property LineInfo: TIDELineInfo read FLineInfo;
property Registers: TRegistersMonitor read FRegisters; property Registers: TIdeRegistersMonitor read FRegisters;
property Signals: TIDESignals read FSignals; // A list of actions for signals we know of property Signals: TIDESignals read FSignals; // A list of actions for signals we know of
property Watches: TWatchesMonitor read FWatches; property Watches: TIdeWatchesMonitor read FWatches;
property Threads: TThreadsMonitor read FThreads; property Threads: TIdeThreadsMonitor read FThreads;
property Snapshots: TSnapshotManager read FSnapshots; property Snapshots: TSnapshotManager read FSnapshots;
(* TODO: workaround for http://bugs.freepascal.org/view.php?id=21834 *) (* TODO: workaround for http://bugs.freepascal.org/view.php?id=21834 *)
property DebuggerClass: TDebuggerClass read GetCurrentDebuggerClass; property DebuggerClass: TDebuggerClass read GetCurrentDebuggerClass;

View File

@ -1657,15 +1657,15 @@ begin
FUnitInfoProvider := TDebuggerUnitInfoProvider.Create; FUnitInfoProvider := TDebuggerUnitInfoProvider.Create;
FBreakPoints := TManagedBreakPoints.Create(Self); FBreakPoints := TManagedBreakPoints.Create(Self);
FBreakPointGroups := TIDEBreakPointGroups.Create; FBreakPointGroups := TIDEBreakPointGroups.Create;
FWatches := TWatchesMonitor.Create; FWatches := TIdeWatchesMonitor.Create;
FThreads := TThreadsMonitor.Create; FThreads := TIdeThreadsMonitor.Create;
FExceptions := TProjectExceptions.Create; FExceptions := TProjectExceptions.Create;
FSignals := TIDESignals.Create; FSignals := TIDESignals.Create;
FLocals := TLocalsMonitor.Create; FLocals := TIdeLocalsMonitor.Create;
FLineInfo := TIDELineInfo.Create; FLineInfo := TIDELineInfo.Create;
FCallStack := TCallStackMonitor.Create; FCallStack := TIdeCallStackMonitor.Create;
FDisassembler := TIDEDisassembler.Create; FDisassembler := TIDEDisassembler.Create;
FRegisters := TRegistersMonitor.Create; FRegisters := TIdeRegistersMonitor.Create;
FSnapshots := TSnapshotManager.Create; FSnapshots := TSnapshotManager.Create;
FSnapshots.Threads := FThreads; FSnapshots.Threads := FThreads;