mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 14:39:09 +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: Int64): String;
|
||||||
function ExpressionForChildEntry(AnIndex: String): String;
|
function ExpressionForChildEntry(AnIndex: String): String;
|
||||||
|
|
||||||
|
function MaybeCopyResult(ASourceWatch: TIdeWatch): boolean;
|
||||||
|
|
||||||
property ChildrenByNameAsField[AName, AClassName: String]: TIdeWatch read GetChildrenByNameAsField;
|
property ChildrenByNameAsField[AName, AClassName: String]: TIdeWatch read GetChildrenByNameAsField;
|
||||||
property ChildrenByNameAsArrayEntry[AName: Int64]: TIdeWatch read GetChildrenByNameAsArrayEntry;
|
property ChildrenByNameAsArrayEntry[AName: Int64]: TIdeWatch read GetChildrenByNameAsArrayEntry;
|
||||||
end;
|
end;
|
||||||
@ -4021,6 +4023,11 @@ begin
|
|||||||
FreeAndNil(FFpDbgConverter);
|
FreeAndNil(FFpDbgConverter);
|
||||||
if Watch.FpDbgConverter <> nil then
|
if Watch.FpDbgConverter <> nil then
|
||||||
FFpDbgConverter := TIdeFpDbgConverterConfig(Watch.FpDbgConverter.CreateCopy);
|
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);
|
TCurrentWatch(Watch).RequestData(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -4349,6 +4356,27 @@ begin
|
|||||||
Result := Expression + '[' + AnIndex + ']';
|
Result := Expression + '[' + AnIndex + ']';
|
||||||
end;
|
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 }
|
{ TIdeWatchesMonitor }
|
||||||
|
|
||||||
function TIdeWatchesMonitor.GetSnapshot(AnID: Pointer): TIdeWatches;
|
function TIdeWatchesMonitor.GetSnapshot(AnID: Pointer): TIdeWatches;
|
||||||
|
@ -84,6 +84,8 @@ type
|
|||||||
FWatch: TWatch;
|
FWatch: TWatch;
|
||||||
function GetEntry(const AThreadId: Integer; const AStackFrame: Integer): TWatchValue;
|
function GetEntry(const AThreadId: Integer; const AStackFrame: Integer): TWatchValue;
|
||||||
function GetEntryByIdx(AnIndex: integer): TWatchValue;
|
function GetEntryByIdx(AnIndex: integer): TWatchValue;
|
||||||
|
function GetExistingEntry(const AThreadId: Integer;
|
||||||
|
const AStackFrame: Integer): TWatchValue;
|
||||||
protected
|
protected
|
||||||
function CreateEntry(const {%H-}AThreadId: Integer; const {%H-}AStackFrame: Integer): TWatchValue; virtual;
|
function CreateEntry(const {%H-}AThreadId: Integer; const {%H-}AStackFrame: Integer): TWatchValue; virtual;
|
||||||
function CopyEntry(AnEntry: TWatchValue): TWatchValue;
|
function CopyEntry(AnEntry: TWatchValue): TWatchValue;
|
||||||
@ -101,6 +103,8 @@ type
|
|||||||
property EntriesByIdx[AnIndex: integer]: TWatchValue read GetEntryByIdx;
|
property EntriesByIdx[AnIndex: integer]: TWatchValue read GetEntryByIdx;
|
||||||
property Entries[const AThreadId: Integer; const AStackFrame: Integer]: TWatchValue
|
property Entries[const AThreadId: Integer; const AStackFrame: Integer]: TWatchValue
|
||||||
read GetEntry; default;
|
read GetEntry; default;
|
||||||
|
property ExistingEntries[const AThreadId: Integer; const AStackFrame: Integer]: TWatchValue
|
||||||
|
read GetExistingEntry;
|
||||||
property Watch: TWatch read FWatch;
|
property Watch: TWatch read FWatch;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -650,22 +654,10 @@ end;
|
|||||||
|
|
||||||
function TWatchValueList.GetEntry(const AThreadId: Integer;
|
function TWatchValueList.GetEntry(const AThreadId: Integer;
|
||||||
const AStackFrame: Integer): TWatchValue;
|
const AStackFrame: Integer): TWatchValue;
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
begin
|
begin
|
||||||
i := FList.Count - 1;
|
Result := GetExistingEntry(AThreadId, AStackFrame);
|
||||||
while i >= 0 do begin
|
if Result = nil then
|
||||||
Result := TWatchValue(FList[i]);
|
Result := CreateEntry(AThreadId, AStackFrame);
|
||||||
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);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TWatchValueList.GetEntriesForRange(const AThreadId: Integer;
|
function TWatchValueList.GetEntriesForRange(const AThreadId: Integer;
|
||||||
@ -717,6 +709,26 @@ begin
|
|||||||
Result := TWatchValue(FList[AnIndex]);
|
Result := TWatchValue(FList[AnIndex]);
|
||||||
end;
|
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;
|
function TWatchValueList.CreateEntry(const AThreadId: Integer;
|
||||||
const AStackFrame: Integer): TWatchValue;
|
const AStackFrame: Integer): TWatchValue;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user