diff options
| author | Petr Machata <[email protected]> | 2011-03-10 15:39:01 +0100 |
|---|---|---|
| committer | Petr Machata <[email protected]> | 2011-03-10 15:39:01 +0100 |
| commit | fef55ed3b49c1d1b632685e4079ca7caac759dc9 (patch) | |
| tree | 22d01ea1fe2a061afe411581e0ad462f850bf235 | |
| parent | fcacc3679244d2c046786539948d0c8db1b092f7 (diff) | |
dwarflint: Missing DW_LNE_end_sequence OK in empty line number program
- also the fact that the line number program is empty is not a problem
in itself, only when combined with otherwise unused file table
| -rw-r--r-- | dwarflint/check_debug_line.cc | 33 | ||||
| -rwxr-xr-x | dwarflint/tests/run-bad.sh | 1 | ||||
| -rwxr-xr-x | dwarflint/tests/run-check_debug_info_refs.sh | 2 | ||||
| -rwxr-xr-x | dwarflint/tests/run-check_duplicate_DW_tag_variable.sh | 1 | ||||
| -rwxr-xr-x | dwarflint/tests/run-debug_abbrev-duplicate-attribute.sh | 1 | ||||
| -rwxr-xr-x | dwarflint/tests/run-libdl-2.12.so.debug.sh | 5 |
6 files changed, 21 insertions, 22 deletions
diff --git a/dwarflint/check_debug_line.cc b/dwarflint/check_debug_line.cc index 2f32e47e..7fa097ac 100644 --- a/dwarflint/check_debug_line.cc +++ b/dwarflint/check_debug_line.cc @@ -596,22 +596,29 @@ check_debug_line::check_debug_line (checkstack &stack, dwarflint &lint) << " `" << include_directories[i].name << "' is not used." << std::endl; + // We can't do full analysis unless we know which DIEs refer to + // files. if (_m_info != NULL) - // We can't do full analysis unless we know which DIEs refer - // to files. - for (size_t i = 0; i < files.size (); ++i) - if (!files[i].used) - wr_message (where, - cat (mc_impact_3, mc_acc_bloat, mc_line, mc_header)) - << "the file #" << i + 1 - << " `" << files[i].name << "' is not used." << std::endl; - - if (!seen_opcode) - wr_message (where, cat (mc_line, mc_acc_bloat, mc_impact_3)) - << "empty line number program." << std::endl; + { + bool useful = false; + + for (size_t i = 0; i < files.size (); ++i) + if (!files[i].used) + wr_message (where, + cat (mc_impact_3, mc_acc_bloat, mc_line, mc_header)) + << "the file #" << i + 1 + << " `" << files[i].name << "' is not used." << std::endl; + else + useful = true; + + if (!seen_opcode && !useful) + wr_message (where, cat (mc_line, mc_acc_bloat, mc_impact_3)) + << "empty line number program and no references from .debug_info." + << std::endl; + } struct where wh = WHERE (sec_line, NULL); - if (!terminated) + if (!terminated && seen_opcode) wr_error (where) << "sequence of opcodes not terminated with DW_LNE_end_sequence." << std::endl; diff --git a/dwarflint/tests/run-bad.sh b/dwarflint/tests/run-bad.sh index a956e2d3..3803336a 100755 --- a/dwarflint/tests/run-bad.sh +++ b/dwarflint/tests/run-bad.sh @@ -46,7 +46,6 @@ 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 diff --git a/dwarflint/tests/run-check_debug_info_refs.sh b/dwarflint/tests/run-check_debug_info_refs.sh index a13d0440..604f4441 100755 --- a/dwarflint/tests/run-check_debug_info_refs.sh +++ b/dwarflint/tests/run-check_debug_info_refs.sh @@ -43,7 +43,5 @@ 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. EOF diff --git a/dwarflint/tests/run-check_duplicate_DW_tag_variable.sh b/dwarflint/tests/run-check_duplicate_DW_tag_variable.sh index 6e62f280..2134fc27 100755 --- a/dwarflint/tests/run-check_duplicate_DW_tag_variable.sh +++ b/dwarflint/tests/run-check_duplicate_DW_tag_variable.sh @@ -32,7 +32,6 @@ testfiles crc7.ko.debug testrun_compare ./dwarflint --check check_duplicate_DW_tag_variable crc7.ko.debug <<EOF warning: .debug_line: offset 0x3c4: the include #6 \`XXXXXX' is not used. warning: .debug_line: table 967: the include #6 \`XXXXXX' is not used. -error: .debug_line: table 967: sequence of opcodes not terminated with DW_LNE_end_sequence. error: .debug_info: DIE 0x3d21: Redeclaration of variable 'console_printk', originally seen at DIE 37f3. error: .debug_info: DIE 0x3d2e: Redeclaration of variable 'hex_asc', originally seen at DIE 380b. error: .debug_info: DIE 0x3d41: Redeclaration of variable '__per_cpu_offset', originally seen at DIE 382e. diff --git a/dwarflint/tests/run-debug_abbrev-duplicate-attribute.sh b/dwarflint/tests/run-debug_abbrev-duplicate-attribute.sh index a750863b..1e73d207 100755 --- a/dwarflint/tests/run-debug_abbrev-duplicate-attribute.sh +++ b/dwarflint/tests/run-debug_abbrev-duplicate-attribute.sh @@ -33,5 +33,4 @@ testrun_compare ./dwarflint debug_abbrev-duplicate-attribute <<EOF error: .debug_abbrev: abbr. attribute 0x19: duplicate attribute byte_size (first was at 0x13). error: .debug_abbrev: abbr. attribute 0x1b: duplicate attribute decl_file (first was at 0x15). error: .debug_abbrev: abbr. attribute 0x1d: duplicate attribute decl_line (first was at 0x17). -error: .debug_line: table 0: sequence of opcodes not terminated with DW_LNE_end_sequence. EOF diff --git a/dwarflint/tests/run-libdl-2.12.so.debug.sh b/dwarflint/tests/run-libdl-2.12.so.debug.sh index 36ab399a..825162c6 100755 --- a/dwarflint/tests/run-libdl-2.12.so.debug.sh +++ b/dwarflint/tests/run-libdl-2.12.so.debug.sh @@ -36,12 +36,9 @@ error: .debug_abbrev: abbr. attribute 0x330: invalid or unknown name 0x2107. error: .debug_abbrev: abbr. attribute 0xa28: invalid or unknown name 0x2107. error: .debug_abbrev: abbr. attribute 0x108e: invalid or unknown name 0x2107. error: .debug_abbrev: abbr. attribute 0x1300: invalid or unknown name 0x2107. -error: .debug_line: table 4508: sequence of opcodes not terminated with DW_LNE_end_sequence. -error: .debug_line: table 4606: sequence of opcodes not terminated with DW_LNE_end_sequence. EOF # Here we test proper support for DW_AT_GNU_vector testrun_compare ./dwarflint --check=@low libdl-2.12.so.debug <<EOF -error: .debug_line: table 4508: sequence of opcodes not terminated with DW_LNE_end_sequence. -error: .debug_line: table 4606: sequence of opcodes not terminated with DW_LNE_end_sequence. +No errors EOF |
