mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-05 19:26:04 +02:00
DBG: Markl project as modified, if watches are added/changed/removed. issue #0020092
git-svn-id: trunk@33338 -
This commit is contained in:
parent
605ffc8b2c
commit
2c40a97d6a
@ -406,13 +406,20 @@ type
|
|||||||
|
|
||||||
TDebuggerDataMonitor = class
|
TDebuggerDataMonitor = class
|
||||||
private
|
private
|
||||||
|
FOnModified: TNotifyEvent;
|
||||||
|
FIgnoreModified: Integer;
|
||||||
FSupplier: TDebuggerDataSupplier;
|
FSupplier: TDebuggerDataSupplier;
|
||||||
procedure SetSupplier(const AValue: TDebuggerDataSupplier);
|
procedure SetSupplier(const AValue: TDebuggerDataSupplier);
|
||||||
protected
|
protected
|
||||||
|
procedure DoModified; // user-modified / xml-storable data modified
|
||||||
|
procedure BeginIgnoreModified;
|
||||||
|
procedure EndIgnoreModified;
|
||||||
procedure DoNewSupplier; virtual;
|
procedure DoNewSupplier; virtual;
|
||||||
property Supplier: TDebuggerDataSupplier read FSupplier write SetSupplier;
|
property Supplier: TDebuggerDataSupplier read FSupplier write SetSupplier;
|
||||||
public
|
public
|
||||||
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
property OnModified: TNotifyEvent read FOnModified write FOnModified; // user-modified / xml-storable data modified
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TDebuggerDataSupplier }
|
{ TDebuggerDataSupplier }
|
||||||
@ -1155,6 +1162,7 @@ type
|
|||||||
protected
|
protected
|
||||||
procedure AssignTo(Dest: TPersistent); override;
|
procedure AssignTo(Dest: TPersistent); override;
|
||||||
function CreateValueList: TWatchValueList; virtual;
|
function CreateValueList: TWatchValueList; virtual;
|
||||||
|
procedure DoModified; virtual; // user-storable data: expression, enabled, display-format
|
||||||
procedure DoEnableChange; virtual;
|
procedure DoEnableChange; virtual;
|
||||||
procedure DoExpressionChange; virtual;
|
procedure DoExpressionChange; virtual;
|
||||||
procedure DoDisplayFormatChanged; virtual;
|
procedure DoDisplayFormatChanged; virtual;
|
||||||
@ -1244,6 +1252,7 @@ type
|
|||||||
protected
|
protected
|
||||||
function CreateValueList: TWatchValueList; override;
|
function CreateValueList: TWatchValueList; override;
|
||||||
procedure DoChanged; override;
|
procedure DoChanged; override;
|
||||||
|
procedure DoModified; override;
|
||||||
procedure RequestData(AWatchValue: TCurrentWatchValue);
|
procedure RequestData(AWatchValue: TCurrentWatchValue);
|
||||||
property SnapShot: TWatch read FSnapShot write SetSnapShot;
|
property SnapShot: TWatch read FSnapShot write SetSnapShot;
|
||||||
public
|
public
|
||||||
@ -1262,6 +1271,7 @@ type
|
|||||||
private
|
private
|
||||||
FMonitor: TWatchesMonitor;
|
FMonitor: TWatchesMonitor;
|
||||||
FSnapShot: TWatches;
|
FSnapShot: TWatches;
|
||||||
|
FDestroying: Boolean;
|
||||||
procedure SetSnapShot(const AValue: TWatches);
|
procedure SetSnapShot(const AValue: TWatches);
|
||||||
procedure WatchesChanged(Sender: TObject);
|
procedure WatchesChanged(Sender: TObject);
|
||||||
protected
|
protected
|
||||||
@ -1270,11 +1280,13 @@ type
|
|||||||
protected
|
protected
|
||||||
procedure NotifyAdd(const AWatch: TCurrentWatch); virtual; // called when a watch is added
|
procedure NotifyAdd(const AWatch: TCurrentWatch); virtual; // called when a watch is added
|
||||||
procedure NotifyRemove(const AWatch: TCurrentWatch); virtual; // called by watch when destructed
|
procedure NotifyRemove(const AWatch: TCurrentWatch); virtual; // called by watch when destructed
|
||||||
|
procedure DoModified;
|
||||||
procedure Update(Item: TCollectionItem); override;
|
procedure Update(Item: TCollectionItem); override;
|
||||||
procedure RequestData(AWatchValue: TCurrentWatchValue);
|
procedure RequestData(AWatchValue: TCurrentWatchValue);
|
||||||
property SnapShot: TWatches read FSnapShot write SetSnapShot;
|
property SnapShot: TWatches read FSnapShot write SetSnapShot;
|
||||||
public
|
public
|
||||||
constructor Create(AMonitor: TWatchesMonitor);
|
constructor Create(AMonitor: TWatchesMonitor);
|
||||||
|
destructor Destroy; override;
|
||||||
// Watch
|
// Watch
|
||||||
function Add(const AExpression: String): TCurrentWatch;
|
function Add(const AExpression: String): TCurrentWatch;
|
||||||
function Find(const AExpression: String): TCurrentWatch;
|
function Find(const AExpression: String): TCurrentWatch;
|
||||||
@ -5318,11 +5330,33 @@ begin
|
|||||||
DoNewSupplier;
|
DoNewSupplier;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDebuggerDataMonitor.DoModified;
|
||||||
|
begin
|
||||||
|
if (FIgnoreModified = 0) and Assigned(FOnModified) then
|
||||||
|
FOnModified(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDebuggerDataMonitor.BeginIgnoreModified;
|
||||||
|
begin
|
||||||
|
inc(FIgnoreModified);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDebuggerDataMonitor.EndIgnoreModified;
|
||||||
|
begin
|
||||||
|
dec(FIgnoreModified);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TDebuggerDataMonitor.DoNewSupplier;
|
procedure TDebuggerDataMonitor.DoNewSupplier;
|
||||||
begin
|
begin
|
||||||
//
|
//
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
constructor TDebuggerDataMonitor.Create;
|
||||||
|
begin
|
||||||
|
FIgnoreModified := 0;
|
||||||
|
FOnModified := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
destructor TDebuggerDataMonitor.Destroy;
|
destructor TDebuggerDataMonitor.Destroy;
|
||||||
begin
|
begin
|
||||||
Supplier := nil;
|
Supplier := nil;
|
||||||
@ -7975,6 +8009,11 @@ begin
|
|||||||
Result := TWatchValueList.Create(Self);
|
Result := TWatchValueList.Create(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TWatch.DoModified;
|
||||||
|
begin
|
||||||
|
//
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TWatch.Create(ACollection: TCollection);
|
constructor TWatch.Create(ACollection: TCollection);
|
||||||
begin
|
begin
|
||||||
assert(((Self is TCurrentWatch) and (ACollection is TCurrentWatches)) or ((not(Self is TCurrentWatch)) and not(ACollection is TCurrentWatches)),
|
assert(((Self is TCurrentWatch) and (ACollection is TCurrentWatches)) or ((not(Self is TCurrentWatch)) and not(ACollection is TCurrentWatches)),
|
||||||
@ -8001,16 +8040,19 @@ end;
|
|||||||
procedure TWatch.DoEnableChange;
|
procedure TWatch.DoEnableChange;
|
||||||
begin
|
begin
|
||||||
Changed;
|
Changed;
|
||||||
|
DoModified;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWatch.DoExpressionChange;
|
procedure TWatch.DoExpressionChange;
|
||||||
begin
|
begin
|
||||||
Changed;
|
Changed;
|
||||||
|
DoModified;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWatch.DoDisplayFormatChanged;
|
procedure TWatch.DoDisplayFormatChanged;
|
||||||
begin
|
begin
|
||||||
Changed;
|
Changed;
|
||||||
|
DoModified;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWatch.GetEnabled: Boolean;
|
function TWatch.GetEnabled: Boolean;
|
||||||
@ -8117,6 +8159,12 @@ begin
|
|||||||
then TCurrentWatches(Collection).Update(Self);
|
then TCurrentWatches(Collection).Update(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCurrentWatch.DoModified;
|
||||||
|
begin
|
||||||
|
inherited DoModified;
|
||||||
|
TCurrentWatches(Collection).DoModified;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCurrentWatch.RequestData(AWatchValue: TCurrentWatchValue);
|
procedure TCurrentWatch.RequestData(AWatchValue: TCurrentWatchValue);
|
||||||
begin
|
begin
|
||||||
if Collection <> nil
|
if Collection <> nil
|
||||||
@ -8132,7 +8180,10 @@ end;
|
|||||||
destructor TCurrentWatch.Destroy;
|
destructor TCurrentWatch.Destroy;
|
||||||
begin
|
begin
|
||||||
if (TCurrentWatches(Collection) <> nil)
|
if (TCurrentWatches(Collection) <> nil)
|
||||||
then TCurrentWatches(Collection).NotifyRemove(Self);
|
then begin
|
||||||
|
TCurrentWatches(Collection).NotifyRemove(Self);
|
||||||
|
TCurrentWatches(Collection).DoModified;
|
||||||
|
end;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -8249,14 +8300,22 @@ begin
|
|||||||
Result.SnapShot := R;
|
Result.SnapShot := R;
|
||||||
end;
|
end;
|
||||||
NotifyAdd(Result);
|
NotifyAdd(Result);
|
||||||
|
DoModified;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TCurrentWatches.Create(AMonitor: TWatchesMonitor);
|
constructor TCurrentWatches.Create(AMonitor: TWatchesMonitor);
|
||||||
begin
|
begin
|
||||||
|
FDestroying := False;
|
||||||
FMonitor := AMonitor;
|
FMonitor := AMonitor;
|
||||||
inherited Create(TCurrentWatch);
|
inherited Create(TCurrentWatch);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
destructor TCurrentWatches.Destroy;
|
||||||
|
begin
|
||||||
|
FDestroying := True;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCurrentWatches.Find(const AExpression: String): TCurrentWatch;
|
function TCurrentWatches.Find(const AExpression: String): TCurrentWatch;
|
||||||
begin
|
begin
|
||||||
Result := TCurrentWatch(inherited Find(AExpression));
|
Result := TCurrentWatch(inherited Find(AExpression));
|
||||||
@ -8302,14 +8361,21 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
Watch: TCurrentWatch;
|
Watch: TCurrentWatch;
|
||||||
begin
|
begin
|
||||||
Clear;
|
if FMonitor <> nil then
|
||||||
NewCount := AConfig.GetValue(APath + 'Count', 0);
|
FMonitor.BeginIgnoreModified;
|
||||||
for i := 0 to NewCount-1 do
|
try
|
||||||
begin
|
Clear;
|
||||||
// Call inherited Add, so NotifyAdd can be send, after the Watch was loaded
|
NewCount := AConfig.GetValue(APath + 'Count', 0);
|
||||||
Watch := TCurrentWatch(inherited Add(''));
|
for i := 0 to NewCount-1 do
|
||||||
Watch.LoadFromXMLConfig(AConfig, Format('%sItem%d/', [APath, i + 1]));
|
begin
|
||||||
NotifyAdd(Watch);
|
// Call inherited Add, so NotifyAdd can be send, after the Watch was loaded
|
||||||
|
Watch := TCurrentWatch(inherited Add(''));
|
||||||
|
Watch.LoadFromXMLConfig(AConfig, Format('%sItem%d/', [APath, i + 1]));
|
||||||
|
NotifyAdd(Watch);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
if FMonitor <> nil then
|
||||||
|
FMonitor.EndIgnoreModified;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -8323,6 +8389,12 @@ begin
|
|||||||
FMonitor.NotifyRemove(Self, AWatch);
|
FMonitor.NotifyRemove(Self, AWatch);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCurrentWatches.DoModified;
|
||||||
|
begin
|
||||||
|
if (FMonitor <> nil) and (not FDestroying) then
|
||||||
|
FMonitor.DoModified;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCurrentWatches.SaveToXMLConfig(const AConfig: TXMLConfig; const APath: string);
|
procedure TCurrentWatches.SaveToXMLConfig(const AConfig: TXMLConfig; const APath: string);
|
||||||
var
|
var
|
||||||
Cnt: Integer;
|
Cnt: Integer;
|
||||||
|
@ -66,6 +66,7 @@ type
|
|||||||
|
|
||||||
TDebugManager = class(TBaseDebugManager)
|
TDebugManager = class(TBaseDebugManager)
|
||||||
procedure DebuggerIdle(Sender: TObject);
|
procedure DebuggerIdle(Sender: TObject);
|
||||||
|
procedure DoProjectModified(Sender: TObject);
|
||||||
private
|
private
|
||||||
procedure BreakAutoContinueTimer(Sender: TObject);
|
procedure BreakAutoContinueTimer(Sender: TObject);
|
||||||
procedure OnRunTimer(Sender: TObject);
|
procedure OnRunTimer(Sender: TObject);
|
||||||
@ -705,6 +706,12 @@ begin
|
|||||||
FSnapshots.DoDebuggerIdle;
|
FSnapshots.DoDebuggerIdle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDebugManager.DoProjectModified(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if Project1 <> nil then
|
||||||
|
Project1.Modified := True;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TDebugManager.mnuAddBpAddress(Sender: TObject);
|
procedure TDebugManager.mnuAddBpAddress(Sender: TObject);
|
||||||
var
|
var
|
||||||
NewBreakpoint: TIDEBreakPoint;
|
NewBreakpoint: TIDEBreakPoint;
|
||||||
@ -1575,6 +1582,8 @@ begin
|
|||||||
FRunTimer.Interval := 1;
|
FRunTimer.Interval := 1;
|
||||||
FRunTimer.OnTimer := @OnRunTimer;
|
FRunTimer.OnTimer := @OnRunTimer;
|
||||||
|
|
||||||
|
FWatches.OnModified := @DoProjectModified;
|
||||||
|
|
||||||
FIsInitializingDebugger:= False;
|
FIsInitializingDebugger:= False;
|
||||||
|
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
|
Loading…
Reference in New Issue
Block a user