summaryrefslogtreecommitdiff
path: root/src/nm.c
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2015-05-06 12:45:49 +0200
committerMark Wielaard <mjw@redhat.com>2015-05-12 16:41:05 +0200
commita3344c7a785888ecd31475efaaf456db41897423 (patch)
treedcaf41838f0ce38640adf7fcbd209e06685d127f /src/nm.c
parentae02916ba11547418c749ab0bebeb59c6094b96c (diff)
downloadelfutils-a3344c7a785888ecd31475efaaf456db41897423.tar.gz
nm: Handle dwarf_linesrc returning NULL.
https://bugzilla.redhat.com/show_bug.cgi?id=1170810#32 Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'src/nm.c')
-rw-r--r--src/nm.c7
1 files changed, 3 insertions, 4 deletions
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);