[readelf] Fix end_seq entry in -wL. Specifically stop the display of a line number...
authorTom de Vries <tdevries@suse.de>
Fri, 10 Jul 2020 10:25:44 +0000 (11:25 +0100)
committerNick Clifton <nickc@redhat.com>
Fri, 10 Jul 2020 10:25:44 +0000 (11:25 +0100)
binutils* dwarf.c (display_debug_lines_decoded): Don't emit meaningless
information in the end_sequence row.
* testsuite/binutils-all/dw5.W: Update.
* testsuite/binutils-all/objdump.WL: Update.

gas * testsuite/gas/elf/dwarf2-11.d: Update expected output from
readelf's line table decoding.
* testsuite/gas/elf/dwarf2-12.d: Likewise.
* testsuite/gas/elf/dwarf2-13.d: Likewise.
* testsuite/gas/elf/dwarf2-14.d: Likewise.
* testsuite/gas/elf/dwarf2-15.d: Likewise.
* testsuite/gas/elf/dwarf2-16.d: Likewise.
* testsuite/gas/elf/dwarf2-17.d: Likewise.
* testsuite/gas/elf/dwarf2-18.d: Likewise.
* testsuite/gas/elf/dwarf2-19.d: Likewise.
* testsuite/gas/elf/dwarf2-5.d: Likewise.
* testsuite/gas/elf/dwarf2-6.d: Likewise.
* testsuite/gas/elf/dwarf2-7.d: Likewise.

17 files changed:
binutils/ChangeLog
binutils/dwarf.c
binutils/testsuite/binutils-all/dw5.W
binutils/testsuite/binutils-all/objdump.WL
gas/ChangeLog
gas/testsuite/gas/elf/dwarf2-11.d
gas/testsuite/gas/elf/dwarf2-12.d
gas/testsuite/gas/elf/dwarf2-13.d
gas/testsuite/gas/elf/dwarf2-14.d
gas/testsuite/gas/elf/dwarf2-15.d
gas/testsuite/gas/elf/dwarf2-16.d
gas/testsuite/gas/elf/dwarf2-17.d
gas/testsuite/gas/elf/dwarf2-18.d
gas/testsuite/gas/elf/dwarf2-19.d
gas/testsuite/gas/elf/dwarf2-5.d
gas/testsuite/gas/elf/dwarf2-6.d
gas/testsuite/gas/elf/dwarf2-7.d

index 9bb68e6991eec12fbba096160d4b08691427f80c..df8b90e095c0c116b61181b477bcc70bf3b4c0bd 100644 (file)
@@ -1,3 +1,10 @@
+2020-07-10  Tom de Vries  <tdevries@suse.de>
+
+       * dwarf.c (display_debug_lines_decoded): Don't emit meaningless
+       information in the end_sequence row.
+       * testsuite/binutils-all/dw5.W: Update.
+       * testsuite/binutils-all/objdump.WL: Update.
+
 2020-07-09  Alan Modra  <amodra@gmail.com>
 
        * dlltool.c: Remove powerpc PE support and comments.
index bdabd9c4baa015271916d09a3872fd5b28b36230..d739230a28efbf4145d4b717941fa0de79ed019d 100644 (file)
@@ -4988,38 +4988,75 @@ display_debug_lines_decoded (struct dwarf_section *  section,
                  strncpy (newFileName, fileName, fileNameLength + 1);
                }
 
