diff options
| author | Petr Machata <[email protected]> | 2011-03-08 18:53:22 +0100 |
|---|---|---|
| committer | Petr Machata <[email protected]> | 2011-03-08 18:53:22 +0100 |
| commit | f9d71da24e497af7fc00bf38f88e494053b06a81 (patch) | |
| tree | 962ab6487ca9b74028353325acb96c34ff822349 /dwarflint | |
| parent | 427f6c53451744b15dbac6a0a4a5d120053b1e56 (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.cc | 4 | ||||
| -rw-r--r-- | dwarflint/tests/garbage-3.bz2 | bin | 0 -> 2765 bytes | |||
| -rwxr-xr-x | dwarflint/tests/run-bad.sh | 6 |
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 Binary files differnew file mode 100644 index 00000000..ad66a414 --- /dev/null +++ b/dwarflint/tests/garbage-3.bz2 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 |
