FpDebug: Fix watching local/param with name "this". Variables with "this" as name were hidden by the "self" param (that fpc encodes as "this")

This commit is contained in:
Martin 2023-02-04 13:24:56 +01:00
parent 60d221f23a
commit dd5d291621
2 changed files with 17 additions and 5 deletions

View File

@ -1640,7 +1640,7 @@ begin
ADbgValue := nil; ADbgValue := nil;
if not(Symbol is TFpSymbolDwarfDataProc) then if not(Symbol is TFpSymbolDwarfDataProc) then
exit; exit;
if not InfoEntry.GoNamedChildEx(ANameInfo) then if not InfoEntry.GoNamedChildEx(ANameInfo, True) then
exit; exit;
if InfoEntry.IsAddressInStartScope(FAddress) and not InfoEntry.IsArtificial then begin if InfoEntry.IsAddressInStartScope(FAddress) and not InfoEntry.IsArtificial then begin
ADbgValue := SymbolToValue(TFpSymbolDwarf.CreateSubClass(AName, InfoEntry)); ADbgValue := SymbolToValue(TFpSymbolDwarf.CreateSubClass(AName, InfoEntry));
@ -1747,7 +1747,7 @@ begin
// If this is a type with a pointer or ref, need to find the pointer or ref. // If this is a type with a pointer or ref, need to find the pointer or ref.
InfoEntry.GoParent; InfoEntry.GoParent;
if InfoEntry.HasValidScope and if InfoEntry.HasValidScope and
InfoEntry.GoNamedChildEx(NameInfo) InfoEntry.GoNamedChildEx(NameInfo, True)
then begin then begin
if InfoEntry.IsAddressInStartScope(FAddress) and not InfoEntry.IsArtificial then begin if InfoEntry.IsAddressInStartScope(FAddress) and not InfoEntry.IsArtificial then begin
Result := SymbolToValue(TFpSymbolDwarf.CreateSubClass(AName, InfoEntry)); Result := SymbolToValue(TFpSymbolDwarf.CreateSubClass(AName, InfoEntry));
@ -1779,7 +1779,7 @@ begin
// TODO: nested subroutine // TODO: nested subroutine
else else
if InfoEntry.GoNamedChildEx(NameInfo) then begin if InfoEntry.GoNamedChildEx(NameInfo, True) then begin
if InfoEntry.IsAddressInStartScope(FAddress) and not InfoEntry.IsArtificial then begin if InfoEntry.IsAddressInStartScope(FAddress) and not InfoEntry.IsArtificial then begin
Result := SymbolToValue(TFpSymbolDwarf.CreateSubClass(AName, InfoEntry)); Result := SymbolToValue(TFpSymbolDwarf.CreateSubClass(AName, InfoEntry));
exit; exit;
@ -6442,6 +6442,8 @@ begin
if (tg = DW_TAG_class_type) or (tg = DW_TAG_structure_type) then begin if (tg = DW_TAG_class_type) or (tg = DW_TAG_structure_type) then begin
InfoEntry.ScopeIndex := InformationEntry.ScopeIndex; InfoEntry.ScopeIndex := InformationEntry.ScopeIndex;
found := InfoEntry.GoNamedChildEx(ThisNameInfo); found := InfoEntry.GoNamedChildEx(ThisNameInfo);
if found then
found := InfoEntry.IsArtificial;
if not found then begin if not found then begin
InfoEntry.ScopeIndex := InformationEntry.ScopeIndex; InfoEntry.ScopeIndex := InformationEntry.ScopeIndex;
found := InfoEntry.GoNamedChildEx(SelfNameInfo); found := InfoEntry.GoNamedChildEx(SelfNameInfo);

View File

@ -368,7 +368,7 @@ type
function GoNamedChild(const AName: String): Boolean; function GoNamedChild(const AName: String): Boolean;
// find in enum too // TODO: control search with a flags param, if needed // find in enum too // TODO: control search with a flags param, if needed
function GoNamedChildEx(const ANameInfo: TNameSearchInfo): Boolean; function GoNamedChildEx(const ANameInfo: TNameSearchInfo; ASkipArtificial: Boolean = False): Boolean;
// GoNamedChildMatchCaseEx will use // GoNamedChildMatchCaseEx will use
// - UpperName for Hash // - UpperName for Hash
// - LowerName for compare // - LowerName for compare
@ -2872,8 +2872,10 @@ begin
end; end;
end; end;
function TDwarfInformationEntry.GoNamedChildEx(const ANameInfo: TNameSearchInfo): Boolean; function TDwarfInformationEntry.GoNamedChildEx(
const ANameInfo: TNameSearchInfo; ASkipArtificial: Boolean): Boolean;
var var
Val: Integer;
EntryName: PChar; EntryName: PChar;
InEnum: Boolean; InEnum: Boolean;
ParentScopIdx: Integer; ParentScopIdx: Integer;
@ -2901,6 +2903,14 @@ begin
Continue; Continue;
end; end;
if ASkipArtificial then begin
if ReadValue(DW_AT_artificial, Val) and (Val <> 0) then begin
GoNext;
Continue;
end;
end;
if (sc^.NameHash = ANameInfo.NameHash) then begin if (sc^.NameHash = ANameInfo.NameHash) then begin
if not ReadValue(DW_AT_name, EntryName) then begin if not ReadValue(DW_AT_name, EntryName) then begin
GoNext; GoNext;