summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-04-23 13:49:50 +0930
committerAlan Modra <amodra@gmail.com>2017-04-23 20:32:40 +0930
commitf082820db966c79e47a143da774700055a1fad41 (patch)
tree2027e315385c3c1f904dc5c81900ca5b787ac494
parentb43eea27e99f5fd270b3bec455054ea53ac700bb (diff)
downloadbinutils-gdb-f082820db966c79e47a143da774700055a1fad41.tar.gz
PR 21408, segfault in display_debug_lines_decoded
PR 21408 * dwarf.c (display_debug_lines_decoded): Don't segfault on NULL file_table.
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/dwarf.c12
2 files changed, 11 insertions, 7 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index e833b055404..a19d488673f 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 559d6f8bb97..bb141e41fa9 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -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;
}