FpDebug: add DW_FORM_sec_offest, DW_FORM_exrloc, DW_FORM_flag_present, DW_FORM_ref_sig8

This commit is contained in:
Martin 2024-05-23 13:45:26 +02:00
parent dc46e8ce2e
commit 0d47565d98
3 changed files with 50 additions and 7 deletions

View File

@ -4662,7 +4662,7 @@ begin
AnAddress := InvalidLoc;
AForm := AnAttribData.InformationEntry.AttribForm[AnAttribData.Idx];
if (AForm = DW_FORM_data4) or (AForm = DW_FORM_data8) then begin
if (AForm = DW_FORM_data4) or (AForm = DW_FORM_data8) or (AForm = DW_FORM_sec_offset) then begin
// location list
if not LocationExprFromLocationList(AnAttribData, AValueObj, Val) then begin
DebugLn(FPDBG_DWARF_VERBOSE, ['LocationFromAttrData: failed to read DW_AT_location from loc-list']);

View File

@ -205,8 +205,8 @@ const
DW_FORM_block2 = $03; // block
DW_FORM_block4 = $04; // block
DW_FORM_data2 = $05; // constant
DW_FORM_data4 = $06; // constant, lineptr, loclistptr, macptr, rangelistptr
DW_FORM_data8 = $07; // constant, lineptr, loclistptr, macptr, rangelistptr
DW_FORM_data4 = $06; // constant // DWARF-3: lineptr, loclistptr, macptr, rangelistptr
DW_FORM_data8 = $07; // constant // DWARF-3: lineptr, loclistptr, macptr, rangelistptr
DW_FORM_string = $08; // string
DW_FORM_block = $09; // block
DW_FORM_block1 = $0a; // block
@ -222,8 +222,13 @@ const
DW_FORM_ref8 = $14; // reference
DW_FORM_ref_udata = $15; // reference
DW_FORM_indirect = $16; //
// -- DWARF 4 --
DW_FORM_sec_offset = $17; // lineptr, loclistptr, macptr, rangelistptr
DW_FORM_exprloc = $18; // exprloc
DW_FORM_flag_present = $19; // flag
DW_FORM_ref_sig8 = $20; // reference
DW_FORM_MAX = $16; //
DW_FORM_MAX = $20; //
{ DWARF operation encodings }
@ -776,6 +781,7 @@ begin
DW_AT_elemental : Result := 'DW_AT_elemental';
DW_AT_pure : Result := 'DW_AT_pure';
DW_AT_recursive : Result := 'DW_AT_recursive';
DW_AT_data_bit_offset : Result := 'DW_AT_data_bit_offset';
DW_AT_lo_user : Result := 'DW_AT_lo_user';
DW_AT_hi_user : Result := 'DW_AT_hi_user';
else
@ -807,6 +813,10 @@ begin
DW_FORM_ref8 : Result := 'DW_FORM_ref8';
DW_FORM_ref_udata: Result := 'DW_FORM_ref_udata';
DW_FORM_indirect : Result := 'DW_FORM_indirect';
DW_FORM_sec_offset: Result := 'DW_FORM_sec_offset';
DW_FORM_exprloc: Result := 'DW_FORM_exprloc';
DW_FORM_flag_present: Result := 'DW_FORM_flag_present';
DW_FORM_ref_sig8: Result := 'DW_FORM_ref_sig8';
else
Result := Format('DW_FORM_%d', [AValue]);
end;

View File

