From fef55ed3b49c1d1b632685e4079ca7caac759dc9 Mon Sep 17 00:00:00 2001 From: Petr Machata Date: Thu, 10 Mar 2011 15:39:01 +0100 Subject: [PATCH] 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 --- dwarflint/check_debug_line.cc | 33 +++++++++++-------- dwarflint/tests/run-bad.sh | 1 - dwarflint/tests/run-check_debug_info_refs.sh | 2 -- .../run-check_duplicate_DW_tag_variable.sh | 1 - .../run-debug_abbrev-duplicate-attribute.sh | 1 - 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 2f32e47ed..7fa097acf 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 a956e2d30..3803336a7 100755 --- a/dwarflint/tests/run-bad.sh +++ b/dwarflint/tests/run-bad.sh @@ -46,7 +46,6 @@ EOF testrun_compare ./dwarflint empty-1 <