mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 06:08:17 +02:00
Debugger: Watches - Partly revert d1ca85c248
"change how sub-watches(nested) are retrieved." - In some case sub-watches were executed with outdated parent type info.
This commit is contained in:
parent
5b625349ee
commit
8f6b3940fa
@ -882,7 +882,7 @@ begin
|
||||
exit;
|
||||
|
||||
AWatch := TIdeWatch(Sender.OwnerData);
|
||||
if AWatch.Enabled then begin
|
||||
if AWatch.Enabled and AWatch.HasAllValidParents(GetThreadId, GetStackframe) then begin
|
||||
VNode := tvWatches.FindNodeForItem(AWatch);
|
||||
if VNode = nil then
|
||||
exit;
|
||||
@ -1098,7 +1098,7 @@ begin
|
||||
exit;
|
||||
InspectLabel.Caption := Watch.Expression;
|
||||
|
||||
if not(Watch.Enabled) then begin
|
||||
if not(Watch.Enabled and Watch.HasAllValidParents(GetThreadId, GetStackframe)) then begin
|
||||
InspectMemo.WordWrap := True;
|
||||
InspectMemo.Text := '<evaluating>';
|
||||
exit;
|
||||
@ -1233,7 +1233,7 @@ begin
|
||||
try
|
||||
tvWatches.NodeText[VNode, COL_WATCH_EXPR-1]:= AWatch.DisplayName;
|
||||
tvWatches.NodeText[VNode, 2] := '';
|
||||
if AWatch.Enabled then begin
|
||||
if AWatch.Enabled and AWatch.HasAllValidParents(GetThreadId, GetStackframe) then begin
|
||||
WatchValue := AWatch.Values[GetThreadId, GetStackframe];
|
||||
if (WatchValue <> nil) and
|
||||
( (GetSelectedSnapshot = nil) or not(WatchValue.Validity in [ddsUnknown, ddsEvaluating, ddsRequested]) )
|
||||
|
@ -587,6 +587,7 @@ type
|
||||
function GetChildrenByNameAsField(AName, AClassName: String): TIdeWatch;
|
||||
function GetTopParentWatch: TIdeWatch;
|
||||
function GetValue(const AThreadId: Integer; const AStackFrame: Integer): TIdeWatchValue;
|
||||
function GetAnyValidParentWatchValue(AThreadId: Integer; AStackFrame: Integer): TIdeWatchValue;
|
||||
function GetWatchDisplayName: String;
|
||||
protected
|
||||
procedure InitChildWatches;
|
||||
@ -613,6 +614,7 @@ type
|
||||
procedure LimitChildWatchCount(AMaxCnt: Integer; AKeepIndexEntriesBelow: Int64 = low(Int64));
|
||||
property ChildrenByNameAsField[AName, AClassName: String]: TIdeWatch read GetChildrenByNameAsField;
|
||||
property ChildrenByNameAsArrayEntry[AName: Int64]: TIdeWatch read GetChildrenByNameAsArrayEntry;
|
||||
function HasAllValidParents(AThreadId: Integer; AStackFrame: Integer): boolean;
|
||||
property ParentWatch: TIdeWatch read FParentWatch;
|
||||
property TopParentWatch: TIdeWatch read GetTopParentWatch;
|
||||
property DisplayName: String read GetWatchDisplayName write FDisplayName;
|
||||
@ -6244,6 +6246,17 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TIdeWatch.HasAllValidParents(AThreadId: Integer; AStackFrame: Integer
|
||||
): boolean;
|
||||
begin
|
||||
Result := FParentWatch = nil;
|
||||
if Result then
|
||||
exit;
|
||||
|
||||
Result := (GetAnyValidParentWatchValue(AThreadId, AStackFrame) <> nil) and
|
||||
FParentWatch.HasAllValidParents(AThreadId, AStackFrame);
|
||||
end;
|
||||
|
||||
procedure TIdeWatch.DoEnableChange;
|
||||
begin
|
||||
Changed;
|
||||
@ -6267,6 +6280,26 @@ begin
|
||||
Result := TIdeWatchValue(inherited Values[AThreadId, AStackFrame]);
|
||||
end;
|
||||
|
||||
function TIdeWatch.GetAnyValidParentWatchValue(AThreadId: Integer;
|
||||
AStackFrame: Integer): TIdeWatchValue;
|
||||
var
|
||||
i: Integer;
|
||||
vl: TWatchValueList;
|
||||
begin
|
||||
Result := nil;
|
||||
if FParentWatch = nil then
|
||||
exit;
|
||||
vl := FParentWatch.FValueList;
|
||||
i := vl.Count - 1;
|
||||
while (i >= 0) and (
|
||||
(vl.EntriesByIdx[i].Validity <> ddsValid) or
|
||||
(vl.EntriesByIdx[i].ThreadId <> AThreadId) or
|
||||
(vl.EntriesByIdx[i].StackFrame <> AStackFrame)
|
||||
) do
|
||||
dec(i);
|
||||
if i >= 0 then
|
||||
Result := TIdeWatchValue(vl.EntriesByIdx[i]);
|
||||
end;
|
||||
function TIdeWatch.GetWatchDisplayName: String;
|
||||
begin
|
||||
if FDisplayName <> '' then
|
||||
|
Loading…
Reference in New Issue
Block a user