]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR 21408, segfault in display_debug_lines_decoded
authorAlan Modra <amodra@gmail.com>
Sun, 23 Apr 2017 04:19:50 +0000 (13:49 +0930)
committerAlan Modra <amodra@gmail.com>
Sun, 23 Apr 2017 11:02:40 +0000 (20:32 +0930)
PR 21408
* dwarf.c (display_debug_lines_decoded): Don't segfault on NULL
file_table.

binutils/ChangeLog
binutils/dwarf.c

index e833b0554044414f7520c30cc804a854822dba14..a19d488673fdfe81a3ef6538deff7caa1b94cd75 100644 (file)
@@ -1,3 +1,9 @@
+2017-04-23  Alan Modra  <amodra@gmail.com>
+
+       PR 21408
+       * dwarf.c (display_debug_lines_decoded): Don't segfault on NULL
+       file_table.
+
 2017-04-21  Nick Clifton  <nickc@redhat.com>
 
        PR binutils/21378
index 559d6f8bb977b2fada04eb78515125b06ea7ac33..bb141e41fa9dd7d6d0f501fe2d3332f1663f1e0b 100644 (file)
@@ -3808,11 +3808,10 @@ display_debug_lines_decoded (struct dwarf_section *section,
            }
 
          /* Print the Compilation Unit's name and a header.  */
-         if (directory_table == NULL)
-           {
-             printf (_("CU: %s:\n"), file_table[0].name);
-             printf (_("File name                            Line number    Starting address\n"));
-           }
+         if (file_table == NULL)
+           ;
+         else if (directory_table == NULL)
+           printf (_("CU: %s:\n"), file_table[0].name);
          else
            {
              unsigned int ix = file_table[0].directory_index;
@@ -3836,10 +3835,9 @@ display_debug_lines_decoded (struct dwarf_section *section,
                printf (_("CU: %s/%s:\n"), directory, file_table[0].name);
              else
                printf ("%s:\n", file_table[0].name);
-
-             printf (_("File name                            Line number    Starting address\n"));
            }
 
+         printf (_("File name                            Line number    Starting address\n"));
          saved_linfo = linfo;
        }