+             /* A row with end_seq set to true has a meaningful address, but
+                the other information in the same row is not significant.
+                In such a row, print line as "-", and don't print
+                view/is_stmt.  */
              if (!do_wide || (fileNameLength <= MAX_FILENAME_LENGTH))
                {
                  if (linfo.li_max_ops_per_insn == 1)
-                   printf ("%-35s  %11d  %#18" DWARF_VMA_FMT "x",
-                           newFileName, state_machine_regs.line,
-                           state_machine_regs.address);
+                   {
+                     if (xop == -DW_LNE_end_sequence)
+                       printf ("%-35s  %11s  %#18" DWARF_VMA_FMT "x",
+                               newFileName, "-",
+                               state_machine_regs.address);
+                     else
+                       printf ("%-35s  %11d  %#18" DWARF_VMA_FMT "x",
+                               newFileName, state_machine_regs.line,
+                               state_machine_regs.address);
+                   }
                  else
-                   printf ("%-35s  %11d  %#18" DWARF_VMA_FMT "x[%d]",
-                           newFileName, state_machine_regs.line,
-                           state_machine_regs.address,
-                           state_machine_regs.op_index);
+                   {
+                     if (xop == -DW_LNE_end_sequence)
+                       printf ("%-35s  %11s  %#18" DWARF_VMA_FMT "x[%d]",
+                               newFileName, "-",
+                               state_machine_regs.address,
+                               state_machine_regs.op_index);
+                     else
+                       printf ("%-35s  %11d  %#18" DWARF_VMA_FMT "x[%d]",
+                               newFileName, state_machine_regs.line,
+                               state_machine_regs.address,
+                               state_machine_regs.op_index);
+                   }
                }
              else
                {
                  if (linfo.li_max_ops_per_insn == 1)
-                   printf ("%s  %11d  %#18" DWARF_VMA_FMT "x",
-                           newFileName, state_machine_regs.line,
-                           state_machine_regs.address);
+                   {
+                     if (xop == -DW_LNE_end_sequence)
+                       printf ("%s  %11s  %#18" DWARF_VMA_FMT "x",
+                               newFileName, "-",
+                               state_machine_regs.address);
+                     else
+                       printf ("%s  %11d  %#18" DWARF_VMA_FMT "x",
+                               newFileName, state_machine_regs.line,
+                               state_machine_regs.address);
+                   }                   
                  else
-                   printf ("%s  %11d  %#18" DWARF_VMA_FMT "x[%d]",
-                           newFileName, state_machine_regs.line,
-                           state_machine_regs.address,
-                           state_machine_regs.op_index);
+                   {
+                     if (xop == -DW_LNE_end_sequence)
+                       printf ("%s  %11s  %#18" DWARF_VMA_FMT "x[%d]",
+                               newFileName, "-",
+                               state_machine_regs.address,
+                               state_machine_regs.op_index);
+                     else
+                       printf ("%s  %11d  %#18" DWARF_VMA_FMT "x[%d]",
+                               newFileName, state_machine_regs.line,
+                               state_machine_regs.address,
+                               state_machine_regs.op_index);
+                   }
                }
 
-             if (state_machine_regs.view)
-               printf ("  %6u", state_machine_regs.view);
-             else
-               printf ("        ");
+             if (xop != -DW_LNE_end_sequence)
+               {
+                 if (state_machine_regs.view)
+                   printf ("  %6u", state_machine_regs.view);
+                 else
+                   printf ("        ");
 
-             if (state_machine_regs.is_stmt)
-               printf ("       x");
+                 if (state_machine_regs.is_stmt)
+                   printf ("       x");
+               }
 
              putchar ('\n');
              state_machine_regs.view++;
index 2eccb03c5a60a0f637ff1ce6b528bce65df450d6..ebeda6575d718cfcebdc883aa224d2af7cd8d3a7 100644 (file)
@@ -350,10 +350,10 @@ CU: ./main.c:
 File name                            Line number    Starting address    View    Stmt
 main.c                                         6              0x1234               x
 main.c                                         6             0x12346               x
-main.c                                         6              0x1234               x
+main.c                                         -              0x1234
 
 main.c                                         5              0x1234               x
 main.c                                         5              0x1234               x
-main.c                                         5              0x1234               x
+main.c                                         -              0x1234
 
 
index 954fb3e67f1dc9f207d084dbaf14cfca6564f79f..e16d5bad4374962d207282ffeb3223c23130466c 100644 (file)
@@ -12,5 +12,5 @@ file1\.c                                        1 .*
 
 \./dw2-decodedline\.c:\[\+\+\]
 dw2-decodedline\.c                              2 .*
