public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PR 21408, segfault in display_debug_lines_decoded
@ 2017-04-23 11:48 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2017-04-23 11:48 UTC (permalink / raw)
  To: binutils

	PR 21408
	* dwarf.c (display_debug_lines_decoded): Don't segfault on NULL
	file_table.

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index e833b05..a19d488 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 559d6f8..bb141e4 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;
 	}
 

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-23 11:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-23 11:48 PR 21408, segfault in display_debug_lines_decoded Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).