]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Missing DW_LNE_end_sequence OK in empty line number program
authorPetr Machata <pmachata@redhat.com>
Thu, 10 Mar 2011 14:39:01 +0000 (15:39 +0100)
committerPetr Machata <pmachata@redhat.com>
Thu, 10 Mar 2011 14:39:01 +0000 (15:39 +0100)
- 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
dwarflint/tests/run-bad.sh
dwarflint/tests/run-check_debug_info_refs.sh
dwarflint/tests/run-check_duplicate_DW_tag_variable.sh
dwarflint/tests/run-debug_abbrev-duplicate-attribute.sh
dwarflint/tests/run-libdl-2.12.so.debug.sh

index 2f32e47ed0dfa3422b60f8cf17eaa15711d28542..7fa097acf0d0b180a5b808eb0a9ca2d2c4ac8500 100644 (file)
@@ -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;
index a956e2d305197d98e1b700f20b710f10317d7f7e..3803336a77199cd5b2975d7acdbe5320a225289d 100755 (executable)
@@ -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
 
index a13d04401e848ea62ee83a260a0e3a300da25603..604f44415ea02d035bd449e35963a47985d1cbb9 100755 (executable)
@@ -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
index 6e62f28015476df2f2f31cb4351b7d8a9148da0d..2134fc277ea95c4ae948432ab35211c3aaea76fc 100755 (executable)
@@ -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.
index a750863b764f8845cdcac74004a2e15ed33d5b46..1e73d20789491be9cd5e679689b6aeafedeb445a 100755 (executable)
@@ -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
index 36ab399ae61b4c489606b42c0bd1fc9a2840aa6f..825162c6870fc737d1c2f153008deb295aed19b4 100755 (executable)
@@ -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