]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
readdwarf3: Only read line table for units with addresses for inlined functions
authorMark Wielaard <mark@klomp.org>
Thu, 16 Sep 2021 20:49:41 +0000 (22:49 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 24 Sep 2021 20:28:12 +0000 (22:28 +0200)
When parsing DIEs for inlined functions, only read the line table for
units which can actually contain inlined_subroutines.

coregrind/m_debuginfo/readdwarf3.c

index cf8270c8cf537991b7710cbe4a696371f96d013c..7ece770090998063cb3e446e8ad77939efbba7cd 100644 (file)
@@ -3134,6 +3134,8 @@ static Bool parse_inl_DIE (
       Bool have_lo    = False;
       Addr ip_lo    = 0;
       const HChar *compdir = NULL;
+      Bool has_stmt_list = False;
+      ULong debug_line_offset = 0;
 
       nf_i = 0;
       while (True) {
@@ -3159,15 +3161,19 @@ static Bool parse_inl_DIE (
             ML_(dinfo_free) (str);
          }
          if (attr == DW_AT_stmt_list && cts.szB > 0) {
-            read_filename_table( parser->fndn_ix_Table, compdir,
-                                 cc, cts.u.val, td3 );
+           has_stmt_list = True;
+            debug_line_offset = cts.u.val;
          }
          if (attr == DW_AT_sibling && cts.szB > 0) {
             parser->sibling = cts.u.val;
          }
       }
-      if (level == 0)
+      if (level == 0) {
          setup_cu_svma (cc, have_lo, ip_lo, td3);
+         if (has_stmt_list && unit_has_addrs)
+            read_filename_table( parser->fndn_ix_Table, compdir,
+                                 cc, debug_line_offset, td3 );
+      }
    }
 
    if (dtag == DW_TAG_inlined_subroutine) {