summaryrefslogtreecommitdiffstats
path: root/dwarflint
diff options
context:
space:
mode:
authorPetr Machata <[email protected]>2011-03-08 19:35:07 +0100
committerPetr Machata <[email protected]>2011-03-08 19:35:07 +0100
commit5c92304c9dfac6419bb81326ab80d331f65c622c (patch)
tree8c1b0940ced5de49fe217bac639b960c8c6bb61a /dwarflint
parente2ffae3e282d8cf5db74d27f1e0c89a235a7e7b8 (diff)
dwarflint: Fix the check that DIE chains are terminated with null entry
- and turn in to strict message - and update test cases
Diffstat (limited to 'dwarflint')
-rw-r--r--dwarflint/check_debug_info.cc16
-rwxr-xr-xdwarflint/tests/run-aranges_terminate_early.sh4
-rwxr-xr-xdwarflint/tests/run-check_debug_info_refs.sh6
3 files changed, 17 insertions, 9 deletions
diff --git a/dwarflint/check_debug_info.cc b/dwarflint/check_debug_info.cc
index 1ad33bca..ce245911 100644
--- a/dwarflint/check_debug_info.cc
+++ b/dwarflint/check_debug_info.cc
@@ -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)
diff --git a/dwarflint/tests/run-aranges_terminate_early.sh b/dwarflint/tests/run-aranges_terminate_early.sh
index 7c595709..36ed8a14 100755
--- a/dwarflint/tests/run-aranges_terminate_early.sh
+++ b/dwarflint/tests/run-aranges_terminate_early.sh
@@ -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
diff --git a/dwarflint/tests/run-check_debug_info_refs.sh b/dwarflint/tests/run-check_debug_info_refs.sh
index 88cdcb04..a13d0440 100755
--- a/dwarflint/tests/run-check_debug_info_refs.sh
+++ b/dwarflint/tests/run-check_debug_info_refs.sh
@@ -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.