FpDebug: Implement DW_AT_enum_class / scoped enum

This commit is contained in:
Martin 2025-04-19 21:34:27 +02:00
parent 89468fc795
commit d1bf325003
3 changed files with 12 additions and 5 deletions

View File

@ -1500,7 +1500,7 @@ begin
end
else
if InfoEntry.GoNamedChildEx(ANameInfo, False, fsfIgnoreEnumVals in AFindFlags) then begin
if InfoEntry.GoNamedChildEx(ANameInfo, False, fsfIgnoreEnumVals in AFindFlags, True) then begin
if InfoEntry.IsAddressInStartScope(FAddress) then begin
// only variables are marked "external", but types not / so we may need all top level
Result := True;

View File

@ -194,6 +194,7 @@ const
DW_AT_recursive = $68 ; // flag
// -- DWARF 4 --
DW_AT_data_bit_offset = $6b ; // constant // block, constant, reference
DW_AT_enum_class = $6d ;
// --- ---
DW_AT_lo_user = $2000; // ---
DW_AT_hi_user = $3fff; // ---

View File

@ -379,7 +379,7 @@ type
function GoNamedChild(const ANameInfo: TNameSearchInfo): Boolean;
// find in enum too // TODO: control search with a flags param, if needed
function GoNamedChildEx(const ANameInfo: TNameSearchInfo; ASkipArtificial: Boolean = False; ASkipEnumMembers: Boolean = False): Boolean;
function GoNamedChildEx(const ANameInfo: TNameSearchInfo; ASkipArtificial: Boolean = False; ASkipEnumMembers: Boolean = False; ASkipScopedEnumMembers: Boolean = False): Boolean;
// GoNamedChildMatchCaseEx will use
// - UpperName for Hash
// - LowerName for compare
@ -3026,9 +3026,8 @@ begin
end;
end;
function TDwarfInformationEntry.GoNamedChildEx(
const ANameInfo: TNameSearchInfo; ASkipArtificial: Boolean;
ASkipEnumMembers: Boolean): Boolean;
function TDwarfInformationEntry.GoNamedChildEx(const ANameInfo: TNameSearchInfo;
ASkipArtificial: Boolean; ASkipEnumMembers: Boolean; ASkipScopedEnumMembers: Boolean): Boolean;
var
Val: Integer;
EntryName: PChar;
@ -3096,6 +3095,13 @@ begin
end;
if (not ASkipEnumMembers) and (FAbbrev^.tag = DW_TAG_enumeration_type) then begin
if ASkipScopedEnumMembers then begin
if ReadValue(DW_AT_enum_class, Val) and (Val <> 0) then begin
GoNextFast;
Continue;
end;
end;
assert(not InEnum, 'nested enum');
InEnum := True;
ParentScopIdx := ScopeIndex;