]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Small optimization to DWARF 5 mode in System.Dwarf_Line
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 6 Jul 2021 14:47:31 +0000 (16:47 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 21 Sep 2021 15:24:59 +0000 (15:24 +0000)
gcc/ada/

* libgnat/s-dwalin.adb (To_File_Name): Fetch only the last string
from the .debug_line_str section.
(Symbolic_Address.Set_Result): Likewise.

gcc/ada/libgnat/s-dwalin.adb

index 74700e68bfc8ca7b3ca20c8ca7b6f78df42af491..4bcd741c92c913d83fc4fdc5fdb091bf48193785 100644 (file)
@@ -957,8 +957,10 @@ package body System.Dwarf_Lines is
 
                      when DW_FORM_line_strp =>
                         Read_Section_Offset (C.Lines, Off, C.Header.Is64);
-                        Seek (C.Line_Str, Off);
-                        Read_C_String (C.Line_Str, Buf);
+                        if J = File then
+                           Seek (C.Line_Str, Off);
+                           Read_C_String (C.Line_Str, Buf);
+                        end if;
 
                      when others =>
                         raise Dwarf_Error with "DWARF form not implemented";
@@ -1674,8 +1676,10 @@ package body System.Dwarf_Lines is
 
                         when DW_FORM_line_strp =>
                            Read_Section_Offset (C.Lines, Off, C.Header.Is64);
-                           Seek (C.Line_Str, Off);
-                           File_Name := Read_C_String (C.Line_Str);
+                           if J = Match.File then
+                              Seek (C.Line_Str, Off);
+                              File_Name := Read_C_String (C.Line_Str);
+                           end if;
 
                         when others =>
                            raise Dwarf_Error with "DWARF form not implemented";
@@ -1718,8 +1722,10 @@ package body System.Dwarf_Lines is
 
                         when DW_FORM_line_strp =>
                            Read_Section_Offset (C.Lines, Off, C.Header.Is64);
-                           Seek (C.Line_Str, Off);
-                           Dir_Name := Read_C_String (C.Line_Str);
+                           if J = Dir_Idx then
+                              Seek (C.Line_Str, Off);
+                              Dir_Name := Read_C_String (C.Line_Str);
+                           end if;
 
                         when others =>
                            raise Dwarf_Error with "DWARF form not implemented";