-dw2-decodedline\.c                              2 .*
+dw2-decodedline\.c                              - .*
 
index 19b17c1f579ea83fa0852c87c04ec60e7c854c62..e107e990fa380c7393616108edce6a34805ef868 100644 (file)
@@ -1,3 +1,19 @@
+2020-07-10  Tom de Vries  <tdevries@suse.de>
+
+       * testsuite/gas/elf/dwarf2-11.d: Update expected output from
+       readelf's line table decoding.
+       * testsuite/gas/elf/dwarf2-12.d: Likewise.
+       * testsuite/gas/elf/dwarf2-13.d: Likewise.
+       * testsuite/gas/elf/dwarf2-14.d: Likewise.
+       * testsuite/gas/elf/dwarf2-15.d: Likewise.
+       * testsuite/gas/elf/dwarf2-16.d: Likewise.
+       * testsuite/gas/elf/dwarf2-17.d: Likewise.
+       * testsuite/gas/elf/dwarf2-18.d: Likewise.
+       * testsuite/gas/elf/dwarf2-19.d: Likewise.
+       * testsuite/gas/elf/dwarf2-5.d: Likewise.
+       * testsuite/gas/elf/dwarf2-6.d: Likewise.
+       * testsuite/gas/elf/dwarf2-7.d: Likewise.
+
 2020-07-09  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/tc-i386.c (output_insn): Set YMM/ZMM features for
index fbe11627d1be73011a9b7daf93a9ef15d7692412..2c30e55c695a945582e5a28f43f1375c641e942d 100644 (file)
@@ -11,4 +11,4 @@ CU: dwarf2-11\.c:
 File name +Line number +Starting address +View +Stmt
 dwarf2-11\.c +1 +0x8 +x
 dwarf2-11\.c +2 +0x10 +x
-dwarf2-11\.c +2 +0x10 +1 +x
+dwarf2-11\.c +- +0x10
index eaa22e47ce449ba7d6fc832b4b57a878379b09e5..3acac91fcd979c457ff62d1a609461567a67a1f4 100644 (file)
@@ -15,4 +15,4 @@ File name +Line number +Starting address +View +Stmt
 dwarf2-12\.c +1 +0 +x
 dwarf2-12\.c +2 +0 +x
 dwarf2-12\.c +3 +0 +1 +x
-dwarf2-12\.c +3 +0x8 +x
+dwarf2-12\.c +- +0x8
index fd1f0585ffa02a9346b0b1bac1b700db292e7431..3ba269fdaec95bc715bf12c01fbd67733d880870 100644 (file)
@@ -15,4 +15,4 @@ File name +Line number +Starting address +View +Stmt
 dwarf2-13\.c +1 +0x8 +x
 dwarf2-13\.c +2 +0x10 +x
 dwarf2-13\.c +3 +0x10 +1 +x
-dwarf2-13\.c +3 +0x18 +x
+dwarf2-13\.c +- +0x18
index c94e4a81d188d75a807ed960100546ca668a2e8a..232a50ad47fdc49fe85189c021e13a82e6451714 100644 (file)
@@ -15,4 +15,4 @@ File name +Line number +Starting address +View +Stmt
 dwarf2-14\.c +1 +0 +x
 dwarf2-14\.c +2 +0 +x
 dwarf2-14\.c +3 +0 +1 +x
-dwarf2-14\.c +3 +0x8 +x
+dwarf2-14\.c +- +0x8
index f4af8a827757d93218c294b410923c92e8e95b73..939c61598cb2e1bf9810892b3428006363985b71 100644 (file)
@@ -15,4 +15,4 @@ File name +Line number +Starting address +View +Stmt
 dwarf2-15\.c +1 +0 +x
 dwarf2-15\.c +2 +0x8 +x
 dwarf2-15\.c +3 +0x8 +1 +x
