From 7e1fb75015397eb9afb3166bc53157150639d5e1 Mon Sep 17 00:00:00 2001 From: martin Date: Sun, 26 Jan 2020 20:14:59 +0000 Subject: [PATCH] Make register view entry format settings persist through debug session / Patch by ccrause git-svn-id: trunk@62591 - --- .../debuggerintf/dbgintfdebuggerbase.pp | 14 ++++++++ debugger/debugger.pp | 35 ++++++++++--------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/components/debuggerintf/dbgintfdebuggerbase.pp b/components/debuggerintf/dbgintfdebuggerbase.pp index b027a45d00..82b48b7dc7 100644 --- a/components/debuggerintf/dbgintfdebuggerbase.pp +++ b/components/debuggerintf/dbgintfdebuggerbase.pp @@ -1021,6 +1021,7 @@ type function GetEntryByIdx(AnIndex: Integer): TRegisters; protected public + procedure InvalidateItems; property EntriesByIdx[AnIndex: Integer]: TRegisters read GetEntryByIdx; property Entries[AThreadId, AStackFrame: Integer]: TRegisters read GetEntry; default; end; @@ -3365,6 +3366,19 @@ begin Result := TRegisters(inherited EntriesByIdx[AnIndex]); end; +procedure TRegistersList.InvalidateItems; +var + i, j: Integer; +begin + Assert(not Immutable, 'TRegisterList.InvalidateItems Immutable'); + if Count = 0 then + exit; + for i := 0 to Count-1 do begin + EntriesByIdx[i].DataValidity := ddsUnknown; + end; + DoCleared; +end; + { TWatchesBase } function TWatches.GetItemBase(const AnIndex: Integer): TWatch; diff --git a/debugger/debugger.pp b/debugger/debugger.pp index 0c49056799..4872b0ac2e 100644 --- a/debugger/debugger.pp +++ b/debugger/debugger.pp @@ -1045,6 +1045,7 @@ type constructor Create; destructor Destroy; override; procedure Clear; + procedure InvalidateItems; procedure AddNotification(const ANotification: TRegistersNotification); procedure RemoveNotification(const ANotification: TRegistersNotification); property CurrentRegistersList: TCurrentIDERegistersList read GetCurrentRegistersList; @@ -5941,22 +5942,17 @@ end; function TCurrentIDERegisters.Count: Integer; begin - case DataValidity of - ddsUnknown: begin - AddReference; - try - Result := 0; - DataValidity := ddsRequested; - FMonitor.RequestData(Self); // Locals can be cleared, if debugger is "run" again - if DataValidity = ddsValid then Result := inherited Count(); - finally - ReleaseReference; - end; - end; - ddsRequested, ddsEvaluating: Result := 0; - ddsValid: Result := inherited Count; - ddsInvalid, ddsError: Result := 0; + if DataValidity = ddsUnknown then begin + AddReference; + try + Result := 0; + DataValidity := ddsRequested; + FMonitor.RequestData(Self); // Locals can be cleared, if debugger is "run" again + finally + ReleaseReference; + end; end; + result := TDbgEntityValuesList(self).Count; end; { TCurrentIDERegistersList } @@ -5989,14 +5985,14 @@ procedure TIdeRegistersMonitor.DoStateEnterPause; begin inherited DoStateEnterPause; if CurrentRegistersList = nil then exit; - Clear; + InvalidateItems; end; procedure TIdeRegistersMonitor.DoStateLeavePauseClean; begin inherited DoStateLeavePauseClean; if CurrentRegistersList = nil then exit; - Clear; + InvalidateItems; end; procedure TIdeRegistersMonitor.DoEndUpdate; @@ -6052,6 +6048,11 @@ begin CurrentRegistersList.Clear; end; +procedure TIdeRegistersMonitor.InvalidateItems; +begin + CurrentRegistersList.InvalidateItems; +end; + procedure TIdeRegistersMonitor.AddNotification(const ANotification: TRegistersNotification); begin FNotificationList.Add(ANotification);