summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog4
-rw-r--r--src/nm.c7
2 files changed, 7 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a7cdc3e5..7a44fc6e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-05 Mark Wielaard <mjw@redhat.com>
+
+ * nm.c (show_symbols): Handle dwarf_linesrc returning NULL.
+
2015-05-04 Max Filippov <jcmvbkbc@gmail.com>
* ar.c (do_oper_extract): Replace struct timeval with struct timespec
diff --git a/src/nm.c b/src/nm.c
index b6a1e6eb..7d20bbbd 100644
--- a/src/nm.c
+++ b/src/nm.c
@@ -1297,11 +1297,10 @@ show_symbols (Ebl *ebl, GElf_Ehdr *ehdr, Elf_Scn *scn, Elf_Scn *xndxscn,
/* We found the line. */
int lineno;
(void) dwarf_lineno (line, &lineno);
+ const char *file = dwarf_linesrc (line, NULL, NULL);
+ file = (file != NULL) ? basename (file) : "???";
int n;
- n = obstack_printf (&whereob, "%s:%d%c",
- basename (dwarf_linesrc (line,
- NULL,
- NULL)),
+ n = obstack_printf (&whereob, "%s:%d%c", file,
lineno, '\0');
sym_mem[nentries_used].where
= obstack_finish (&whereob);