-dwarf2-15\.c +3 +0x10 +x
+dwarf2-15\.c +- +0x10
index f7cdddbcaa11f9da0985c114bb47da72fd5427ea..8e35d49361933fd885714eb8524495d614e9a52a 100644 (file)
@@ -16,4 +16,4 @@ File name +Line number +Starting address +View +Stmt
 dwarf2-16\.c +1 +0 +x
 dwarf2-16\.c +2 +0x8 +x
 dwarf2-16\.c +3 +0x8 +1 +x
-dwarf2-16\.c +3 +0x10 +x
+dwarf2-16\.c +- +0x10
index 2eb1e66d3ab0d8be064c1820a4f06117e5f93cd8..881477cf95b97bda74623f0a25ab3e32ddd24cb6 100644 (file)
@@ -16,4 +16,4 @@ File name +Line number +Starting address +View  +Stmt
 dwarf2-17\.c +1 +0 +x
 dwarf2-17\.c +2 +0x8 +x
 dwarf2-17\.c +3 +0x10 +x
-dwarf2-17\.c +3 +0x18 +x
+dwarf2-17\.c +- +0x18
index 81a075c16a225b14aa9f0e0a4f9c436e7d97a32f..db7a4f9f20b5d83df5bc94ae62d991e32f164ee3 100644 (file)
@@ -16,4 +16,4 @@ File name +Line number +Starting address +View  +Stmt
 dwarf2-18\.c +1 +0 +x
 dwarf2-18\.c +2 +0 +1 +x
 dwarf2-18\.c +3 +0x8 +x
-dwarf2-18\.c +3 +0x10 +x
+dwarf2-18\.c +- +0x10
index dd70dd3836556f29bab4cfb6ee68c17b725dc2e5..55d0caf4cb1122e83f835723bfb45c9483504cbc 100644 (file)
@@ -18,4 +18,4 @@ dwarf2-19\.c +2 +0 +1 +x
 dwarf2-19\.c +4 +0x8 +x
 dwarf2-19\.c +5 +0x8 +1 +x
 dwarf2-19\.c +3 +0x8 +2 +x
-dwarf2-19\.c +3 +0x8 +3 +x
+dwarf2-19\.c +- +0x8
index 59f458db46da8bbaacaa4967d9b09e39635a0c1d..4e22e79c644e7b3b4ed8f8ceb1b7954bfbe5aa23 100644 (file)
@@ -75,4 +75,4 @@ dwarf2-5\.c +9 +0x20 +x
 dwarf2-5\.c +10 +0x20 +1 +x
 dwarf2-5\.c +11 +0x20 +2 +x
 dwarf2-5\.c +12 +0x20 +3 +x
-dwarf2-5\.c +12 +0x28 +x
+dwarf2-5\.c +- +0x28
index 5bcbc8897d7883b0c0fe2f826f6075420244099b..10fe2374dd76a639376524fb0c6eed3092724b1e 100644 (file)
@@ -75,4 +75,4 @@ dwarf2-6\.c  *2  *0x3  *2 +x
 dwarf2-6\.c  *3  *0x4 +x
 dwarf2-6\.c  *3  *0x4  *1 +x
 dwarf2-6\.c  *3  *0xf3 +x
-dwarf2-6\.c  *3  *0x100 +x
+dwarf2-6\.c  *-  *0x100
index 59a22d0188d028eff45f5c5ffdf1fa37bc5a788e..9df320bb4ebd4143b21918435d041a3ecc38c4a4 100644 (file)
@@ -15,4 +15,4 @@ File name +Line number +Starting address +View +Stmt
 dwarf2-7\.c +1 +0 +x
 dwarf2-7\.c +2 +0 +x
 dwarf2-7\.c +3 +0 +1 +x
-dwarf2-7\.c +3 +0x8 +x
+dwarf2-7\.c +- +0x8