mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 06:20:45 +02:00
DBG: Refactor, clean up
git-svn-id: trunk@31131 -
This commit is contained in:
parent
00bbb01e5d
commit
58dbddba3e
@ -116,8 +116,6 @@ type
|
||||
procedure popDeleteAllClick(Sender: TObject);
|
||||
private
|
||||
FBaseDirectory: string;
|
||||
FBreakPoints: TIDEBreakPoints;
|
||||
FBreakpointsNotification: TIDEBreakPointsNotification;
|
||||
FStates: TBreakPointsDlgStates;
|
||||
FLockActionUpdate: Integer;
|
||||
procedure BreakPointAdd(const ASender: TIDEBreakPoints;
|
||||
@ -128,8 +126,6 @@ type
|
||||
const ABreakpoint: TIDEBreakPoint);
|
||||
procedure SetBaseDirectory(const AValue: string);
|
||||
|
||||
procedure SetBreakPoints(const AValue: TIDEBreakPoints);
|
||||
|
||||
procedure UpdateItem(const AnItem: TListItem;
|
||||
const ABreakpoint: TIDEBreakPoint);
|
||||
procedure UpdateAll;
|
||||
@ -138,15 +134,15 @@ type
|
||||
procedure JumpToCurrentBreakPoint;
|
||||
procedure ShowProperties;
|
||||
protected
|
||||
procedure DoBreakPointsChanged; override;
|
||||
procedure DoBeginUpdate; override;
|
||||
procedure DoEndUpdate; override;
|
||||
procedure DisableAllActions;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
public
|
||||
property BaseDirectory: string read FBaseDirectory write SetBaseDirectory;
|
||||
property BreakPoints: TIDEBreakPoints read FBreakPoints write SetBreakPoints;
|
||||
property BreakPoints;
|
||||
end;
|
||||
|
||||
function GetBreakPointStateDescription(ABreakpoint: TBaseBreakpoint): string;
|
||||
@ -241,43 +237,13 @@ begin
|
||||
UpdateAll;
|
||||
end;
|
||||
|
||||
procedure TBreakPointsDlg.SetBreakPoints(const AValue: TIDEBreakPoints);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if FBreakPoints = AValue then Exit;
|
||||
|
||||
BeginUpdate;
|
||||
try
|
||||
lvBreakPoints.Items.Clear;
|
||||
if FBreakPoints <> nil
|
||||
then begin
|
||||
FBreakPoints.RemoveNotification(FBreakpointsNotification);
|
||||
end;
|
||||
|
||||
FBreakPoints:=AValue;
|
||||
|
||||
if FBreakPoints <> nil
|
||||
then begin
|
||||
FBreakPoints.AddNotification(FBreakpointsNotification);
|
||||
|
||||
for i:=0 to FBreakPoints.Count-1 do
|
||||
BreakPointUpdate(FBreakPoints, FBreakPoints.Items[i]);
|
||||
end;
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TBreakPointsDlg.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
Name:='BreakPointsDlg';
|
||||
FBreakpointsNotification := TIDEBreakPointsNotification.Create;
|
||||
FBreakpointsNotification.AddReference;
|
||||
FBreakpointsNotification.OnAdd := @BreakPointAdd;
|
||||
FBreakpointsNotification.OnUpdate := @BreakPointUpdate;
|
||||
FBreakpointsNotification.OnRemove := @BreakPointRemove;
|
||||
BreakpointsNotification.OnAdd := @BreakPointAdd;
|
||||
BreakpointsNotification.OnUpdate := @BreakPointUpdate;
|
||||
BreakpointsNotification.OnRemove := @BreakPointRemove;
|
||||
|
||||
ActionList1.Images := IDEImages.Images_16;
|
||||
ToolBar1.Images := IDEImages.Images_16;
|
||||
@ -320,16 +286,6 @@ begin
|
||||
FLockActionUpdate := 0;
|
||||
end;
|
||||
|
||||
destructor TBreakPointsDlg.Destroy;
|
||||
begin
|
||||
SetBreakPoints(nil);
|
||||
FBreakpointsNotification.OnAdd := nil;
|
||||
FBreakpointsNotification.OnUpdate := nil;
|
||||
FBreakpointsNotification.OnRemove := nil;
|
||||
FBreakpointsNotification.ReleaseReference;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TBreakPointsDlg.lvBreakPointsColumnClick(Sender: TObject;
|
||||
Column: TListColumn);
|
||||
begin
|
||||
@ -829,6 +785,18 @@ begin
|
||||
DebugBoss.ShowBreakPointProperties(CurBreakPoint);
|
||||
end;
|
||||
|
||||
procedure TBreakPointsDlg.DoBreakPointsChanged;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
lvBreakPoints.Items.Clear;
|
||||
if BreakPoints <> nil
|
||||
then begin
|
||||
for i:=0 to BreakPoints.Count-1 do
|
||||
BreakPointUpdate(BreakPoints, BreakPoints.Items[i]);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBreakPointsDlg.DoBeginUpdate;
|
||||
begin
|
||||
inherited DoBeginUpdate;
|
||||
|
@ -59,31 +59,31 @@ inherited CallStackDlg: TCallStackDlg
|
||||
ShowHint = True
|
||||
TabOrder = 1
|
||||
object ToolButtonShow: TToolButton
|
||||
Left = 110
|
||||
Left = 112
|
||||
Top = 0
|
||||
Action = actShow
|
||||
ImageIndex = 0
|
||||
end
|
||||
object ToolButtonCurrent: TToolButton
|
||||
Left = 160
|
||||
Left = 162
|
||||
Top = 0
|
||||
Action = actSetCurrent
|
||||
end
|
||||
object ToolButton4: TToolButton
|
||||
Left = 210
|
||||
Left = 212
|
||||
Top = 0
|
||||
Width = 8
|
||||
Width = 10
|
||||
Caption = 'ToolButton4'
|
||||
Style = tbsSeparator
|
||||
end
|
||||
object ToolButtonMore: TToolButton
|
||||
Left = 280
|
||||
Left = 284
|
||||
Top = 0
|
||||
Action = actViewMore
|
||||
ImageIndex = 1
|
||||
end
|
||||
object ToolButtonMax: TToolButton
|
||||
Left = 218
|
||||
Left = 222
|
||||
Top = 0
|
||||
Action = actViewLimit
|
||||
Caption = 'Max 10'
|
||||
@ -91,7 +91,7 @@ inherited CallStackDlg: TCallStackDlg
|
||||
Style = tbsDropDown
|
||||
end
|
||||
object ToolButtonGoto: TToolButton
|
||||
Left = 488
|
||||
Left = 494
|
||||
Top = 0
|
||||
Action = actViewGoto
|
||||
ImageIndex = 4
|
||||
@ -105,31 +105,31 @@ inherited CallStackDlg: TCallStackDlg
|
||||
object ToolButton8: TToolButton
|
||||
Left = 102
|
||||
Top = 0
|
||||
Width = 8
|
||||
Width = 10
|
||||
Caption = 'ToolButton8'
|
||||
Style = tbsSeparator
|
||||
end
|
||||
object ToolButton9: TToolButton
|
||||
Left = 330
|
||||
Left = 334
|
||||
Top = 0
|
||||
Width = 8
|
||||
Width = 10
|
||||
Caption = 'ToolButton9'
|
||||
Style = tbsSeparator
|
||||
end
|
||||
object ToolButtonTop: TToolButton
|
||||
Left = 338
|
||||
Left = 344
|
||||
Top = 0
|
||||
Action = actViewTop
|
||||
ImageIndex = 2
|
||||
end
|
||||
object ToolButtonBottom: TToolButton
|
||||
Left = 388
|
||||
Left = 394
|
||||
Top = 0
|
||||
Action = actViewBottom
|
||||
ImageIndex = 3
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 438
|
||||
Left = 444
|
||||
Height = 40
|
||||
Top = 0
|
||||
Width = 50
|
||||
@ -158,9 +158,9 @@ inherited CallStackDlg: TCallStackDlg
|
||||
Style = tbsCheck
|
||||
end
|
||||
object ToolButton2: TToolButton
|
||||
Left = 538
|
||||
Left = 544
|
||||
Top = 0
|
||||
Width = 8
|
||||
Width = 10
|
||||
Caption = 'ToolButton2'
|
||||
Style = tbsSeparator
|
||||
end
|
||||
|
@ -98,40 +98,27 @@ type
|
||||
procedure actSetAsCurrentClick(Sender : TObject);
|
||||
procedure actShowClick(Sender: TObject);
|
||||
private
|
||||
FBreakPoints: TIDEBreakPoints;
|
||||
FCallStackMonitor: TCallStackMonitor;
|
||||
FCallStackNotification: TCallStackNotification;
|
||||
FSnapshotManager: TSnapshotManager;
|
||||
FThreadNotification: TThreadsNotification;
|
||||
FBreakpointsNotification: TIDEBreakPointsNotification;
|
||||
FSnapshotNotification: TSnapshotNotification;
|
||||
FThreadsMonitor: TThreadsMonitor;
|
||||
FViewCount: Integer;
|
||||
FViewLimit: Integer;
|
||||
FViewStart: Integer;
|
||||
FPowerImgIdx, FPowerImgIdxGrey: Integer;
|
||||
FInUpdateView: Boolean;
|
||||
function GetImageIndex(Entry: TCallStackEntry): Integer;
|
||||
procedure SetBreakPoints(const AValue: TIDEBreakPoints);
|
||||
procedure SetSnapshotManager(const AValue: TSnapshotManager);
|
||||
procedure SetThreadsMonitor(const AValue: TThreadsMonitor);
|
||||
procedure SetViewLimit(const AValue: Integer);
|
||||
procedure SetViewStart(AStart: Integer);
|
||||
procedure SetViewMax;
|
||||
procedure BreakPointChanged(const ASender: TIDEBreakPoints; const ABreakpoint: TIDEBreakPoint);
|
||||
procedure CallStackChanged(Sender: TObject);
|
||||
procedure CallStackCurrent(Sender: TObject);
|
||||
procedure ThreadsCurrent(Sender: TObject);
|
||||
procedure SnapshotChanged(Sender: TObject);
|
||||
procedure GotoIndex(AIndex: Integer);
|
||||
function GetCurrentEntry: TCallStackEntry;
|
||||
function GetFunction(const Entry: TCallStackEntry): string;
|
||||
procedure SetCallStackMonitor(const AValue: TCallStackMonitor);
|
||||
procedure UpdateView;
|
||||
procedure JumpToSource;
|
||||
procedure CopyToClipBoard;
|
||||
procedure ToggleBreakpoint(Item: TListItem);
|
||||
protected
|
||||
procedure DoBreakPointsChanged; override;
|
||||
procedure DoBeginUpdate; override;
|
||||
procedure DoEndUpdate; override;
|
||||
procedure DisableAllActions;
|
||||
@ -141,12 +128,10 @@ type
|
||||
function GetSelectedCallstack: TCallStack;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
property BreakPoints: TIDEBreakPoints read FBreakPoints write SetBreakPoints;
|
||||
property CallStackMonitor: TCallStackMonitor read FCallStackMonitor write SetCallStackMonitor;
|
||||
property ThreadsMonitor: TThreadsMonitor read FThreadsMonitor write SetThreadsMonitor;
|
||||
property SnapshotManager: TSnapshotManager read FSnapshotManager write SetSnapshotManager;
|
||||
property BreakPoints;
|
||||
property CallStackMonitor;
|
||||
property ThreadsMonitor;
|
||||
property SnapshotManager;
|
||||
property ViewLimit: Integer read FViewLimit write SetViewLimit;
|
||||
end;
|
||||
|
||||
@ -170,24 +155,13 @@ var
|
||||
constructor TCallStackDlg.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FCallStackNotification := TCallStackNotification.Create;
|
||||
FCallStackNotification.AddReference;
|
||||
FCallStackNotification.OnChange := @CallStackChanged;
|
||||
FCallStackNotification.OnCurrent := @CallStackCurrent;
|
||||
|
||||
FBreakpointsNotification := TIDEBreakPointsNotification.Create;
|
||||
FBreakpointsNotification.AddReference;
|
||||
FBreakpointsNotification.OnAdd := @BreakPointChanged;
|
||||
FBreakpointsNotification.OnUpdate := @BreakPointChanged;
|
||||
FBreakpointsNotification.OnRemove := @BreakPointChanged;
|
||||
|
||||
FThreadNotification := TThreadsNotification.Create;
|
||||
FThreadNotification.AddReference;
|
||||
FThreadNotification.OnCurrent := @ThreadsCurrent;
|
||||
|
||||
FSnapshotNotification := TSnapshotNotification.Create;
|
||||
FSnapshotNotification.AddReference;
|
||||
FSnapshotNotification.OnCurrent := @SnapshotChanged;
|
||||
CallStackNotification.OnChange := @CallStackChanged;
|
||||
CallStackNotification.OnCurrent := @CallStackCurrent;
|
||||
BreakpointsNotification.OnAdd := @BreakPointChanged;
|
||||
BreakpointsNotification.OnUpdate := @BreakPointChanged;
|
||||
BreakpointsNotification.OnRemove := @BreakPointChanged;
|
||||
ThreadsNotification.OnCurrent := @CallStackChanged;
|
||||
SnapshotNotification.OnCurrent := @CallStackChanged;
|
||||
|
||||
FViewLimit := 10;
|
||||
FViewCount := 10;
|
||||
@ -347,29 +321,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
destructor TCallStackDlg.Destroy;
|
||||
begin
|
||||
SetBreakPoints(nil);
|
||||
FBreakpointsNotification.OnAdd := nil;
|
||||
FBreakpointsNotification.OnUpdate := nil;
|
||||
FBreakpointsNotification.OnRemove := nil;
|
||||
FBreakpointsNotification.ReleaseReference;
|
||||
|
||||
SetCallStackMonitor(nil);
|
||||
FCallStackNotification.OnChange := nil;
|
||||
FCallStackNotification.ReleaseReference;
|
||||
|
||||
SetThreadsMonitor(nil);
|
||||
FThreadNotification.OnCurrent := nil;
|
||||
FThreadNotification.ReleaseReference;
|
||||
|
||||
SetSnapshotManager(nil);
|
||||
FSnapshotNotification.OnChange := nil;
|
||||
FSnapshotNotification.OnCurrent := nil;
|
||||
FSnapshotNotification.ReleaseReference;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TCallStackDlg.DoBeginUpdate;
|
||||
begin
|
||||
DisableAllActions;
|
||||
@ -414,10 +365,10 @@ end;
|
||||
|
||||
function TCallStackDlg.GetSelectedThreads(Snap: TSnapshot): TThreads;
|
||||
begin
|
||||
if FThreadsMonitor = nil then exit(nil);
|
||||
if ThreadsMonitor = nil then exit(nil);
|
||||
if Snap = nil
|
||||
then Result := FThreadsMonitor.CurrentThreads
|
||||
else Result := FThreadsMonitor.Snapshots[Snap];
|
||||
then Result := ThreadsMonitor.CurrentThreads
|
||||
else Result := ThreadsMonitor.Snapshots[Snap];
|
||||
end;
|
||||
|
||||
function TCallStackDlg.GetSelectedCallstack: TCallStack;
|
||||
@ -539,6 +490,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCallStackDlg.DoBreakPointsChanged;
|
||||
begin
|
||||
UpdateView;
|
||||
end;
|
||||
|
||||
procedure TCallStackDlg.lvCallStackDBLCLICK(Sender: TObject);
|
||||
begin
|
||||
JumpToSource;
|
||||
@ -552,16 +508,6 @@ begin
|
||||
actViewLimit.Caption := TMenuItem(Sender).Caption;
|
||||
end;
|
||||
|
||||
procedure TCallStackDlg.SnapshotChanged(Sender: TObject);
|
||||
begin
|
||||
CallStackChanged(nil);
|
||||
end;
|
||||
|
||||
procedure TCallStackDlg.ThreadsCurrent(Sender: TObject);
|
||||
begin
|
||||
CallStackChanged(nil);
|
||||
end;
|
||||
|
||||
procedure TCallStackDlg.ToolButtonPowerClick(Sender: TObject);
|
||||
begin
|
||||
if ToolButtonPower.Down
|
||||
@ -774,30 +720,6 @@ begin
|
||||
// else lblViewCnt.Caption:= IntToStr(GetSelectedCallstack.Count);
|
||||
end;
|
||||
|
||||
procedure TCallStackDlg.SetCallStackMonitor(const AValue: TCallStackMonitor);
|
||||
begin
|
||||
if FCallStackMonitor = AValue then Exit;
|
||||
|
||||
BeginUpdate;
|
||||
try
|
||||
if FCallStackMonitor <> nil
|
||||
then begin
|
||||
FCallStackMonitor.RemoveNotification(FCallStackNotification);
|
||||
end;
|
||||
|
||||
FCallStackMonitor := AValue;
|
||||
|
||||
if FCallStackMonitor <> nil
|
||||
then begin
|
||||
FCallStackMonitor.AddNotification(FCallStackNotification);
|
||||
end;
|
||||
|
||||
CallStackChanged(nil);
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCallStackDlg.SetViewLimit(const AValue: Integer);
|
||||
begin
|
||||
ToolButtonPower.Down := True;
|
||||
@ -814,42 +736,6 @@ begin
|
||||
UpdateView;
|
||||
end;
|
||||
|
||||
procedure TCallStackDlg.SetBreakPoints(const AValue: TIDEBreakPoints);
|
||||
begin
|
||||
if FBreakPoints = AValue then Exit;
|
||||
|
||||
if FBreakPoints <> nil
|
||||
then begin
|
||||
FBreakPoints.RemoveNotification(FBreakpointsNotification);
|
||||
end;
|
||||
|
||||
FBreakPoints := AValue;
|
||||
|
||||
if FBreakPoints <> nil
|
||||
then begin
|
||||
FBreakPoints.AddNotification(FBreakpointsNotification);
|
||||
end;
|
||||
UpdateView;
|
||||
end;
|
||||
|
||||
procedure TCallStackDlg.SetSnapshotManager(const AValue: TSnapshotManager);
|
||||
begin
|
||||
if FSnapshotManager = AValue then exit;
|
||||
if FSnapshotManager <> nil then FSnapshotManager.RemoveNotification(FSnapshotNotification);
|
||||
FSnapshotManager := AValue;
|
||||
if FSnapshotManager <> nil then FSnapshotManager.AddNotification(FSnapshotNotification);
|
||||
UpdateView;
|
||||
end;
|
||||
|
||||
procedure TCallStackDlg.SetThreadsMonitor(const AValue: TThreadsMonitor);
|
||||
begin
|
||||
if FThreadsMonitor = AValue then exit;
|
||||
if FThreadsMonitor <> nil then FThreadsMonitor.RemoveNotification(FThreadNotification);
|
||||
FThreadsMonitor := AValue;
|
||||
if FThreadsMonitor <> nil then FThreadsMonitor.AddNotification(FThreadNotification);
|
||||
ThreadsCurrent(FThreadsMonitor);
|
||||
end;
|
||||
|
||||
function TCallStackDlg.GetFunction(const Entry: TCallStackEntry): string;
|
||||
begin
|
||||
Result := Entry.GetFunctionWithArg;
|
||||
|
@ -56,6 +56,50 @@ type
|
||||
procedure BeginUpdate;
|
||||
procedure EndUpdate;
|
||||
function UpdateCount: integer;
|
||||
private (* provide some common properties *)
|
||||
FSnapshotManager: TSnapshotManager;
|
||||
FSnapshotNotification: TSnapshotNotification;
|
||||
FThreadsMonitor: TThreadsMonitor;
|
||||
FThreadsNotification: TThreadsNotification;
|
||||
FCallStackMonitor: TCallStackMonitor;
|
||||
FCallStackNotification: TCallStackNotification;
|
||||
FLocalsMonitor: TLocalsMonitor;
|
||||
FLocalsNotification: TLocalsNotification;
|
||||
FWatchesMonitor: TWatchesMonitor;
|
||||
FWatchesNotification: TWatchesNotification;
|
||||
FBreakPoints: TIDEBreakPoints;
|
||||
FBreakpointsNotification: TIDEBreakPointsNotification;
|
||||
function GetSnapshotNotification: TSnapshotNotification;
|
||||
function GetThreadsNotification: TThreadsNotification;
|
||||
function GetCallStackNotification: TCallStackNotification;
|
||||
function GetLocalsNotification: TLocalsNotification;
|
||||
function GetWatchesNotification: TWatchesNotification;
|
||||
function GetBreakpointsNotification: TIDEBreakPointsNotification;
|
||||
procedure SetSnapshotManager(const AValue: TSnapshotManager);
|
||||
procedure SetThreadsMonitor(const AValue: TThreadsMonitor);
|
||||
procedure SetCallStackMonitor(const AValue: TCallStackMonitor);
|
||||
procedure SetLocalsMonitor(const AValue: TLocalsMonitor);
|
||||
procedure SetWatchesMonitor(const AValue: TWatchesMonitor);
|
||||
procedure SetBreakPoints(const AValue: TIDEBreakPoints);
|
||||
protected
|
||||
procedure DoWatchesChanged; virtual; // called if the WatchesMonitor object was changed
|
||||
procedure DoBreakPointsChanged; virtual; // called if the BreakPoint(Monitor) object was changed
|
||||
property SnapshotNotification: TSnapshotNotification read GetSnapshotNotification;
|
||||
property ThreadsNotification: TThreadsNotification read GetThreadsNotification;
|
||||
property CallStackNotification: TCallStackNotification read GetCallStackNotification;
|
||||
property LocalsNotification: TLocalsNotification read GetLocalsNotification;
|
||||
property WatchesNotification: TWatchesNotification read GetWatchesNotification;
|
||||
property BreakpointsNotification: TIDEBreakPointsNotification read GetBreakpointsNotification;
|
||||
protected
|
||||
// publish as needed
|
||||
property SnapshotManager: TSnapshotManager read FSnapshotManager write SetSnapshotManager;
|
||||
property ThreadsMonitor: TThreadsMonitor read FThreadsMonitor write SetThreadsMonitor;
|
||||
property CallStackMonitor: TCallStackMonitor read FCallStackMonitor write SetCallStackMonitor;
|
||||
property LocalsMonitor: TLocalsMonitor read FLocalsMonitor write SetLocalsMonitor;
|
||||
property WatchesMonitor: TWatchesMonitor read FWatchesMonitor write SetWatchesMonitor;
|
||||
property BreakPoints: TIDEBreakPoints read FBreakPoints write SetBreakPoints;
|
||||
public
|
||||
destructor Destroy; override;
|
||||
end;
|
||||
TDebuggerDlgClass = class of TDebuggerDlg;
|
||||
|
||||
@ -84,6 +128,229 @@ begin
|
||||
Result := FUpdateCount;
|
||||
end;
|
||||
|
||||
function TDebuggerDlg.GetSnapshotNotification: TSnapshotNotification;
|
||||
begin
|
||||
If FSnapshotNotification = nil then begin
|
||||
FSnapshotNotification := TSnapshotNotification.Create;
|
||||
FSnapshotNotification.AddReference;
|
||||
if (FSnapshotManager <> nil)
|
||||
then FSnapshotManager.AddNotification(FSnapshotNotification);
|
||||
end;
|
||||
Result := FSnapshotNotification;
|
||||
end;
|
||||
|
||||
function TDebuggerDlg.GetThreadsNotification: TThreadsNotification;
|
||||
begin
|
||||
if FThreadsNotification = nil then begin
|
||||
FThreadsNotification := TThreadsNotification.Create;
|
||||
FThreadsNotification.AddReference;
|
||||
if (FThreadsMonitor <> nil)
|
||||
then FThreadsMonitor.AddNotification(FThreadsNotification);
|
||||
end;
|
||||
Result := FThreadsNotification;
|
||||
end;
|
||||
|
||||
function TDebuggerDlg.GetCallStackNotification: TCallStackNotification;
|
||||
begin
|
||||
if FCallStackNotification = nil then begin
|
||||
FCallStackNotification := TCallStackNotification.Create;
|
||||
FCallStackNotification.AddReference;
|
||||
if (FCallStackMonitor <> nil)
|
||||
then FCallStackMonitor.AddNotification(FCallStackNotification);
|
||||
end;
|
||||
Result := FCallStackNotification;
|
||||
end;
|
||||
|
||||
function TDebuggerDlg.GetLocalsNotification: TLocalsNotification;
|
||||
begin
|
||||
If FLocalsNotification = nil then begin
|
||||
FLocalsNotification := TLocalsNotification.Create;
|
||||
FLocalsNotification.AddReference;
|
||||
if (FLocalsMonitor <> nil)
|
||||
then FLocalsMonitor.AddNotification(FLocalsNotification);
|
||||
end;
|
||||
Result := FLocalsNotification;
|
||||
end;
|
||||
|
||||
function TDebuggerDlg.GetWatchesNotification: TWatchesNotification;
|
||||
begin
|
||||
If FWatchesNotification = nil then begin
|
||||
FWatchesNotification := TWatchesNotification.Create;
|
||||
FWatchesNotification.AddReference;
|
||||
if (FWatchesMonitor <> nil)
|
||||
then FWatchesMonitor.AddNotification(FWatchesNotification);
|
||||
end;
|
||||
Result := FWatchesNotification;
|
||||
end;
|
||||
|
||||
function TDebuggerDlg.GetBreakpointsNotification: TIDEBreakPointsNotification;
|
||||
begin
|
||||
If FBreakpointsNotification = nil then begin
|
||||
FBreakpointsNotification := TIDEBreakPointsNotification.Create;
|
||||
FBreakpointsNotification.AddReference;
|
||||
if (FBreakPoints <> nil)
|
||||
then FBreakPoints.AddNotification(FBreakpointsNotification);
|
||||
end;
|
||||
Result := FBreakpointsNotification;
|
||||
end;
|
||||
|
||||
procedure TDebuggerDlg.SetSnapshotManager(const AValue: TSnapshotManager);
|
||||
begin
|
||||
if FSnapshotManager = AValue then exit;
|
||||
BeginUpdate;
|
||||
try
|
||||
if (FSnapshotManager <> nil) and (FSnapshotNotification <> nil)
|
||||
then FSnapshotManager.RemoveNotification(FSnapshotNotification);
|
||||
FSnapshotManager := AValue;
|
||||
if (FSnapshotManager <> nil) and (FSnapshotNotification <> nil)
|
||||
then FSnapshotManager.AddNotification(FSnapshotNotification);
|
||||
if assigned(FSnapshotNotification.OnChange) then FSnapshotNotification.OnChange(nil);
|
||||
if assigned(FSnapshotNotification.OnCurrent) then FSnapshotNotification.OnCurrent(nil);
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebuggerDlg.SetThreadsMonitor(const AValue: TThreadsMonitor);
|
||||
begin
|
||||
if FThreadsMonitor = AValue then exit;
|
||||
BeginUpdate;
|
||||
try
|
||||
if (FThreadsMonitor <> nil) and (FThreadsNotification <> nil)
|
||||
then FThreadsMonitor.RemoveNotification(FThreadsNotification);
|
||||
FThreadsMonitor := AValue;
|
||||
if (FThreadsMonitor <> nil) and (FThreadsNotification <> nil)
|
||||
then FThreadsMonitor.AddNotification(FThreadsNotification);
|
||||
if assigned(FThreadsNotification.OnChange) then FThreadsNotification.OnChange(nil);
|
||||
if assigned(FThreadsNotification.OnCurrent) then FThreadsNotification.OnCurrent(nil);
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebuggerDlg.SetCallStackMonitor(const AValue: TCallStackMonitor);
|
||||
begin
|
||||
if FCallStackMonitor = AValue then exit;
|
||||
BeginUpdate;
|
||||
try
|
||||
if (FCallStackMonitor <> nil) and (FCallStackNotification <> nil)
|
||||
then FCallStackMonitor.RemoveNotification(FCallStackNotification);
|
||||
FCallStackMonitor := AValue;
|
||||
if (FCallStackMonitor <> nil) and (FCallStackNotification <> nil)
|
||||
then FCallStackMonitor.AddNotification(FCallStackNotification);
|
||||
if assigned(FCallStackNotification.OnChange) then FCallStackNotification.OnChange(nil);
|
||||
if assigned(FCallStackNotification.OnCurrent) then FCallStackNotification.OnCurrent(nil);
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebuggerDlg.SetLocalsMonitor(const AValue: TLocalsMonitor);
|
||||
begin
|
||||
if FLocalsMonitor = AValue then exit;
|
||||
BeginUpdate;
|
||||
try
|
||||
if (FLocalsMonitor <> nil) and (FLocalsNotification <> nil)
|
||||
then FLocalsMonitor.RemoveNotification(FLocalsNotification);
|
||||
FLocalsMonitor := AValue;
|
||||
if (FLocalsMonitor <> nil) and (FLocalsNotification <> nil)
|
||||
then FLocalsMonitor.AddNotification(FLocalsNotification);
|
||||
if assigned(FLocalsNotification.OnChange) then FLocalsNotification.OnChange(nil);
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebuggerDlg.SetWatchesMonitor(const AValue: TWatchesMonitor);
|
||||
begin
|
||||
if FWatchesMonitor = AValue then exit;
|
||||
BeginUpdate;
|
||||
try
|
||||
if (FWatchesMonitor <> nil) and (FWatchesNotification <> nil)
|
||||
then FWatchesMonitor.RemoveNotification(FWatchesNotification);
|
||||
FWatchesMonitor := AValue;
|
||||
if (FWatchesMonitor <> nil) and (FWatchesNotification <> nil)
|
||||
then FWatchesMonitor.AddNotification(FWatchesNotification);
|
||||
DoWatchesChanged;
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebuggerDlg.SetBreakPoints(const AValue: TIDEBreakPoints);
|
||||
begin
|
||||
if FBreakPoints = AValue then exit;
|
||||
BeginUpdate;
|
||||
try
|
||||
if (FBreakPoints <> nil) and (FBreakpointsNotification <> nil)
|
||||
then FBreakPoints.RemoveNotification(FBreakpointsNotification);
|
||||
FBreakPoints := AValue;
|
||||
if (FBreakPoints <> nil) and (FBreakpointsNotification <> nil)
|
||||
then FBreakPoints.AddNotification(FBreakpointsNotification);
|
||||
DoBreakPointsChanged;
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDebuggerDlg.DoWatchesChanged;
|
||||
begin
|
||||
//
|
||||
end;
|
||||
|
||||
procedure TDebuggerDlg.DoBreakPointsChanged;
|
||||
begin
|
||||
//
|
||||
end;
|
||||
|
||||
destructor TDebuggerDlg.Destroy;
|
||||
begin
|
||||
if FSnapshotNotification <> nil then begin;
|
||||
FSnapshotNotification.OnChange := nil;
|
||||
FSnapshotNotification.OnCurrent := nil;
|
||||
end;
|
||||
SetSnapshotManager(nil);
|
||||
ReleaseAndNil(FSnapshotNotification);
|
||||
|
||||
if FThreadsNotification <> nil then begin;
|
||||
FThreadsNotification.OnChange := nil;
|
||||
FThreadsNotification.OnCurrent := nil;
|
||||
end;
|
||||
SetThreadsMonitor(nil);
|
||||
ReleaseAndNil(FThreadsNotification);
|
||||
|
||||
if FCallStackNotification <> nil then begin;
|
||||
FCallStackNotification.OnChange := nil;
|
||||
FCallStackNotification.OnCurrent := nil;
|
||||
end;
|
||||
SetCallStackMonitor(nil);
|
||||
ReleaseAndNil(FCallStackNotification);
|
||||
|
||||
if FLocalsNotification <> nil then begin;
|
||||
FLocalsNotification.OnChange := nil;
|
||||
end;
|
||||
SetLocalsMonitor(nil);
|
||||
ReleaseAndNil(FLocalsNotification);
|
||||
|
||||
if FWatchesNotification <> nil then begin;
|
||||
FWatchesNotification.OnAdd := nil;
|
||||
FWatchesNotification.OnRemove := nil;
|
||||
FWatchesNotification.OnUpdate := nil;
|
||||
end;
|
||||
SetWatchesMonitor(nil);
|
||||
ReleaseAndNil(FWatchesNotification);
|
||||
|
||||
if FBreakpointsNotification <> nil then begin;
|
||||
FBreakpointsNotification.OnAdd := nil;
|
||||
FBreakpointsNotification.OnRemove := nil;
|
||||
FBreakpointsNotification.OnUpdate := nil;
|
||||
end;
|
||||
SetBreakPoints(nil);
|
||||
ReleaseAndNil(FBreakpointsNotification);
|
||||
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TDebuggerDlg.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
var
|
||||
Command: Word;
|
||||
|
@ -33,20 +33,16 @@ type
|
||||
procedure tbPowerClick(Sender: TObject);
|
||||
procedure tbRemoveClick(Sender: TObject);
|
||||
private
|
||||
FSnapshotManager: TSnapshotManager;
|
||||
FSnapshotNotification: TSnapshotNotification;
|
||||
FInSnapshotChanged: Boolean;
|
||||
imgCurrentLine: Integer;
|
||||
FPowerImgIdx, FPowerImgIdxGrey: Integer;
|
||||
FEnabledImgIdx, FDisabledIdx: Integer;
|
||||
procedure SetSnapshotManager(const AValue: TSnapshotManager);
|
||||
procedure SnapshotChanged(Sender: TObject);
|
||||
procedure UpdateToolbar;
|
||||
public
|
||||
{ public declarations }
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
property SnapshotManager: TSnapshotManager read FSnapshotManager write SetSnapshotManager;
|
||||
property SnapshotManager;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -58,24 +54,24 @@ implementation
|
||||
procedure THistoryDialog.lvHistoryDblClick(Sender: TObject);
|
||||
begin
|
||||
if tbHist.Down then begin
|
||||
if (FSnapshotManager.HistoryIndex = lvHistory.Selected.Index) and
|
||||
(FSnapshotManager.HistorySelected)
|
||||
if (SnapshotManager.HistoryIndex = lvHistory.Selected.Index) and
|
||||
(SnapshotManager.HistorySelected)
|
||||
then begin
|
||||
FSnapshotManager.HistorySelected := False;
|
||||
SnapshotManager.HistorySelected := False;
|
||||
end
|
||||
else begin
|
||||
FSnapshotManager.HistoryIndex := lvHistory.Selected.Index;
|
||||
FSnapshotManager.HistorySelected := True;
|
||||
SnapshotManager.HistoryIndex := lvHistory.Selected.Index;
|
||||
SnapshotManager.HistorySelected := True;
|
||||
end;
|
||||
end else begin
|
||||
if (FSnapshotManager.SnapshotIndex = lvHistory.Selected.Index) and
|
||||
(FSnapshotManager.SnapshotSelected)
|
||||
if (SnapshotManager.SnapshotIndex = lvHistory.Selected.Index) and
|
||||
(SnapshotManager.SnapshotSelected)
|
||||
then begin
|
||||
FSnapshotManager.SnapshotSelected := False;
|
||||
SnapshotManager.SnapshotSelected := False;
|
||||
end
|
||||
else begin
|
||||
FSnapshotManager.SnapshotIndex := lvHistory.Selected.Index;
|
||||
FSnapshotManager.SnapshotSelected := True;
|
||||
SnapshotManager.SnapshotIndex := lvHistory.Selected.Index;
|
||||
SnapshotManager.SnapshotSelected := True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -88,16 +84,16 @@ end;
|
||||
|
||||
procedure THistoryDialog.tbClearClick(Sender: TObject);
|
||||
begin
|
||||
if FSnapshotManager <> nil
|
||||
then FSnapshotManager.Clear;
|
||||
if SnapshotManager <> nil
|
||||
then SnapshotManager.Clear;
|
||||
end;
|
||||
|
||||
procedure THistoryDialog.tbHistClick(Sender: TObject);
|
||||
begin
|
||||
if (FSnapshotManager = nil) or (FInSnapshotChanged) then exit;
|
||||
if (SnapshotManager = nil) or (FInSnapshotChanged) then exit;
|
||||
if tbHistorySelected.Down then begin
|
||||
if tbSnap.Down then FSnapshotManager.SnapshotSelected := True;
|
||||
if tbHist.Down then FSnapshotManager.HistorySelected := True;
|
||||
if tbSnap.Down then SnapshotManager.SnapshotSelected := True;
|
||||
if tbHist.Down then SnapshotManager.HistorySelected := True;
|
||||
end;
|
||||
SnapshotChanged(nil);
|
||||
end;
|
||||
@ -107,16 +103,16 @@ begin
|
||||
if tbHistorySelected.Down
|
||||
then tbHistorySelected.ImageIndex := FEnabledImgIdx
|
||||
else tbHistorySelected.ImageIndex := FDisabledIdx;
|
||||
if FSnapshotManager = nil then exit;
|
||||
if SnapshotManager = nil then exit;
|
||||
if tbHist.Down
|
||||
then FSnapshotManager.HistorySelected := tbHistorySelected.Down
|
||||
else FSnapshotManager.SnapshotSelected := tbHistorySelected.Down
|
||||
then SnapshotManager.HistorySelected := tbHistorySelected.Down
|
||||
else SnapshotManager.SnapshotSelected := tbHistorySelected.Down
|
||||
end;
|
||||
|
||||
procedure THistoryDialog.tbMakeSnapClick(Sender: TObject);
|
||||
begin
|
||||
if (FSnapshotManager = nil) or (FSnapshotManager.Current = nil) then exit;
|
||||
FSnapshotManager.Current.AddToSnapshots;
|
||||
if (SnapshotManager = nil) or (SnapshotManager.Current = nil) then exit;
|
||||
SnapshotManager.Current.AddToSnapshots;
|
||||
end;
|
||||
|
||||
procedure THistoryDialog.tbPowerClick(Sender: TObject);
|
||||
@ -124,17 +120,17 @@ begin
|
||||
if tbPower.Down
|
||||
then tbPower.ImageIndex := FPowerImgIdx
|
||||
else tbPower.ImageIndex := FPowerImgIdxGrey;
|
||||
if FSnapshotManager <> nil
|
||||
then FSnapshotManager.Active := tbPower.Down;
|
||||
if SnapshotManager <> nil
|
||||
then SnapshotManager.Active := tbPower.Down;
|
||||
end;
|
||||
|
||||
procedure THistoryDialog.tbRemoveClick(Sender: TObject);
|
||||
begin
|
||||
if lvHistory.Selected = nil then exit;
|
||||
if tbHist.Down then begin
|
||||
FSnapshotManager.History[lvHistory.Selected.Index].RemoveFromHistory;
|
||||
SnapshotManager.History[lvHistory.Selected.Index].RemoveFromHistory;
|
||||
end else begin
|
||||
FSnapshotManager.Snapshots[lvHistory.Selected.Index].RemoveFromSnapshots;
|
||||
SnapshotManager.Snapshots[lvHistory.Selected.Index].RemoveFromSnapshots;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -144,7 +140,7 @@ var
|
||||
Item: TListItem;
|
||||
Lst: TSnapshotList;
|
||||
begin
|
||||
if (FSnapshotManager = nil) or FInSnapshotChanged then exit;
|
||||
if (SnapshotManager = nil) or FInSnapshotChanged then exit;
|
||||
|
||||
FInSnapshotChanged:= True;
|
||||
try
|
||||
@ -158,14 +154,14 @@ begin
|
||||
try
|
||||
if tbSnap.Down
|
||||
then begin
|
||||
Lst := FSnapshotManager.Snapshots;
|
||||
if FSnapshotManager.SnapshotSelected
|
||||
then cur := FSnapshotManager.SnapshotIndex
|
||||
Lst := SnapshotManager.Snapshots;
|
||||
if SnapshotManager.SnapshotSelected
|
||||
then cur := SnapshotManager.SnapshotIndex
|
||||
else cur := -1;
|
||||
end else begin
|
||||
Lst := FSnapshotManager.History;
|
||||
if FSnapshotManager.HistorySelected
|
||||
then cur := FSnapshotManager.HistoryIndex
|
||||
Lst := SnapshotManager.History;
|
||||
if SnapshotManager.HistorySelected
|
||||
then cur := SnapshotManager.HistoryIndex
|
||||
else cur := -1;
|
||||
end;
|
||||
|
||||
@ -205,7 +201,7 @@ var
|
||||
Lst: TSnapshotList;
|
||||
Sel: Boolean;
|
||||
begin
|
||||
if FSnapshotManager.Snapshots.Count > 0 then begin
|
||||
if SnapshotManager.Snapshots.Count > 0 then begin
|
||||
tbSnap.Enabled := True;
|
||||
end else begin
|
||||
tbSnap.Enabled := False;
|
||||
@ -214,11 +210,11 @@ begin
|
||||
|
||||
if tbSnap.Down
|
||||
then begin
|
||||
Lst := FSnapshotManager.Snapshots;
|
||||
Sel := FSnapshotManager.SnapshotSelected;
|
||||
Lst := SnapshotManager.Snapshots;
|
||||
Sel := SnapshotManager.SnapshotSelected;
|
||||
end else begin
|
||||
Lst := FSnapshotManager.History;
|
||||
Sel := FSnapshotManager.HistorySelected;
|
||||
Lst := SnapshotManager.History;
|
||||
Sel := SnapshotManager.HistorySelected;
|
||||
end;
|
||||
|
||||
tbHistorySelected.Enabled := Lst.Count > 0;
|
||||
@ -227,21 +223,12 @@ begin
|
||||
else tbHistorySelected.Down := Sel;
|
||||
tbHistorySelected.Click;
|
||||
|
||||
tbClear.Enabled := (FSnapshotManager.History.Count > 0) or (FSnapshotManager.Snapshots.Count > 0);
|
||||
tbClear.Enabled := (SnapshotManager.History.Count > 0) or (SnapshotManager.Snapshots.Count > 0);
|
||||
|
||||
tbMakeSnap.Enabled := (FSnapshotManager.Current <> nil) and (not FSnapshotManager.Current.IsSnapshot);
|
||||
tbMakeSnap.Enabled := (SnapshotManager.Current <> nil) and (not SnapshotManager.Current.IsSnapshot);
|
||||
tbRemove.Enabled := lvHistory.Selected <> nil;
|
||||
end;
|
||||
|
||||
procedure THistoryDialog.SetSnapshotManager(const AValue: TSnapshotManager);
|
||||
begin
|
||||
if FSnapshotManager = AValue then exit;
|
||||
if FSnapshotManager <> nil then FSnapshotManager.RemoveNotification(FSnapshotNotification);
|
||||
FSnapshotManager := AValue;
|
||||
if FSnapshotManager <> nil then FSnapshotManager.AddNotification(FSnapshotNotification);
|
||||
SnapshotChanged(nil);
|
||||
end;
|
||||
|
||||
constructor THistoryDialog.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
@ -251,10 +238,8 @@ begin
|
||||
lvHistory.Column[1].Caption := histdlgColumnTime;
|
||||
lvHistory.Column[2].Caption := histdlgColumnLoc;
|
||||
|
||||
FSnapshotNotification := TSnapshotNotification.Create;
|
||||
FSnapshotNotification.AddReference;
|
||||
FSnapshotNotification.OnChange := @SnapshotChanged;
|
||||
FSnapshotNotification.OnCurrent := @SnapshotChanged;
|
||||
SnapshotNotification.OnChange := @SnapshotChanged;
|
||||
SnapshotNotification.OnCurrent := @SnapshotChanged;
|
||||
|
||||
imgCurrentLine := IDEImages.LoadImage(16, 'debugger_current_line');
|
||||
lvHistory.SmallImages := IDEImages.Images_16;
|
||||
@ -288,14 +273,5 @@ begin
|
||||
tbHistorySelectedClick(nil);
|
||||
end;
|
||||
|
||||
destructor THistoryDialog.Destroy;
|
||||
begin
|
||||
SetSnapshotManager(nil);
|
||||
FSnapshotNotification.OnChange := nil;
|
||||
FSnapshotNotification.OnCurrent := nil;
|
||||
FSnapshotNotification.ReleaseReference;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -65,21 +65,8 @@ type
|
||||
procedure actInspectUpdate(Sender: TObject);
|
||||
procedure actWathExecute(Sender: TObject);
|
||||
private
|
||||
FCallStackMonitor: TCallStackMonitor;
|
||||
FLocalsMonitor: TLocalsMonitor;
|
||||
FLocalsNotification: TLocalsNotification;
|
||||
FSnapshotManager: TSnapshotManager;
|
||||
FThreadsMonitor: TThreadsMonitor;
|
||||
FThreadsNotification: TThreadsNotification;
|
||||
FCallstackNotification: TCallStackNotification;
|
||||
FSnapshotNotification: TSnapshotNotification;
|
||||
procedure SetSnapshotManager(const AValue: TSnapshotManager);
|
||||
procedure SnapshotChanged(Sender: TObject);
|
||||
procedure ContextChanged(Sender: TObject);
|
||||
procedure LocalsChanged(Sender: TObject);
|
||||
procedure SetCallStackMonitor(const AValue: TCallStackMonitor);
|
||||
procedure SetLocals(const AValue: TLocalsMonitor);
|
||||
procedure SetThreadsMonitor(const AValue: TThreadsMonitor);
|
||||
function GetThreadId: Integer;
|
||||
function GetSelectedThreads(Snap: TSnapshot): TThreads;
|
||||
function GetStackframe: Integer;
|
||||
@ -89,12 +76,10 @@ type
|
||||
procedure DoEndUpdate; override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
property LocalsMonitor: TLocalsMonitor read FLocalsMonitor write SetLocals;
|
||||
property ThreadsMonitor: TThreadsMonitor read FThreadsMonitor write SetThreadsMonitor;
|
||||
property CallStackMonitor: TCallStackMonitor read FCallStackMonitor write SetCallStackMonitor;
|
||||
property SnapshotManager: TSnapshotManager read FSnapshotManager write SetSnapshotManager;
|
||||
property LocalsMonitor;
|
||||
property ThreadsMonitor;
|
||||
property CallStackMonitor;
|
||||
property SnapshotManager;
|
||||
end;
|
||||
|
||||
|
||||
@ -110,21 +95,10 @@ uses
|
||||
constructor TLocalsDlg.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FLocalsNotification := TLocalsNotification.Create;
|
||||
FLocalsNotification.AddReference;
|
||||
FLocalsNotification.OnChange := @LocalsChanged;
|
||||
|
||||
FThreadsNotification := TThreadsNotification.Create;
|
||||
FThreadsNotification.AddReference;
|
||||
FThreadsNotification.OnCurrent := @ContextChanged;
|
||||
|
||||
FCallstackNotification := TCallStackNotification.Create;
|
||||
FCallstackNotification.AddReference;
|
||||
FCallstackNotification.OnCurrent := @ContextChanged;
|
||||
|
||||
FSnapshotNotification := TSnapshotNotification.Create;
|
||||
FSnapshotNotification.AddReference;
|
||||
FSnapshotNotification.OnCurrent := @SnapshotChanged;
|
||||
LocalsNotification.OnChange := @LocalsChanged;
|
||||
ThreadsNotification.OnCurrent := @LocalsChanged;
|
||||
CallstackNotification.OnCurrent := @ContextChanged;
|
||||
SnapshotNotification.OnCurrent := @LocalsChanged;
|
||||
|
||||
Caption:= lisLocals;
|
||||
lvLocals.Columns[0].Caption:= lisLocalsDlgName;
|
||||
@ -136,27 +110,6 @@ begin
|
||||
actCopyValue.Caption := lisLocalsDlgCopyValue;
|
||||
end;
|
||||
|
||||
destructor TLocalsDlg.Destroy;
|
||||
begin
|
||||
SetLocals(nil);
|
||||
FLocalsNotification.OnChange := nil;
|
||||
FLocalsNotification.ReleaseReference;
|
||||
FThreadsNotification.OnCurrent := nil;
|
||||
FThreadsNotification.ReleaseReference;
|
||||
FCallstackNotification.OnCurrent := nil;
|
||||
FCallstackNotification.ReleaseReference;
|
||||
SetSnapshotManager(nil);
|
||||
FSnapshotNotification.OnChange := nil;
|
||||
FSnapshotNotification.OnCurrent := nil;
|
||||
FSnapshotNotification.ReleaseReference;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TLocalsDlg.SnapshotChanged(Sender: TObject);
|
||||
begin
|
||||
LocalsChanged(nil);
|
||||
end;
|
||||
|
||||
procedure TLocalsDlg.actInspectUpdate(Sender: TObject);
|
||||
begin
|
||||
(Sender as TAction).Enabled := Assigned(lvLocals.Selected);
|
||||
@ -200,15 +153,6 @@ begin
|
||||
Clipboard.Close;
|
||||
end;
|
||||
|
||||
procedure TLocalsDlg.SetSnapshotManager(const AValue: TSnapshotManager);
|
||||
begin
|
||||
if FSnapshotManager = AValue then exit;
|
||||
if FSnapshotManager <> nil then FSnapshotManager.RemoveNotification(FSnapshotNotification);
|
||||
FSnapshotManager := AValue;
|
||||
if FSnapshotManager <> nil then FSnapshotManager.AddNotification(FSnapshotNotification);
|
||||
LocalsChanged(nil);
|
||||
end;
|
||||
|
||||
procedure TLocalsDlg.ContextChanged(Sender: TObject);
|
||||
begin
|
||||
LocalsChanged(nil);
|
||||
@ -223,7 +167,7 @@ var
|
||||
Locals: TLocals;
|
||||
Snap: TSnapshot;
|
||||
begin
|
||||
if (FThreadsMonitor = nil) or (FCallStackMonitor = nil) or (FLocalsMonitor=nil) then begin
|
||||
if (ThreadsMonitor = nil) or (CallStackMonitor = nil) or (LocalsMonitor=nil) then begin
|
||||
lvLocals.Items.Clear;
|
||||
exit;
|
||||
end;
|
||||
@ -235,7 +179,7 @@ begin
|
||||
Snap := GetSelectedSnapshot;
|
||||
if (Snap <> nil)
|
||||
then begin
|
||||
Locals := FLocalsMonitor.Snapshots[Snap][GetThreadId, GetStackframe];
|
||||
Locals := LocalsMonitor.Snapshots[Snap][GetThreadId, GetStackframe];
|
||||
Caption:= lisLocals + ' ('+ Snap.LocationAsText +')';
|
||||
end
|
||||
else begin
|
||||
@ -296,74 +240,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLocalsDlg.SetCallStackMonitor(const AValue: TCallStackMonitor);
|
||||
begin
|
||||
if FCallStackMonitor = AValue then exit;
|
||||
BeginUpdate;
|
||||
try
|
||||
if FCallStackMonitor <> nil
|
||||
then FCallStackMonitor.RemoveNotification(FCallstackNotification);
|
||||
|
||||
FCallStackMonitor := AValue;
|
||||
|
||||
if FCallStackMonitor <> nil
|
||||
then FCallStackMonitor.AddNotification(FCallstackNotification);
|
||||
|
||||
LocalsChanged(nil);
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLocalsDlg.SetLocals(const AValue: TLocalsMonitor);
|
||||
begin
|
||||
if FLocalsMonitor = AValue then Exit;
|
||||
|
||||
BeginUpdate;
|
||||
try
|
||||
if FLocalsMonitor <> nil
|
||||
then begin
|
||||
FLocalsMonitor.RemoveNotification(FLocalsNotification);
|
||||
end;
|
||||
|
||||
FLocalsMonitor := AValue;
|
||||
|
||||
if FLocalsMonitor <> nil
|
||||
then begin
|
||||
FLocalsMonitor.AddNotification(FLocalsNotification);
|
||||
end;
|
||||
|
||||
LocalsChanged(FLocalsMonitor);
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLocalsDlg.SetThreadsMonitor(const AValue: TThreadsMonitor);
|
||||
begin
|
||||
if FThreadsMonitor = AValue then exit;
|
||||
BeginUpdate;
|
||||
try
|
||||
if FThreadsMonitor <> nil
|
||||
then FThreadsMonitor.RemoveNotification(FThreadsNotification);
|
||||
|
||||
FThreadsMonitor := AValue;
|
||||
|
||||
if FThreadsMonitor <> nil
|
||||
then FThreadsMonitor.AddNotification(FThreadsNotification);
|
||||
|
||||
LocalsChanged(nil);
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TLocalsDlg.GetThreadId: Integer;
|
||||
var
|
||||
Threads: TThreads;
|
||||
begin
|
||||
Result := -1;
|
||||
if (FThreadsMonitor = nil) then exit;
|
||||
if (ThreadsMonitor = nil) then exit;
|
||||
Threads := GetSelectedThreads(GetSelectedSnapshot);
|
||||
if Threads <> nil
|
||||
then Result := Threads.CurrentThreadId
|
||||
@ -372,10 +254,10 @@ end;
|
||||
|
||||
function TLocalsDlg.GetSelectedThreads(Snap: TSnapshot): TThreads;
|
||||
begin
|
||||
if FThreadsMonitor = nil then exit(nil);
|
||||
if ThreadsMonitor = nil then exit(nil);
|
||||
if Snap = nil
|
||||
then Result := FThreadsMonitor.CurrentThreads
|
||||
else Result := FThreadsMonitor.Snapshots[Snap];
|
||||
then Result := ThreadsMonitor.CurrentThreads
|
||||
else Result := ThreadsMonitor.Snapshots[Snap];
|
||||
end;
|
||||
|
||||
function TLocalsDlg.GetStackframe: Integer;
|
||||
|
@ -21,24 +21,16 @@ type
|
||||
procedure tbCurrentClick(Sender: TObject);
|
||||
procedure ThreadsChanged(Sender: TObject);
|
||||
private
|
||||
FSnapshotManager: TSnapshotManager;
|
||||
FThreadNotification: TThreadsNotification;
|
||||
FSnapshotNotification: TSnapshotNotification;
|
||||
FThreadsMonitor: TThreadsMonitor;
|
||||
imgCurrentLine: Integer;
|
||||
procedure SetSnapshotManager(const AValue: TSnapshotManager);
|
||||
procedure SnapshotChanged(Sender: TObject);
|
||||
procedure SetThreadsMonitor(const AValue: TThreadsMonitor);
|
||||
procedure JumpToSource;
|
||||
function GetSelectedSnapshot: TSnapshot;
|
||||
function GetSelectedThreads(Snap: TSnapshot): TThreads;
|
||||
public
|
||||
{ public declarations }
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
property ThreadsMonitor: TThreadsMonitor read FThreadsMonitor write SetThreadsMonitor;
|
||||
property SnapshotManager: TSnapshotManager read FSnapshotManager write SetSnapshotManager;
|
||||
end;
|
||||
property ThreadsMonitor;
|
||||
property SnapshotManager;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
@ -54,7 +46,7 @@ var
|
||||
Threads: TThreads;
|
||||
Snap: TSnapshot;
|
||||
begin
|
||||
if FThreadsMonitor = nil then begin
|
||||
if ThreadsMonitor = nil then begin
|
||||
lvThreads.Clear;
|
||||
exit;
|
||||
end;
|
||||
@ -121,12 +113,12 @@ begin
|
||||
id := StrToIntDef(Item.SubItems[0], -1);
|
||||
if id < 0 then exit;
|
||||
if GetSelectedSnapshot = nil
|
||||
then FThreadsMonitor.ChangeCurrentThread(id)
|
||||
then ThreadsMonitor.ChangeCurrentThread(id)
|
||||
else begin
|
||||
Threads := GetSelectedThreads(GetSelectedSnapshot);
|
||||
if Threads <> nil
|
||||
then Threads.CurrentThreadId := id;
|
||||
FThreadsMonitor.CurrentChanged;
|
||||
ThreadsMonitor.CurrentChanged;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -135,29 +127,6 @@ begin
|
||||
JumpToSource;
|
||||
end;
|
||||
|
||||
procedure TThreadsDlg.SnapshotChanged(Sender: TObject);
|
||||
begin
|
||||
ThreadsChanged(nil);
|
||||
end;
|
||||
|
||||
procedure TThreadsDlg.SetSnapshotManager(const AValue: TSnapshotManager);
|
||||
begin
|
||||
if FSnapshotManager = AValue then exit;
|
||||
if FSnapshotManager <> nil then FSnapshotManager.RemoveNotification(FSnapshotNotification);
|
||||
FSnapshotManager := AValue;
|
||||
if FSnapshotManager <> nil then FSnapshotManager.AddNotification(FSnapshotNotification);
|
||||
ThreadsChanged(FSnapshotManager);
|
||||
end;
|
||||
|
||||
procedure TThreadsDlg.SetThreadsMonitor(const AValue: TThreadsMonitor);
|
||||
begin
|
||||
if FThreadsMonitor = AValue then exit;
|
||||
if FThreadsMonitor <> nil then FThreadsMonitor.RemoveNotification(FThreadNotification);
|
||||
FThreadsMonitor := AValue;
|
||||
if FThreadsMonitor <> nil then FThreadsMonitor.AddNotification(FThreadNotification);
|
||||
ThreadsChanged(FThreadsMonitor);
|
||||
end;
|
||||
|
||||
procedure TThreadsDlg.JumpToSource;
|
||||
var
|
||||
Entry: TThreadEntry;
|
||||
@ -196,8 +165,8 @@ end;
|
||||
function TThreadsDlg.GetSelectedThreads(Snap: TSnapshot): TThreads;
|
||||
begin
|
||||
if Snap = nil
|
||||
then Result := FThreadsMonitor.CurrentThreads
|
||||
else Result := FThreadsMonitor.Snapshots[Snap];
|
||||
then Result := ThreadsMonitor.CurrentThreads
|
||||
else Result := ThreadsMonitor.Snapshots[Snap];
|
||||
end;
|
||||
|
||||
constructor TThreadsDlg.Create(TheOwner: TComponent);
|
||||
@ -213,29 +182,12 @@ begin
|
||||
tbCurrent.Caption := lisThreadsCurrent;
|
||||
tbGoto.Caption := lisThreadsGoto;
|
||||
|
||||
FThreadNotification := TThreadsNotification.Create;
|
||||
FThreadNotification.AddReference;
|
||||
FThreadNotification.OnChange := @ThreadsChanged;
|
||||
|
||||
FSnapshotNotification := TSnapshotNotification.Create;
|
||||
FSnapshotNotification.AddReference;
|
||||
FSnapshotNotification.OnCurrent := @SnapshotChanged;
|
||||
SnapshotNotification.OnCurrent := @ThreadsChanged;
|
||||
ThreadsNotification.OnChange := @ThreadsChanged;;
|
||||
|
||||
imgCurrentLine := IDEImages.LoadImage(16, 'debugger_current_line');
|
||||
lvThreads.SmallImages := IDEImages.Images_16;
|
||||
end;
|
||||
|
||||
destructor TThreadsDlg.Destroy;
|
||||
begin
|
||||
SetThreadsMonitor(nil);
|
||||
FThreadNotification.OnChange := nil;
|
||||
FThreadNotification.ReleaseReference;
|
||||
SetSnapshotManager(nil);
|
||||
FSnapshotNotification.OnChange := nil;
|
||||
FSnapshotNotification.OnCurrent := nil;
|
||||
FSnapshotNotification.ReleaseReference;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -106,14 +106,6 @@ type
|
||||
procedure SnapshotChanged(Sender: TObject);
|
||||
private
|
||||
FWatchesInView: TWatches;
|
||||
FCallStackMonitor: TCallStackMonitor;
|
||||
FSnapshotManager: TSnapshotManager;
|
||||
FThreadsMonitor: TThreadsMonitor;
|
||||
FWatchesMonitor: TWatchesMonitor;
|
||||
FSnapshotNotification: TSnapshotNotification;
|
||||
FWatchesNotification: TWatchesNotification;
|
||||
FThreadsNotification: TThreadsNotification;
|
||||
FCallstackNotification: TCallStackNotification;
|
||||
FPowerImgIdx, FPowerImgIdxGrey: Integer;
|
||||
FUpdateAllNeeded, FUpdatingAll: Boolean;
|
||||
FStateFlags: TWatchesDlgStateFlags;
|
||||
@ -121,10 +113,6 @@ type
|
||||
function GetThreadId: Integer;
|
||||
function GetSelectedThreads(Snap: TSnapshot): TThreads;
|
||||
function GetStackframe: Integer;
|
||||
procedure SetSnapshotManager(const AValue: TSnapshotManager);
|
||||
procedure SetCallStackMonitor(const AValue: TCallStackMonitor);
|
||||
procedure SetThreadsMonitor(const AValue: TThreadsMonitor);
|
||||
procedure SetWatchesMonitor(const AValue: TWatchesMonitor);
|
||||
procedure WatchAdd(const ASender: TWatches; const AWatch: TWatch);
|
||||
procedure WatchUpdate(const ASender: TWatches; const AWatch: TWatch);
|
||||
procedure WatchRemove(const ASender: TWatches; const AWatch: TWatch);
|
||||
@ -136,14 +124,13 @@ type
|
||||
property Watches: TWatches read GetWatches;
|
||||
protected
|
||||
procedure DoEndUpdate; override;
|
||||
procedure DoWatchesChanged; override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
property WatchesMonitor: TWatchesMonitor read FWatchesMonitor write SetWatchesMonitor;
|
||||
property ThreadsMonitor: TThreadsMonitor read FThreadsMonitor write SetThreadsMonitor;
|
||||
property CallStackMonitor: TCallStackMonitor read FCallStackMonitor write SetCallStackMonitor;
|
||||
property SnapshotManager: TSnapshotManager read FSnapshotManager write SetSnapshotManager;
|
||||
property WatchesMonitor;
|
||||
property ThreadsMonitor;
|
||||
property CallStackMonitor;
|
||||
property SnapshotManager;
|
||||
end;
|
||||
|
||||
|
||||
@ -157,25 +144,14 @@ constructor TWatchesDlg.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FWatchesInView := nil;
|
||||
|
||||
FWatchesNotification := TWatchesNotification.Create;
|
||||
FWatchesNotification.AddReference;
|
||||
FWatchesNotification.OnAdd := @WatchAdd;
|
||||
FWatchesNotification.OnUpdate := @WatchUpdate;
|
||||
FWatchesNotification.OnRemove := @WatchRemove;
|
||||
FStateFlags := [];
|
||||
|
||||
FThreadsNotification := TThreadsNotification.Create;
|
||||
FThreadsNotification.AddReference;
|
||||
FThreadsNotification.OnCurrent := @ContextChanged;
|
||||
|
||||
FCallstackNotification := TCallStackNotification.Create;
|
||||
FCallstackNotification.AddReference;
|
||||
FCallstackNotification.OnCurrent := @ContextChanged;
|
||||
|
||||
FSnapshotNotification := TSnapshotNotification.Create;
|
||||
FSnapshotNotification.AddReference;
|
||||
FSnapshotNotification.OnCurrent := @SnapshotChanged;
|
||||
WatchesNotification.OnAdd := @WatchAdd;
|
||||
WatchesNotification.OnUpdate := @WatchUpdate;
|
||||
WatchesNotification.OnRemove := @WatchRemove;
|
||||
ThreadsNotification.OnCurrent := @ContextChanged;
|
||||
CallstackNotification.OnCurrent := @ContextChanged;
|
||||
SnapshotNotification.OnCurrent := @SnapshotChanged;
|
||||
|
||||
ActionList1.Images := IDEImages.Images_16;
|
||||
ToolBar1.Images := IDEImages.Images_16;
|
||||
@ -227,25 +203,6 @@ begin
|
||||
lvWatches.Column[1].Width := 200;
|
||||
end;
|
||||
|
||||
destructor TWatchesDlg.Destroy;
|
||||
begin
|
||||
//DebugLn('TWatchesDlg.Destroy ',DbgSName(Self));
|
||||
SetWatchesMonitor(nil);
|
||||
FWatchesNotification.OnAdd := nil;
|
||||
FWatchesNotification.OnUpdate := nil;
|
||||
FWatchesNotification.OnRemove := nil;
|
||||
FWatchesNotification.ReleaseReference;
|
||||
FThreadsNotification.OnCurrent := nil;
|
||||
FThreadsNotification.ReleaseReference;
|
||||
FCallstackNotification.OnCurrent := nil;
|
||||
FCallstackNotification.ReleaseReference;
|
||||
SetSnapshotManager(nil);
|
||||
FSnapshotNotification.OnChange := nil;
|
||||
FSnapshotNotification.OnCurrent := nil;
|
||||
FSnapshotNotification.ReleaseReference;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TWatchesDlg.GetSelected: TCurrentWatch;
|
||||
var
|
||||
Item: TListItem;
|
||||
@ -261,7 +218,7 @@ var
|
||||
Threads: TThreads;
|
||||
begin
|
||||
Result := -1;
|
||||
if (FThreadsMonitor = nil) then exit;
|
||||
if (ThreadsMonitor = nil) then exit;
|
||||
Threads := GetSelectedThreads(GetSelectedSnapshot);
|
||||
if Threads <> nil
|
||||
then Result := Threads.CurrentThreadId
|
||||
@ -270,10 +227,10 @@ end;
|
||||
|
||||
function TWatchesDlg.GetSelectedThreads(Snap: TSnapshot): TThreads;
|
||||
begin
|
||||
if FThreadsMonitor = nil then exit(nil);
|
||||
if ThreadsMonitor = nil then exit(nil);
|
||||
if Snap = nil
|
||||
then Result := FThreadsMonitor.CurrentThreads
|
||||
else Result := FThreadsMonitor.Snapshots[Snap];
|
||||
then Result := ThreadsMonitor.CurrentThreads
|
||||
else Result := ThreadsMonitor.Snapshots[Snap];
|
||||
end;
|
||||
|
||||
function TWatchesDlg.GetStackframe: Integer;
|
||||
@ -304,79 +261,6 @@ begin
|
||||
else Result := 0;
|
||||
end;
|
||||
|
||||
procedure TWatchesDlg.SetSnapshotManager(const AValue: TSnapshotManager);
|
||||
begin
|
||||
if FSnapshotManager = AValue then exit;
|
||||
if FSnapshotManager <> nil then FSnapshotManager.RemoveNotification(FSnapshotNotification);
|
||||
FSnapshotManager := AValue;
|
||||
if FSnapshotManager <> nil then FSnapshotManager.AddNotification(FSnapshotNotification);
|
||||
SnapshotChanged(nil);
|
||||
end;
|
||||
|
||||
procedure TWatchesDlg.SetCallStackMonitor(const AValue: TCallStackMonitor);
|
||||
begin
|
||||
if FCallStackMonitor = AValue then exit;
|
||||
BeginUpdate;
|
||||
try
|
||||
if FCallStackMonitor <> nil
|
||||
then FCallStackMonitor.RemoveNotification(FCallstackNotification);
|
||||
|
||||
FCallStackMonitor := AValue;
|
||||
|
||||
if FCallStackMonitor <> nil
|
||||
then FCallStackMonitor.AddNotification(FCallstackNotification);
|
||||
|
||||
UpdateAll;
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWatchesDlg.SetThreadsMonitor(const AValue: TThreadsMonitor);
|
||||
begin
|
||||
if FThreadsMonitor = AValue then exit;
|
||||
BeginUpdate;
|
||||
try
|
||||
if FThreadsMonitor <> nil
|
||||
then FThreadsMonitor.RemoveNotification(FThreadsNotification);
|
||||
|
||||
FThreadsMonitor := AValue;
|
||||
|
||||
if FThreadsMonitor <> nil
|
||||
then FThreadsMonitor.AddNotification(FThreadsNotification);
|
||||
|
||||
UpdateAll;
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWatchesDlg.SetWatchesMonitor(const AValue: TWatchesMonitor);
|
||||
begin
|
||||
if FWatchesMonitor = AValue then Exit;
|
||||
|
||||
BeginUpdate;
|
||||
try
|
||||
lvWatches.Items.Clear;
|
||||
|
||||
if FWatchesMonitor <> nil
|
||||
then begin
|
||||
FWatchesMonitor.RemoveNotification(FWatchesNotification);
|
||||
end;
|
||||
|
||||
FWatchesMonitor:=AValue;
|
||||
|
||||
if FWatchesMonitor <> nil
|
||||
then begin
|
||||
FWatchesMonitor.AddNotification(FWatchesNotification);
|
||||
UpdateAll;
|
||||
end;
|
||||
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWatchesDlg.lvWatchesSelectItem(Sender: TObject; AItem: TListItem; Selected: Boolean);
|
||||
var
|
||||
ItemSelected: Boolean;
|
||||
@ -568,13 +452,13 @@ var
|
||||
Snap: TSnapshot;
|
||||
begin
|
||||
Result := nil;
|
||||
if FWatchesMonitor = nil then exit;
|
||||
if WatchesMonitor = nil then exit;
|
||||
|
||||
Snap := GetSelectedSnapshot;
|
||||
|
||||
if Snap <> nil
|
||||
then Result := FWatchesMonitor.Snapshots[Snap]
|
||||
else Result := FWatchesMonitor.CurrentWatches;
|
||||
then Result := WatchesMonitor.Snapshots[Snap]
|
||||
else Result := WatchesMonitor.CurrentWatches;
|
||||
end;
|
||||
|
||||
procedure TWatchesDlg.DoEndUpdate;
|
||||
@ -586,6 +470,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWatchesDlg.DoWatchesChanged;
|
||||
begin
|
||||
UpdateAll;
|
||||
end;
|
||||
|
||||
procedure TWatchesDlg.popDeleteClick(Sender: TObject);
|
||||
var
|
||||
Item: TCurrentWatch;
|
||||
@ -703,7 +592,7 @@ begin
|
||||
// Expression
|
||||
// Result
|
||||
if (not ToolButtonPower.Down) or (not Visible) then exit;
|
||||
if (FThreadsMonitor = nil) or (FCallStackMonitor = nil) then exit;
|
||||
if (ThreadsMonitor = nil) or (CallStackMonitor = nil) then exit;
|
||||
if GetStackframe < 0 then exit; // TODO need dedicated validity property
|
||||
|
||||
include(FStateFlags, wdsfUpdating);
|
||||
|
@ -830,6 +830,10 @@ procedure TDebugManager.DebuggerBeforeChangeState(ADebugger: TDebugger; AOldStat
|
||||
var
|
||||
DialogType: TDebugDialogType;
|
||||
begin
|
||||
if Destroying or (MainIDE=nil) or (MainIDE.ToolStatus=itExiting)
|
||||
then exit;
|
||||
assert((ADebugger=FDebugger) and (ADebugger<>nil), 'TDebugManager.OnDebuggerChangeState');
|
||||
|
||||
FInStateChange := True;
|
||||
for DialogType := Low(TDebugDialogType) to High(TDebugDialogType) do
|
||||
if FDialogs[DialogType] <> nil then
|
||||
@ -840,6 +844,18 @@ end;
|
||||
|
||||
procedure TDebugManager.DebuggerChangeState(ADebugger: TDebugger;
|
||||
OldState: TDBGState);
|
||||
|
||||
procedure UnlockDialogs;
|
||||
var
|
||||
DialogType: TDebugDialogType;
|
||||
begin
|
||||
if not FInStateChange then exit;
|
||||
FInStateChange := False;
|
||||
for DialogType := Low(TDebugDialogType) to High(TDebugDialogType) do
|
||||
if FDialogs[DialogType] <> nil then
|
||||
FDialogs[DialogType].EndUpdate;
|
||||
end;
|
||||
|
||||
const
|
||||
// dsNone, dsIdle, dsStop, dsPause, dsInit, dsRun, dsError
|
||||
TOOLSTATEMAP: array[TDBGState] of TIDEToolStatus = (
|
||||
@ -852,29 +868,29 @@ const
|
||||
var
|
||||
MsgResult: TModalResult;
|
||||
i: Integer;
|
||||
DialogType: TDebugDialogType;
|
||||
begin
|
||||
FInStateChange := False;
|
||||
for DialogType := Low(TDebugDialogType) to High(TDebugDialogType) do
|
||||
if FDialogs[DialogType] <> nil then
|
||||
FDialogs[DialogType].EndUpdate;
|
||||
|
||||
if Destroying or (MainIDE=nil) or (MainIDE.ToolStatus=itExiting)
|
||||
then exit;
|
||||
|
||||
then begin
|
||||
UnlockDialogs;
|
||||
exit;
|
||||
end;
|
||||
assert((ADebugger=FDebugger) and (ADebugger<>nil), 'TDebugManager.OnDebuggerChangeState');
|
||||
|
||||
if (FDebugger.State in [dsRun])
|
||||
then FCurrentBreakpoint := nil;
|
||||
|
||||
// Notify FSnapshots of new state (while dialogs still in updating)
|
||||
if (FCurrentBreakpoint <> nil) and (bpaTakeSnapshot in FCurrentBreakpoint.Actions) then begin
|
||||
FSnapshots.DoStateChange(OldState);
|
||||
FSnapshots.Current.AddToSnapshots;
|
||||
FSnapshots.DoDebuggerIdle(True);
|
||||
end
|
||||
else if FDebugger.State <> dsInternalPause
|
||||
else
|
||||
if FDebugger.State <> dsInternalPause
|
||||
then FSnapshots.DoStateChange(OldState);
|
||||
|
||||
UnlockDialogs;
|
||||
|
||||
if FDebugger.State = dsInternalPause
|
||||
then exit;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user