From f89535328709564969a14b50eee90baf78d77033 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 1 Feb 2022 17:15:48 +0100 Subject: [PATCH] Debugger: Fix Snapshots. --- debugger/watchesdlg.pp | 11 +++++++++-- ide/packages/idedebugger/debugger.pp | 17 ++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/debugger/watchesdlg.pp b/debugger/watchesdlg.pp index 412c5485c8..c39fef1afd 100644 --- a/debugger/watchesdlg.pp +++ b/debugger/watchesdlg.pp @@ -1035,7 +1035,9 @@ begin else tvWatches.NodeText[VNode, COL_WATCH_VALUE-1]:= ''; - if (DebugBoss <> nil) and (DebugBoss.State <> dsRun) and + if ( ((DebugBoss <> nil) and (DebugBoss.State <> dsRun)) or + ((GetSelectedSnapshot <> nil) and not(AWatch is TCurrentWatch) ) + ) and (WatchValue <> nil) and (WatchValue.Validity <> ddsRequested) then begin TypInfo := WatchValue.TypeInfo; @@ -1055,6 +1057,11 @@ begin end; end; end + else + if (GetSelectedSnapshot = nil) and + (DebugBoss <> nil) and (DebugBoss.State in [dsPause, dsInternalPause]) + then + tvWatches.NodeText[VNode, COL_WATCH_VALUE-1]:= '' else tvWatches.NodeText[VNode, COL_WATCH_VALUE-1]:= ''; @@ -1117,7 +1124,7 @@ end; procedure TWatchesDlg.tvWatchesInitChildren(Sender: TBaseVirtualTree; Node: PVirtualNode; var ChildCount: Cardinal); var - VNdWatch, NewWatch: TIdeWatch; + VNdWatch: TIdeWatch; WatchValue: TIdeWatchValue; begin ChildCount := 0; diff --git a/ide/packages/idedebugger/debugger.pp b/ide/packages/idedebugger/debugger.pp index 7a637c0d78..92a6a5ff50 100644 --- a/ide/packages/idedebugger/debugger.pp +++ b/ide/packages/idedebugger/debugger.pp @@ -632,7 +632,10 @@ type procedure SaveDataToXMLConfig(const AConfig: TXMLConfig; APath: string); public - function Add(const AExpression: String): TIdeWatch; +{$IfOpt C+} + function Add: TCollectionItem; reintroduce; +{$EndIF} + function Add(const AExpression: String): TIdeWatch; virtual; function Find(const AExpression: String): TIdeWatch; reintroduce; property Items[const AnIndex: Integer]: TIdeWatch read GetItem write SetItem; default; end; @@ -724,7 +727,7 @@ type constructor Create(AMonitor: TIdeWatchesMonitor); destructor Destroy; override; // Watch - function Add(const AExpression: String): TCurrentWatch; + function Add(const AExpression: String): TCurrentWatch; override; function Find(const AExpression: String): TCurrentWatch; reintroduce; // IDE procedure LoadFromXMLConfig(const AConfig: TXMLConfig; const APath: string); @@ -3230,7 +3233,6 @@ begin FSnapShot.Clear; for i := 0 to Count - 1 do begin R := TIdeWatchValue.Create(FSnapShot.Watch); - R.Assign(EntriesByIdx[i]); FSnapShot.Add(R); TCurrentWatchValue(EntriesByIdx[i]).SnapShot := R; end; @@ -5530,7 +5532,6 @@ begin Result.SetParentWatch(Self); Result.Enabled := Enabled; Result.DisplayFormat := DisplayFormat; - //snapshot EndChildUpdate; end; @@ -5742,6 +5743,13 @@ begin Items[i].SaveDataToXMLConfig(AConfig, APath + IntToStr(i) + '/'); end; +{$IfOpt C+} +function TIdeWatches.Add: TCollectionItem; +begin + assert(False, 'TIdeWatches.Add: False'); +end; +{$EndIf} + function TIdeWatches.Find(const AExpression: String): TIdeWatch; begin Result := TIdeWatch(inherited Find(AExpression)); @@ -5808,7 +5816,6 @@ begin FSnapShot.Clear; for i := 0 to Count - 1 do begin R := FSnapShot.Add(''); - R.Assign(Items[i]); Items[i].SnapShot := R; end; end;