@ -992,7 +992,8 @@ begin
Result := True;
case AForm of
DW_FORM_addr : Inc(AEntryData, AddrSize);
DW_FORM_block : begin
DW_FORM_block,
DW_FORM_exprloc : begin
UValue := ULEB128toOrdinal(AEntryData);
Inc(AEntryData, UValue);
end;
@ -1020,7 +1021,9 @@ begin
while (PByte(AEntryData)^ and $80) <> 0 do Inc(AEntryData);
Inc(AEntryData);
end;
DW_FORM_strp: begin
DW_FORM_ref_sig8 : Inc(AEntryData, 8);
DW_FORM_strp,
DW_FORM_sec_offset: begin
if IsDwarf64 then
Inc(AEntryData, 8)
else
@ -1047,6 +1050,7 @@ begin
while AForm = DW_FORM_indirect do AForm := ULEB128toOrdinal(AEntryData);
Result := SkipEntryDataForForm(AEntryData, AForm, AddrSize, IsDwarf64, Version);
end;
DW_FORM_flag_present: ; // No data
else begin
DebugLn(FPDBG_DWARF_WARNINGS, ['Error: Unknown Form: ', AForm]);
Result := False;
@ -5571,6 +5575,7 @@ begin
DW_FORM_ref_addr : begin
AValue := LocToAddrOrNil(ReadDwarfSectionOffsetOrLenFromDwarfSection(AAttribute));
end;
DW_FORM_flag_present: AValue := 1;
DW_FORM_flag,
DW_FORM_ref1,
DW_FORM_data1 : begin
@ -5588,6 +5593,12 @@ begin
DW_FORM_data8 : begin
AValue := PQWord(AAttribute)^;
end;
DW_FORM_sec_offset: begin
if IsDwarf64 then
AValue := PQWord(AAttribute)^
else
AValue := PLongWord(AAttribute)^;
end;
DW_FORM_sdata : begin
AValue := SLEB128toOrdinal(AAttribute);
end;
@ -5609,6 +5620,7 @@ begin
DW_FORM_ref_addr : begin
AValue := LocToAddrOrNil(ReadDwarfSectionOffsetOrLenFromDwarfSection(AAttribute));
end;
DW_FORM_flag_present: AValue := 1;
DW_FORM_flag,
DW_FORM_ref1,
DW_FORM_data1 : begin
@ -5626,6 +5638,12 @@ begin
DW_FORM_data8 : begin
AValue := PInt64(AAttribute)^;
end;
DW_FORM_sec_offset: begin
if IsDwarf64 then
AValue := PQWord(AAttribute)^
else
AValue := PLongWord(AAttribute)^;
end;
DW_FORM_sdata : begin
AValue := SLEB128toOrdinal(AAttribute);
end;
@ -5647,6 +5665,7 @@ begin
DW_FORM_ref_addr : begin
AValue := LocToAddrOrNil(ReadDwarfSectionOffsetOrLenFromDwarfSection(AAttribute));
end;
DW_FORM_flag_present: AValue := 1;
DW_FORM_flag,
DW_FORM_ref1,
DW_FORM_data1 : begin
@ -5664,6 +5683,12 @@ begin
DW_FORM_data8 : begin
AValue := PInt64(AAttribute)^;
end;
DW_FORM_sec_offset: begin
if IsDwarf64 then
AValue := PQWord(AAttribute)^
else
AValue := PLongWord(AAttribute)^;
end;
DW_FORM_sdata : begin
AValue := SLEB128toOrdinal(AAttribute);
end;
@ -5703,6 +5728,7 @@ begin
DW_FORM_ref_addr : begin
AValue := LocToAddrOrNil(ReadDwarfSectionOffsetOrLenFromDwarfSection(AAttribute));
end;
DW_FORM_flag_present: AValue := 1;
DW_FORM_flag,
DW_FORM_ref1,
DW_FORM_data1 : begin
@ -5720,6 +5746,12 @@ begin
DW_FORM_data8 : begin
AValue := PQWord(AAttribute)^;
end;
DW_FORM_sec_offset: begin
if IsDwarf64 then
AValue := PQWord(AAttribute)^
else
AValue := PLongWord(AAttribute)^;
end;
DW_FORM_sdata : begin
AValue := QWord(SLEB128toOrdinal(AAttribute));
end;
@ -5758,7 +5790,8 @@ var
begin
Result := True;
case AForm of
DW_FORM_block : begin
DW_FORM_block,
DW_FORM_exprloc : begin
Size := ULEB128toOrdinal(AAttribute);
end;
DW_FORM_block1 : begin