mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 15:59:13 +02:00
Debugger, Watches: Update for new LazDebuggerIntf
This commit is contained in:
parent
b0de3bcc01
commit
2a954dfb14
@ -1058,7 +1058,8 @@ begin
|
|||||||
if DoDelayedDelete then
|
if DoDelayedDelete then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
HasChildren := (TypInfo <> nil) and (TypInfo.Fields <> nil) and (TypInfo.Fields.Count > 0);
|
HasChildren := ((TypInfo <> nil) and (TypInfo.Fields <> nil) and (TypInfo.Fields.Count > 0)) or
|
||||||
|
((WatchValue.ResultData <> nil) and (WatchValue.ResultData.FieldCount > 0));
|
||||||
tvWatches.HasChildren[VNode] := HasChildren;
|
tvWatches.HasChildren[VNode] := HasChildren;
|
||||||
if HasChildren and (WatchValue.Validity = ddsValid) and tvWatches.Expanded[VNode] then begin
|
if HasChildren and (WatchValue.Validity = ddsValid) and tvWatches.Expanded[VNode] then begin
|
||||||
(* The current "AWatch" should be done. Allow UpdateItem for nested entries *)
|
(* The current "AWatch" should be done. Allow UpdateItem for nested entries *)
|
||||||
@ -1100,22 +1101,27 @@ var
|
|||||||
NewWatch, AWatch: TIdeWatch;
|
NewWatch, AWatch: TIdeWatch;
|
||||||
TypInfo: TDBGType;
|
TypInfo: TDBGType;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
ResData: TWatchResultData;
|
||||||
ExistingNode, nd: PVirtualNode;
|
ExistingNode, nd: PVirtualNode;
|
||||||
|
ChildInfo: TWatchResultDataFieldInfo;
|
||||||
begin
|
begin
|
||||||
ChildCount := 0;
|
ChildCount := 0;
|
||||||
TypInfo := AWatchValue.TypeInfo;
|
|
||||||
AWatch := AWatchValue.Watch;
|
|
||||||
|
|
||||||
if (TypInfo <> nil) and (TypInfo.Fields <> nil) then begin
|
if (AWatchValue.ResultData <> nil) and (AWatchValue.ResultData.FieldCount > 0) then begin
|
||||||
ChildCount := TypInfo.Fields.Count;
|
ResData := AWatchValue.ResultData;
|
||||||
|
ChildCount := ResData.FieldCount;
|
||||||
|
AWatch := AWatchValue.Watch;
|
||||||
ExistingNode := tvWatches.GetFirstChildNoInit(VNode);
|
ExistingNode := tvWatches.GetFirstChildNoInit(VNode);
|
||||||
|
|
||||||
for i := 0 to TypInfo.Fields.Count-1 do begin
|
for i := 0 to ResData.FieldCount-1 do begin
|
||||||
NewWatch := AWatch.ChildrenByName[TypInfo.Fields[i].Name];
|
ChildInfo := ResData.Fields[i];
|
||||||
|
|
||||||
|
NewWatch := AWatch.ChildrenByName[ChildInfo.FieldName];
|
||||||
if NewWatch = nil then begin
|
if NewWatch = nil then begin
|
||||||
dec(ChildCount);
|
dec(ChildCount);
|
||||||
continue;
|
continue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if AWatch is TCurrentWatch then begin
|
if AWatch is TCurrentWatch then begin
|
||||||
NewWatch.DisplayFormat := wdfDefault;
|
NewWatch.DisplayFormat := wdfDefault;
|
||||||
NewWatch.Enabled := AWatch.Enabled;
|
NewWatch.Enabled := AWatch.Enabled;
|
||||||
@ -1133,6 +1139,41 @@ begin
|
|||||||
end;
|
end;
|
||||||
UpdateItem(nd, NewWatch);
|
UpdateItem(nd, NewWatch);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
// Old Interface
|
||||||
|
TypInfo := AWatchValue.TypeInfo;
|
||||||
|
AWatch := AWatchValue.Watch;
|
||||||
|
|
||||||
|
if (TypInfo <> nil) and (TypInfo.Fields <> nil) then begin
|
||||||
|
ChildCount := TypInfo.Fields.Count;
|
||||||
|
ExistingNode := tvWatches.GetFirstChildNoInit(VNode);
|
||||||
|
|
||||||
|
for i := 0 to TypInfo.Fields.Count-1 do begin
|
||||||
|
NewWatch := AWatch.ChildrenByName[TypInfo.Fields[i].Name];
|
||||||
|
if NewWatch = nil then begin
|
||||||
|
dec(ChildCount);
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
|
if AWatch is TCurrentWatch then begin
|
||||||
|
NewWatch.DisplayFormat := wdfDefault;
|
||||||
|
NewWatch.Enabled := AWatch.Enabled;
|
||||||
|
if EnvironmentOptions.DebuggerAutoSetInstanceFromClass then
|
||||||
|
NewWatch.EvaluateFlags := [defClassAutoCast];
|
||||||
|
end;
|
||||||
|
|
||||||
|
if ExistingNode <> nil then begin
|
||||||
|
tvWatches.NodeItem[ExistingNode] := NewWatch;
|
||||||
|
nd := ExistingNode;
|
||||||
|
ExistingNode := tvWatches.GetNextSiblingNoInit(ExistingNode);
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
nd := tvWatches.AddChild(VNode, NewWatch);
|
||||||
|
end;
|
||||||
|
UpdateItem(nd, NewWatch);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
tvWatches.ChildCount[VNode] := ChildCount;
|
tvWatches.ChildCount[VNode] := ChildCount;
|
||||||
@ -1140,6 +1181,7 @@ end;
|
|||||||
|
|
||||||
procedure TWatchesDlg.tvWatchesInitChildren(Sender: TBaseVirtualTree;
|
procedure TWatchesDlg.tvWatchesInitChildren(Sender: TBaseVirtualTree;
|
||||||
Node: PVirtualNode; var ChildCount: Cardinal);
|
Node: PVirtualNode; var ChildCount: Cardinal);
|
||||||
|
// VTV.OnInitChildren
|
||||||
var
|
var
|
||||||
VNdWatch: TIdeWatch;
|
VNdWatch: TIdeWatch;
|
||||||
WatchValue: TIdeWatchValue;
|
WatchValue: TIdeWatchValue;
|
||||||
|
@ -6205,6 +6205,9 @@ begin
|
|||||||
Result := '(' + FParentWatch.GetFullExpression(AThreadId, AStackFrame) + ').' + Result;
|
Result := '(' + FParentWatch.GetFullExpression(AThreadId, AStackFrame) + ').' + Result;
|
||||||
if (defClassAutoCast in FParentWatch.FEvaluateFlags) then begin
|
if (defClassAutoCast in FParentWatch.FEvaluateFlags) then begin
|
||||||
wv := GetAnyValidParentWatchValue(AThreadId, AStackFrame);
|
wv := GetAnyValidParentWatchValue(AThreadId, AStackFrame);
|
||||||
|
if wv.ResultData <> nil then
|
||||||
|
Result := wv.ResultData.TypeName + Result
|
||||||
|
else
|
||||||
if wv <> nil then
|
if wv <> nil then
|
||||||
Result := wv.TypeInfo.TypeName + Result;
|
Result := wv.TypeInfo.TypeName + Result;
|
||||||
end;
|
end;
|
||||||
@ -6231,7 +6234,9 @@ begin
|
|||||||
(vl.EntriesByIdx[i].Validity <> ddsValid) or
|
(vl.EntriesByIdx[i].Validity <> ddsValid) or
|
||||||
(vl.EntriesByIdx[i].ThreadId <> AThreadId) or
|
(vl.EntriesByIdx[i].ThreadId <> AThreadId) or
|
||||||
(vl.EntriesByIdx[i].StackFrame <> AStackFrame) or
|
(vl.EntriesByIdx[i].StackFrame <> AStackFrame) or
|
||||||
(vl.EntriesByIdx[i].TypeInfo = nil)
|
( (vl.EntriesByIdx[i].TypeInfo = nil) and
|
||||||
|
(vl.EntriesByIdx[i].ResultData = nil)
|
||||||
|
)
|
||||||
) do
|
) do
|
||||||
dec(i);
|
dec(i);
|
||||||
if i >= 0 then
|
if i >= 0 then
|
||||||
|
Loading…
Reference in New Issue
Block a user