diff options
author | Petr Machata <pmachata@redhat.com> | 2011-03-09 21:33:31 +0100 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2011-03-09 21:33:31 +0100 |
commit | 4a3cc16aa2dc34d36965b6f1ec525efb041ab670 (patch) | |
tree | c4a08d430327b37e95bbc9236890708d5c8dda06 | |
parent | 2685aae8afcfac972861d295c41a1fbab2bcd6e3 (diff) | |
download | elfutils-4a3cc16aa2dc34d36965b6f1ec525efb041ab670.tar.gz |
dwarflint: Check that CU DIE has stmt_list if children have decl_file
- Mark's test case attached
-rw-r--r-- | dwarflint/check_debug_info.cc | 10 | ||||
-rw-r--r-- | dwarflint/tests/empty-1.bz2 | bin | 0 -> 587 bytes | |||
-rwxr-xr-x | dwarflint/tests/run-bad.sh | 9 |
3 files changed, 15 insertions, 4 deletions
diff --git a/dwarflint/check_debug_info.cc b/dwarflint/check_debug_info.cc index 7d7b293c..c05e438a 100644 --- a/dwarflint/check_debug_info.cc +++ b/dwarflint/check_debug_info.cc @@ -1234,9 +1234,13 @@ check_debug_info_refs::check_debug_info_refs (checkstack &stack, for (std::vector<cu>::iterator it = _m_info->cus.begin (); it != _m_info->cus.end (); ++it) { - if (it->stmt_list.addr != (uint64_t)-1 - && (_m_line == NULL - || !_m_line->has_line_table (it->stmt_list.addr))) + if (it->stmt_list.addr == (uint64_t)-1) + for (size_t i = 0; i < it->decl_file_refs.size; ++i) + wr_error (it->decl_file_refs.refs[i].who) + << "references .debug_line table, but CU DIE lacks DW_AT_stmt_list." + << std::endl; + else if (_m_line == NULL + || !_m_line->has_line_table (it->stmt_list.addr)) wr_error (it->stmt_list.who) << "unresolved reference to .debug_line table " << pri::hex (it->stmt_list.addr) << '.' << std::endl; diff --git a/dwarflint/tests/empty-1.bz2 b/dwarflint/tests/empty-1.bz2 Binary files differnew file mode 100644 index 00000000..25a7ada0 --- /dev/null +++ b/dwarflint/tests/empty-1.bz2 diff --git a/dwarflint/tests/run-bad.sh b/dwarflint/tests/run-bad.sh index 39fbdb5f..a59b74ad 100755 --- a/dwarflint/tests/run-bad.sh +++ b/dwarflint/tests/run-bad.sh @@ -27,7 +27,8 @@ srcdir=$srcdir/tests -testfiles hello.bad-1 hello.bad-3 garbage-1 garbage-2 garbage-3 garbage-4 \ +testfiles hello.bad-1 hello.bad-3 empty-1 \ + garbage-1 garbage-2 garbage-3 garbage-4 \ garbage-5 garbage-6 garbage-7 garbage-8 testrun_compare ./dwarflint hello.bad-1 <<EOF @@ -42,6 +43,12 @@ error: .debug_info: DIE 0xa4: toplevel DIE chain contains more than one DIE. error: .debug_info: DIE 0xab: toplevel DIE chain contains more than one DIE. EOF +testrun_compare ./dwarflint empty-1 <<EOF +warning: .debug_line: table 0: the file #1 \`empty.c' is not used. +error: .debug_line: table 0: sequence of opcodes not terminated with DW_LNE_end_sequence. +error: .debug_info: DIE 0x29 (abbr. attribute 0x13): references .debug_line table, but CU DIE lacks DW_AT_stmt_list. +EOF + testrun_compare ./dwarflint garbage-1 <<EOF error: Broken ELF: offset out of range. error: .debug_abbrev: data not found. |