]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Fix the check that DIE chains are terminated with null entry
authorPetr Machata <pmachata@redhat.com>
Tue, 8 Mar 2011 18:35:07 +0000 (19:35 +0100)
committerPetr Machata <pmachata@redhat.com>
Tue, 8 Mar 2011 18:35:07 +0000 (19:35 +0100)
- and turn in to strict message
- and update test cases

dwarflint/check_debug_info.cc
dwarflint/tests/run-aranges_terminate_early.sh
dwarflint/tests/run-check_debug_info_refs.sh

index 1ad33bcafcb73a66e748149697919eb49c864d31..ce245911d83a98f5f403b29f508cbcb3a13f2427 100644 (file)
@@ -589,13 +589,6 @@ namespace
        /* The section ended.  */
        if (abbr_code == 0)
          break;
-       if (read_ctx_eof (ctx))
-         {
-           wr_error (where)
-             << "DIE chain not terminated with DIE with zero abbrev code."
-             << std::endl;
-           break;
-         }
 
        prev_die_off = die_off;
        got_die = true;
@@ -928,6 +921,15 @@ namespace
                          &where,
                          ": abbrev has_children, but the chain was empty.\n");
          }
+
+       if (read_ctx_eof (ctx))
+         {
+           // DWARF 4 Ch. 2.3: A chain of sibling entries is
+           // terminated by a null entry.
+           wr_message (where, cat (mc_impact_1, mc_info))
+             << "DIE chain not terminated with null entry." << std::endl;
+           break;
+         }
       }
 
     if (sibling_addr != 0)
index 7c5957091b7d776a2a5ccee415f89e4b0cf1630e..36ed8a141faa332c78f906d96b35d9c36f72e57b 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Red Hat, Inc.
+# Copyright (C) 2010, 2011 Red Hat, Inc.
 # This file is part of Red Hat elfutils.
 #
 # Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -32,11 +32,13 @@ srcdir=$srcdir/tests
 testfiles aranges_terminate_early
 
 testrun_compare ./dwarflint --strict aranges_terminate_early <<EOF
+warning: .debug_info: DIE 0xb (abbreviation 0): DIE chain not terminated with null entry.
 warning: .debug_aranges: [0x20, 0x30): unnecessary padding with zero bytes.
 warning: .debug_aranges: addresses [0x400474, 0x400481) are covered with CUs, but not with aranges.
 EOF
 
 testrun_compare ./dwarflint --check=check_debug_aranges --strict aranges_terminate_early <<EOF
+warning: .debug_info: DIE 0xb (abbreviation 0): DIE chain not terminated with null entry.
 warning: .debug_aranges: [0x20, 0x30): unnecessary padding with zero bytes.
 warning: .debug_aranges: addresses [0x400474, 0x400481) are covered with CUs, but not with aranges.
 EOF
index 88cdcb04be9af42a04442b40019f1bf1d9738394..a13d04401e848ea62ee83a260a0e3a300da25603 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Red Hat, Inc.
+# Copyright (C) 2010, 2011 Red Hat, Inc.
 # This file is part of Red Hat elfutils.
 #
 # Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -34,11 +34,15 @@ error: .debug_aranges: table 48 (CU DIE 95): there has already been arange secti
 EOF
 
 testrun_compare ./dwarflint --strict --check=check_debug_info_refs check_debug_info_refs-1 <<EOF
+warning: .debug_info: DIE 0xb (abbreviation 0): DIE chain not terminated with null entry.
+warning: .debug_info: DIE 0x5f (abbreviation 54): DIE chain not terminated with null entry.
 error: .debug_aranges: table 48 (CU DIE 95): there has already been arange section for this CU.
 warning: .debug_info: CU 0: no aranges table is associated with this CU.
 EOF
 
 testrun_compare ./dwarflint --strict --check=check_debug_info_refs check_debug_info_refs-2 <<EOF
+warning: .debug_info: DIE 0xb (abbreviation 0): DIE chain not terminated with null entry.
+warning: .debug_info: DIE 0x54 (abbreviation 48): DIE chain not terminated with null entry.
 warning: .debug_line: table 0: empty line number program.
 error: .debug_line: table 0: sequence of opcodes not terminated with DW_LNE_end_sequence.
 warning: .debug_info: CU 0: no aranges table is associated with this CU.