]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Fix last-die-has-sibling-attr message, don't let such to high-level
authorPetr Machata <pmachata@redhat.com>
Thu, 10 Mar 2011 13:54:09 +0000 (14:54 +0100)
committerPetr Machata <pmachata@redhat.com>
Thu, 10 Mar 2011 13:54:09 +0000 (14:54 +0100)
dwarflint/check_debug_info.cc
dwarflint/tests/garbage-9.bz2 [new file with mode: 0644]
dwarflint/tests/run-bad.sh

index f413ff856288d67d5655bfced0d55e48ba532f19..4a1128cf22e1cfb50a2fa3d7f20f88861cf3c943 100644 (file)
@@ -583,9 +583,16 @@ namespace
        if (sibling_addr != 0)
          {
            if (abbr_code == 0)
-             wr_error (&where,
-                       ": is the last sibling in chain, "
-                       "but has a DW_AT_sibling attribute.\n");
+             {
+               DEF_PREV_WHERE;
+               wr_error (&prev_where,
+                         ": is the last sibling in chain, "
+                         "but has a DW_AT_sibling attribute.\n");
+               /* dwarf_siblingof uses DW_AT_sibling to look for
+                  sibling DIEs.  The value can't be right (there _is_
+                  no sibling), so don't let this up.  */
+               retval = -2;
+             }
            else if (sibling_addr != die_off)
              {
                DEF_PREV_WHERE;
diff --git a/dwarflint/tests/garbage-9.bz2 b/dwarflint/tests/garbage-9.bz2
new file mode 100644 (file)
index 0000000..c2e7a8b
Binary files /dev/null and b/dwarflint/tests/garbage-9.bz2 differ
index a59b74ad75a489dc32277e5fb6db43e99132e476..a956e2d305197d98e1b700f20b710f10317d7f7e 100755 (executable)
@@ -29,7 +29,8 @@ srcdir=$srcdir/tests
 
 testfiles hello.bad-1 hello.bad-3 empty-1 \
     garbage-1 garbage-2 garbage-3 garbage-4 \
-    garbage-5 garbage-6 garbage-7 garbage-8
+    garbage-5 garbage-6 garbage-7 garbage-8 \
+    garbage-9
 
 testrun_compare ./dwarflint hello.bad-1 <<EOF
 error: .debug_info: DIE 0x83: abbrev section at 0x0 doesn't contain code 83.
@@ -89,3 +90,8 @@ EOF
 testrun_compare ./dwarflint garbage-8 <<EOF
 error: .debug_info: DIE 0x6c (abbr. attribute 0x43): DW_AT_sibling with a value of 0.
 EOF
+
+testrun_compare ./dwarflint garbage-9 <<EOF
+error: .debug_info: DIE 0x84 (abbr. attribute 0x5f): invalid reference outside the CU: 0xef00ab.
+error: .debug_info: DIE 0x6c: is the last sibling in chain, but has a DW_AT_sibling attribute.
+EOF