From: Petr Machata Date: Tue, 8 Mar 2011 17:53:22 +0000 (+0100) Subject: dwarflint: Fix iteration over low-level attributes X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f9d71da24e497af7fc00bf38f88e494053b06a81;p=thirdparty%2Felfutils.git dwarflint: Fix iteration over low-level attributes - this to allow (certainly bogus, but anyway) attribute name == 0 - test case that triggers this --- diff --git a/dwarflint/check_debug_info.cc b/dwarflint/check_debug_info.cc index 6672c8c8d..348dad0d2 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 000000000..ad66a414e Binary files /dev/null and b/dwarflint/tests/garbage-3.bz2 differ diff --git a/dwarflint/tests/run-bad.sh b/dwarflint/tests/run-bad.sh index 871fe551c..38b9be1a3 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 <