summaryrefslogtreecommitdiffstats
path: root/dwarflint
diff options
context:
space:
mode:
authorPetr Machata <[email protected]>2011-03-08 18:53:22 +0100
committerPetr Machata <[email protected]>2011-03-08 18:53:22 +0100
commitf9d71da24e497af7fc00bf38f88e494053b06a81 (patch)
tree962ab6487ca9b74028353325acb96c34ff822349 /dwarflint
parent427f6c53451744b15dbac6a0a4a5d120053b1e56 (diff)
dwarflint: Fix iteration over low-level attributes
- this to allow (certainly bogus, but anyway) attribute name == 0 - test case that triggers this
Diffstat (limited to 'dwarflint')
-rw-r--r--dwarflint/check_debug_info.cc4
-rw-r--r--dwarflint/tests/garbage-3.bz2bin0 -> 2765 bytes
-rwxr-xr-xdwarflint/tests/run-bad.sh6
3 files changed, 7 insertions, 3 deletions
diff --git a/dwarflint/check_debug_info.cc b/dwarflint/check_debug_info.cc
index 6672c8c8..348dad0d 100644
--- a/dwarflint/check_debug_info.cc
+++ b/dwarflint/check_debug_info.cc
@@ -642,7 +642,7 @@ namespace
/* Attribute values. */
for (struct abbrev_attrib *it = abbrev->attribs;
- it->name != 0; ++it)
+ it->name != 0 || it->form != 0; ++it)
{
where.ref = &it->where;
@@ -1097,7 +1097,7 @@ check_debug_info::check_debug_info (checkstack &stack, dwarflint &lint)
if (!it->second.abbr[i].used)
wr_message (it->second.abbr[i].where,
cat (mc_impact_3, mc_acc_bloat, mc_abbrevs))
- << ": abbreviation is never used." << std::endl;
+ << "abbreviation is never used." << std::endl;
}
// re-link CUs so that they form a chain again. This is to
diff --git a/dwarflint/tests/garbage-3.bz2 b/dwarflint/tests/garbage-3.bz2
new file mode 100644
index 00000000..ad66a414
--- /dev/null
+++ b/dwarflint/tests/garbage-3.bz2
Binary files differ
diff --git a/dwarflint/tests/run-bad.sh b/dwarflint/tests/run-bad.sh
index 871fe551..38b9be1a 100755
--- a/dwarflint/tests/run-bad.sh
+++ b/dwarflint/tests/run-bad.sh
@@ -27,7 +27,7 @@
srcdir=$srcdir/tests
-testfiles hello.bad-1 hello.bad-3 garbage-1 garbage-2
+testfiles hello.bad-1 hello.bad-3 garbage-1 garbage-2 garbage-3
testrun_compare ./dwarflint hello.bad-1 <<EOF
error: .debug_info: DIE 0x83: abbrev section at 0x0 doesn't contain code 83.
@@ -50,3 +50,7 @@ EOF
testrun_compare ./dwarflint garbage-2 <<EOF
error: .debug_info: CU 0: toplevel DIE must be either compile_unit or partial_unit.
EOF
+
+testrun_compare ./dwarflint --check=@low garbage-3 <<EOF
+error: .debug_abbrev: abbr. attribute 0xc: invalid or unknown name 0x0.
+EOF