mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 18:40:41 +02:00
Debugger: watches window, use result from parent-watch, if sub-watch only has ide-suffix (json expand)
This commit is contained in:
parent
f79e6e2ba9
commit
c6ab397e07
@ -558,6 +558,8 @@ type
|
||||
function ExpressionForChildEntry(AnIndex: Int64): String;
|
||||
function ExpressionForChildEntry(AnIndex: String): String;
|
||||
|
||||
function MaybeCopyResult(ASourceWatch: TIdeWatch): boolean;
|
||||
|
||||
property ChildrenByNameAsField[AName, AClassName: String]: TIdeWatch read GetChildrenByNameAsField;
|
||||
property ChildrenByNameAsArrayEntry[AName: Int64]: TIdeWatch read GetChildrenByNameAsArrayEntry;
|
||||
end;
|
||||
@ -4021,6 +4023,11 @@ begin
|
||||
FreeAndNil(FFpDbgConverter);
|
||||
if Watch.FpDbgConverter <> nil then
|
||||
FFpDbgConverter := TIdeFpDbgConverterConfig(Watch.FpDbgConverter.CreateCopy);
|
||||
|
||||
if (Watch.ParentWatch <> nil) and (Watch.ParentWatch.FpDbgConverter = Watch.FpDbgConverter) then
|
||||
if MaybeCopyResult(Watch.ParentWatch) then
|
||||
exit;
|
||||
|
||||
TCurrentWatch(Watch).RequestData(self);
|
||||
end;
|
||||
|
||||
@ -4349,6 +4356,27 @@ begin
|
||||
Result := Expression + '[' + AnIndex + ']';
|
||||
end;
|
||||
|
||||
function TIdeWatchValue.MaybeCopyResult(ASourceWatch: TIdeWatch): boolean;
|
||||
var
|
||||
ASrcValue: TIdeWatchValue;
|
||||
begin
|
||||
Result := (ASourceWatch.GetBackendExpression = GetBackendExpression) and
|
||||
(ASourceWatch.DisplayFormat = FWatch.DisplayFormat) and
|
||||
(ASourceWatch.RepeatCount = FWatch.RepeatCount) and
|
||||
(ASourceWatch.FirstIndexOffs = FWatch.FirstIndexOffs) and
|
||||
(ASourceWatch.EvaluateFlags = FWatch.EvaluateFlags);
|
||||
if not Result then
|
||||
exit;
|
||||
|
||||
ASrcValue := TIdeWatchValue(ASourceWatch.FValueList.ExistingEntries[ThreadId, StackFrame]);
|
||||
Result := (ASrcValue <> nil) and (ASrcValue.Validity = ddsValid) and (ASrcValue.FResultData <> nil);
|
||||
if not Result then
|
||||
exit;
|
||||
|
||||
FResultData := ASrcValue.FResultData.CreateCopy;
|
||||
SetValidity(ddsValid);
|
||||
end;
|
||||
|
||||
{ TIdeWatchesMonitor }
|
||||
|
||||
function TIdeWatchesMonitor.GetSnapshot(AnID: Pointer): TIdeWatches;
|
||||
|
@ -84,6 +84,8 @@ type
|
||||
FWatch: TWatch;
|
||||
function GetEntry(const AThreadId: Integer; const AStackFrame: Integer): TWatchValue;
|
||||
function GetEntryByIdx(AnIndex: integer): TWatchValue;
|
||||
function GetExistingEntry(const AThreadId: Integer;
|
||||
const AStackFrame: Integer): TWatchValue;
|
||||
protected
|
||||
function CreateEntry(const {%H-}AThreadId: Integer; const {%H-}AStackFrame: Integer): TWatchValue; virtual;
|
||||
function CopyEntry(AnEntry: TWatchValue): TWatchValue;
|
||||
@ -101,6 +103,8 @@ type
|
||||
property EntriesByIdx[AnIndex: integer]: TWatchValue read GetEntryByIdx;
|
||||
property Entries[const AThreadId: Integer; const AStackFrame: Integer]: TWatchValue
|
||||
read GetEntry; default;
|
||||
property ExistingEntries[const AThreadId: Integer; const AStackFrame: Integer]: TWatchValue
|
||||
read GetExistingEntry;
|
||||
property Watch: TWatch read FWatch;
|
||||
end;
|
||||
|
||||
@ -650,22 +654,10 @@ end;
|
||||
|
||||
function TWatchValueList.GetEntry(const AThreadId: Integer;
|
||||
const AStackFrame: Integer): TWatchValue;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
i := FList.Count - 1;
|
||||
while i >= 0 do begin
|
||||
Result := TWatchValue(FList[i]);
|
||||
if (Result.ThreadId = AThreadId) and (Result.StackFrame = AStackFrame) and
|
||||
(Result.DisplayFormat = FWatch.DisplayFormat) and
|
||||
(Result.RepeatCount = FWatch.RepeatCount) and
|
||||
(Result.FirstIndexOffs = FWatch.FirstIndexOffs) and
|
||||
(Result.EvaluateFlags = FWatch.EvaluateFlags)
|
||||
then
|
||||
exit;
|
||||
dec(i);
|
||||
end;
|
||||
Result := CreateEntry(AThreadId, AStackFrame);
|
||||
Result := GetExistingEntry(AThreadId, AStackFrame);
|
||||
if Result = nil then
|
||||
Result := CreateEntry(AThreadId, AStackFrame);
|
||||
end;
|
||||
|
||||
function TWatchValueList.GetEntriesForRange(const AThreadId: Integer;
|
||||
@ -717,6 +709,26 @@ begin
|
||||
Result := TWatchValue(FList[AnIndex]);
|
||||
end;
|
||||
|
||||
function TWatchValueList.GetExistingEntry(const AThreadId: Integer;
|
||||
const AStackFrame: Integer): TWatchValue;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
i := FList.Count - 1;
|
||||
while i >= 0 do begin
|
||||
Result := TWatchValue(FList[i]);
|
||||
if (Result.ThreadId = AThreadId) and (Result.StackFrame = AStackFrame) and
|
||||
(Result.DisplayFormat = FWatch.DisplayFormat) and
|
||||
(Result.RepeatCount = FWatch.RepeatCount) and
|
||||
(Result.FirstIndexOffs = FWatch.FirstIndexOffs) and
|
||||
(Result.EvaluateFlags = FWatch.EvaluateFlags)
|
||||
then
|
||||
exit;
|
||||
dec(i);
|
||||
end;
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
function TWatchValueList.CreateEntry(const AThreadId: Integer;
|
||||
const AStackFrame: Integer): TWatchValue;
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user