]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Handle apparently-bogus DW_TAG_compilation_unit DIE that shows up in
authorJulian Seward <jseward@acm.org>
Tue, 24 Jun 2008 09:51:55 +0000 (09:51 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 24 Jun 2008 09:51:55 +0000 (09:51 +0000)
gcc-4.3 output.  My reading of the DWARF3 standard is that a
DW_TAG_compilation_unit should have either DW_AT_ranges or a
(DW_AT_low_pc, DW_AT_high_pc) pair, but not both.  So I think this is
a gcc bug.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8276

coregrind/m_debuginfo/readdwarf3.c

index 263bd41e795b2784666b34ef0cfd5068bba35695..83556a93d8de9c2456ce777c9235388355c1c4aa 100644 (file)
@@ -1496,7 +1496,20 @@ static void parse_var_DIE ( /*OUT*/TempVar** tempvars,
                         level,
                         False/*isFunc*/, NULL/*fbGX*/ );
       } else
+      if (have_lo && (!have_hi1) && have_range && ip_lo == 0) {
+         /* broken DIE created by gcc-4.3.X ?  Ignore the
+            apparently-redundant DW_AT_low_pc and use the DW_AT_ranges
+            instead. */
+         varstack_push( cc, parser, td3, 
+                        get_range_list( cc, td3,
+                                        rangeoff, cc->cu_svma ),
+                        level,
+                        False/*isFunc*/, NULL/*fbGX*/ );
+      } else {
+         if (0) VG_(printf)("I got hlo %d hhi1 %d hrange %d\n",
+                            (Int)have_lo, (Int)have_hi1, (Int)have_range);
          goto bad_DIE;
+      }
    }
 
    if (dtag == DW_TAG_lexical_block || dtag == DW_TAG_subprogram) {