Browse Source

* abbrev section must be re-read for each chunk of debug info, should resolve #29825

git-svn-id: trunk@33233 -
florian 9 years ago
parent
commit
feb15f08b3
1 changed files with 16 additions and 4 deletions
  1. 16 4
      rtl/inc/lnfodwrf.pp

+ 16 - 4
rtl/inc/lnfodwrf.pp

@@ -969,7 +969,9 @@ procedure SkipAttr(form : QWord);
   end;
   end;
 
 
 var
 var
-  i : PtrUInt;
+  i : PtrInt;
+  prev_base,prev_limit : SizeInt;
+  prev_pos : Int64;
 
 
 begin
 begin
   found := false;
   found := false;
@@ -1002,6 +1004,19 @@ begin
     isdwarf64:=true;
     isdwarf64:=true;
   end;
   end;
 
 
+  DEBUG_WRITELN('debug_abbrev_offset: ',header64.debug_abbrev_offset);
+
+  { not nice, but we have to read the abbrev section after the start of the debug_info section has been read }
+  prev_limit:=limit;
+  prev_base:=base;
+  prev_pos:=Pos;
+  Init(Dwarf_Debug_Abbrev_Section_Offset+header64.debug_abbrev_offset,Dwarf_Debug_Abbrev_Section_Size);
+  ReadAbbrevTable;
+
+  { restore previous reading state and position }
+  Init(prev_base,prev_limit);
+  Seek(prev_pos);
+
   abbrev:=ReadULEB128;
   abbrev:=ReadULEB128;
   level:=0;
   level:=0;
   while (abbrev <> 0) and (not found) do
   while (abbrev <> 0) and (not found) do
@@ -1091,9 +1106,6 @@ begin
       source, line, found);
       source, line, found);
   end;
   end;
 
 
-  Init(Dwarf_Debug_Abbrev_Section_Offset, Dwarf_Debug_Abbrev_Section_Size);
-  ReadAbbrevTable;
-
   current_offset := Dwarf_Debug_Info_Section_Offset;
   current_offset := Dwarf_Debug_Info_Section_Offset;
   end_offset := Dwarf_Debug_Info_Section_Offset + Dwarf_Debug_Info_Section_Size;
   end_offset := Dwarf_Debug_Info_Section_Offset + Dwarf_Debug_Info_Section_Size;