mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 13:39:14 +02:00
IDE, Debugger-Intf: Clean-up, Move Watches list from DbgIntf to IDE
This commit is contained in:
parent
8e10ed53af
commit
717ec4887d
@ -256,11 +256,11 @@ type
|
|||||||
FDebugger: TDebuggerIntf;
|
FDebugger: TDebuggerIntf;
|
||||||
FMonitor: TDebuggerDataMonitor;
|
FMonitor: TDebuggerDataMonitor;
|
||||||
procedure SetMonitor(const AValue: TDebuggerDataMonitor);
|
procedure SetMonitor(const AValue: TDebuggerDataMonitor);
|
||||||
|
property Monitor: TDebuggerDataMonitor read FMonitor write SetMonitor;
|
||||||
protected
|
protected
|
||||||
procedure DoNewMonitor; virtual;
|
procedure DoNewMonitor; virtual;
|
||||||
property Debugger: TDebuggerIntf read FDebugger write FDebugger;
|
property Debugger: TDebuggerIntf read FDebugger write FDebugger;
|
||||||
protected
|
protected
|
||||||
property Monitor: TDebuggerDataMonitor read FMonitor write SetMonitor;
|
|
||||||
|
|
||||||
procedure DoStateLeavePauseClean; override;
|
procedure DoStateLeavePauseClean; override;
|
||||||
procedure DoStateChange(const AOldState: TDBGState); virtual;
|
procedure DoStateChange(const AOldState: TDBGState); virtual;
|
||||||
@ -768,32 +768,27 @@ type
|
|||||||
|
|
||||||
TWatchesSupplier = class(TDebuggerDataSupplier)
|
TWatchesSupplier = class(TDebuggerDataSupplier)
|
||||||
private
|
private
|
||||||
function GetCurrentWatches: TWatches;
|
|
||||||
function GetMonitor: TWatchesMonitor;
|
function GetMonitor: TWatchesMonitor;
|
||||||
procedure SetMonitor(AValue: TWatchesMonitor);
|
procedure SetMonitor(AValue: TWatchesMonitor);
|
||||||
|
property Monitor: TWatchesMonitor read GetMonitor write SetMonitor;
|
||||||
protected
|
protected
|
||||||
procedure DoStateChange(const AOldState: TDBGState); override; // workaround for state changes during TWatchValue.GetValue
|
procedure DoStateChange(const AOldState: TDBGState); override; // workaround for state changes during TWatchValue.GetValue
|
||||||
procedure InternalRequestData(AWatchValue: TWatchValue); virtual;
|
procedure InternalRequestData(AWatchValue: TWatchValue); virtual;
|
||||||
public
|
public
|
||||||
constructor Create(const ADebugger: TDebuggerIntf);
|
constructor Create(const ADebugger: TDebuggerIntf);
|
||||||
|
procedure TriggerInvalidateWatchValues;
|
||||||
procedure RequestData(AWatchValue: TWatchValue);
|
procedure RequestData(AWatchValue: TWatchValue);
|
||||||
property CurrentWatches: TWatches read GetCurrentWatches;
|
|
||||||
property Monitor: TWatchesMonitor read GetMonitor write SetMonitor;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TWatchesMonitor }
|
{ TWatchesMonitor }
|
||||||
|
|
||||||
TWatchesMonitor = class(TDebuggerDataMonitor)
|
TWatchesMonitor = class(TDebuggerDataMonitor)
|
||||||
private
|
private
|
||||||
FWatches: TWatches;
|
|
||||||
function GetSupplier: TWatchesSupplier;
|
function GetSupplier: TWatchesSupplier;
|
||||||
procedure SetSupplier(AValue: TWatchesSupplier);
|
procedure SetSupplier(AValue: TWatchesSupplier);
|
||||||
protected
|
protected
|
||||||
function CreateWatches: TWatches; virtual;
|
procedure InvalidateWatchValues; virtual;
|
||||||
public
|
public
|
||||||
constructor Create;
|
|
||||||
destructor Destroy; override;
|
|
||||||
property Watches: TWatches read FWatches;
|
|
||||||
property Supplier: TWatchesSupplier read GetSupplier write SetSupplier;
|
property Supplier: TWatchesSupplier read GetSupplier write SetSupplier;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -4415,13 +4410,6 @@ begin
|
|||||||
else AWatchValue.SetValidity(ddsInvalid);
|
else AWatchValue.SetValidity(ddsInvalid);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWatchesSupplier.GetCurrentWatches: TWatches;
|
|
||||||
begin
|
|
||||||
Result := Nil;
|
|
||||||
if Monitor <> nil then
|
|
||||||
Result := Monitor.Watches;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TWatchesSupplier.GetMonitor: TWatchesMonitor;
|
function TWatchesSupplier.GetMonitor: TWatchesMonitor;
|
||||||
begin
|
begin
|
||||||
Result := TWatchesMonitor(inherited Monitor);
|
Result := TWatchesMonitor(inherited Monitor);
|
||||||
@ -4445,6 +4433,12 @@ begin
|
|||||||
AWatchValue.SetValidity(ddsInvalid);
|
AWatchValue.SetValidity(ddsInvalid);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TWatchesSupplier.TriggerInvalidateWatchValues;
|
||||||
|
begin
|
||||||
|
if Monitor <> nil then
|
||||||
|
Monitor.InvalidateWatchValues;
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TWatchesSupplier.Create(const ADebugger: TDebuggerIntf);
|
constructor TWatchesSupplier.Create(const ADebugger: TDebuggerIntf);
|
||||||
begin
|
begin
|
||||||
inherited Create(ADebugger);
|
inherited Create(ADebugger);
|
||||||
@ -4463,21 +4457,9 @@ begin
|
|||||||
inherited Supplier := AValue;
|
inherited Supplier := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWatchesMonitor.CreateWatches: TWatches;
|
procedure TWatchesMonitor.InvalidateWatchValues;
|
||||||
begin
|
begin
|
||||||
Result := TWatches.Create;
|
//
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TWatchesMonitor.Create;
|
|
||||||
begin
|
|
||||||
FWatches := CreateWatches;
|
|
||||||
inherited Create;
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TWatchesMonitor.Destroy;
|
|
||||||
begin
|
|
||||||
inherited Destroy;
|
|
||||||
FreeAndNil(FWatches);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TLocalsSupplier }
|
{ TLocalsSupplier }
|
||||||
|
@ -11271,8 +11271,7 @@ end;
|
|||||||
procedure TGDBMIWatches.Changed;
|
procedure TGDBMIWatches.Changed;
|
||||||
begin
|
begin
|
||||||
SetLength(FParentFPList, 0);
|
SetLength(FParentFPList, 0);
|
||||||
if CurrentWatches <> nil
|
TriggerInvalidateWatchValues;
|
||||||
then CurrentWatches.ClearValues;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGDBMIWatches.Clear;
|
procedure TGDBMIWatches.Clear;
|
||||||
|
@ -651,7 +651,7 @@ procedure TFpThreadWorkerModifyUpdate.DoCallback_DecRef(Data: PtrInt);
|
|||||||
begin
|
begin
|
||||||
//
|
//
|
||||||
FDebugger.Locals.CurrentLocalsList.Clear;
|
FDebugger.Locals.CurrentLocalsList.Clear;
|
||||||
FDebugger.Watches.CurrentWatches.ClearValues;
|
FDebugger.Watches.TriggerInvalidateWatchValues;
|
||||||
FDebugger.CallStack.CurrentCallStackList.Clear;
|
FDebugger.CallStack.CurrentCallStackList.Clear;
|
||||||
|
|
||||||
UnQueue_DecRef;
|
UnQueue_DecRef;
|
||||||
|
@ -222,7 +222,7 @@ procedure IDEMenuClicked(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
UseGDB := MenuCmd.Checked;
|
UseGDB := MenuCmd.Checked;
|
||||||
if (CurrentDebugger <> nil) and (CurrentDebugger.Watches <> nil) then
|
if (CurrentDebugger <> nil) and (CurrentDebugger.Watches <> nil) then
|
||||||
CurrentDebugger.Watches.CurrentWatches.ClearValues;
|
CurrentDebugger.Watches.TriggerInvalidateWatchValues;
|
||||||
if (CurrentDebugger <> nil) and (CurrentDebugger.Locals <> nil) then
|
if (CurrentDebugger <> nil) and (CurrentDebugger.Locals <> nil) then
|
||||||
CurrentDebugger.Locals.CurrentLocalsList.Clear;
|
CurrentDebugger.Locals.CurrentLocalsList.Clear;
|
||||||
end;
|
end;
|
||||||
|
@ -118,10 +118,16 @@ type
|
|||||||
{ TTestWatchesMonitor }
|
{ TTestWatchesMonitor }
|
||||||
|
|
||||||
TTestWatchesMonitor = class(TWatchesMonitor)
|
TTestWatchesMonitor = class(TWatchesMonitor)
|
||||||
|
private
|
||||||
|
FWatches: TWatches;
|
||||||
protected
|
protected
|
||||||
procedure DoStateChangeEx(const AOldState, ANewState: TDBGState); override;
|
procedure DoStateChangeEx(const AOldState, ANewState: TDBGState); override;
|
||||||
procedure RequestData(AWatchValue: TWatchValue);
|
procedure RequestData(AWatchValue: TWatchValue);
|
||||||
function CreateWatches: TWatches; override;
|
function CreateWatches: TWatches;
|
||||||
|
public
|
||||||
|
constructor Create;
|
||||||
|
destructor Destroy; override;
|
||||||
|
property Watches: TWatches read FWatches;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TTestRegistersMonitor = class;
|
TTestRegistersMonitor = class;
|
||||||
@ -337,6 +343,18 @@ begin
|
|||||||
TTestWatches(Result).FMonitor := Self;
|
TTestWatches(Result).FMonitor := Self;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
constructor TTestWatchesMonitor.Create;
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
FWatches := CreateWatches;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TTestWatchesMonitor.Destroy;
|
||||||
|
begin
|
||||||
|
inherited Destroy;
|
||||||
|
FreeAndNil(FWatches);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TTestWatchValue }
|
{ TTestWatchValue }
|
||||||
|
|
||||||
procedure TTestWatchValue.RequestData;
|
procedure TTestWatchValue.RequestData;
|
||||||
|
@ -757,6 +757,7 @@ type
|
|||||||
|
|
||||||
TIdeWatchesMonitor = class(TWatchesMonitor)
|
TIdeWatchesMonitor = class(TWatchesMonitor)
|
||||||
private
|
private
|
||||||
|
FWatches: TWatches;
|
||||||
FSnapshots: TDebuggerDataSnapShotList;
|
FSnapshots: TDebuggerDataSnapShotList;
|
||||||
FOnModified: TNotifyEvent;
|
FOnModified: TNotifyEvent;
|
||||||
FIgnoreModified: Integer;
|
FIgnoreModified: Integer;
|
||||||
@ -768,12 +769,13 @@ type
|
|||||||
procedure DoStateLeavePause; override;
|
procedure DoStateLeavePause; override;
|
||||||
procedure DoStateLeavePauseClean; override;
|
procedure DoStateLeavePauseClean; override;
|
||||||
procedure DoModified; override;
|
procedure DoModified; override;
|
||||||
|
procedure InvalidateWatchValues; override;
|
||||||
//procedure NotifyChange
|
//procedure NotifyChange
|
||||||
procedure NotifyAdd(const AWatches: TCurrentWatches; const AWatch: TCurrentWatch);
|
procedure NotifyAdd(const AWatches: TCurrentWatches; const AWatch: TCurrentWatch);
|
||||||
procedure NotifyRemove(const AWatches: TCurrentWatches; const AWatch: TCurrentWatch);
|
procedure NotifyRemove(const AWatches: TCurrentWatches; const AWatch: TCurrentWatch);
|
||||||
procedure NotifyUpdate(const AWatches: TCurrentWatches; const AWatch: TCurrentWatch);
|
procedure NotifyUpdate(const AWatches: TCurrentWatches; const AWatch: TCurrentWatch);
|
||||||
procedure RequestData(AWatchValue: TCurrentWatchValue);
|
procedure RequestData(AWatchValue: TCurrentWatchValue);
|
||||||
function CreateWatches: TWatches; override;
|
function CreateWatches: TWatches; virtual;
|
||||||
function CreateSnapshot(CreateEmpty: Boolean = False): TObject;
|
function CreateSnapshot(CreateEmpty: Boolean = False): TObject;
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
@ -782,6 +784,7 @@ type
|
|||||||
procedure RemoveNotification(const ANotification: TWatchesNotification);
|
procedure RemoveNotification(const ANotification: TWatchesNotification);
|
||||||
procedure NewSnapshot(AnID: Pointer; CreateEmpty: Boolean = False);
|
procedure NewSnapshot(AnID: Pointer; CreateEmpty: Boolean = False);
|
||||||
procedure RemoveSnapshot(AnID: Pointer);
|
procedure RemoveSnapshot(AnID: Pointer);
|
||||||
|
property Watches: TWatches read FWatches;
|
||||||
property CurrentWatches: TCurrentWatches read GetCurrentWatches;// FCurrentWatches;
|
property CurrentWatches: TCurrentWatches read GetCurrentWatches;// FCurrentWatches;
|
||||||
property Snapshots[AnID: Pointer]: TIdeWatches read GetSnapshot;
|
property Snapshots[AnID: Pointer]: TIdeWatches read GetSnapshot;
|
||||||
public
|
public
|
||||||
@ -3496,6 +3499,13 @@ begin
|
|||||||
FOnModified(Self);
|
FOnModified(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TIdeWatchesMonitor.InvalidateWatchValues;
|
||||||
|
begin
|
||||||
|
inherited InvalidateWatchValues;
|
||||||
|
if Watches <> nil then
|
||||||
|
Watches.ClearValues;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TIdeWatchesMonitor.NotifyAdd(const AWatches: TCurrentWatches; const AWatch: TCurrentWatch);
|
procedure TIdeWatchesMonitor.NotifyAdd(const AWatches: TCurrentWatches; const AWatch: TCurrentWatch);
|
||||||
begin
|
begin
|
||||||
FNotificationList.NotifyAdd(AWatches, AWatch);
|
FNotificationList.NotifyAdd(AWatches, AWatch);
|
||||||
@ -3532,6 +3542,7 @@ end;
|
|||||||
|
|
||||||
constructor TIdeWatchesMonitor.Create;
|
constructor TIdeWatchesMonitor.Create;
|
||||||
begin
|
begin
|
||||||
|
FWatches := CreateWatches;
|
||||||
FSnapshots := TDebuggerDataSnapShotList.Create;
|
FSnapshots := TDebuggerDataSnapShotList.Create;
|
||||||
FIgnoreModified := 0;
|
FIgnoreModified := 0;
|
||||||
FNotificationList := TWatchesNotificationList.Create;
|
FNotificationList := TWatchesNotificationList.Create;
|
||||||
@ -3543,6 +3554,7 @@ begin
|
|||||||
FSnapshots.Clear;
|
FSnapshots.Clear;
|
||||||
FNotificationList.Clear;
|
FNotificationList.Clear;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
|
FreeAndNil(FWatches);
|
||||||
FreeAndNil(FNotificationList);
|
FreeAndNil(FNotificationList);
|
||||||
FreeAndNil(FSnapshots);
|
FreeAndNil(FSnapshots);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user