diff options
author | Mark Wielaard <mjw@redhat.com> | 2015-05-06 12:45:49 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2015-05-12 16:41:05 +0200 |
commit | a3344c7a785888ecd31475efaaf456db41897423 (patch) | |
tree | dcaf41838f0ce38640adf7fcbd209e06685d127f | |
parent | ae02916ba11547418c749ab0bebeb59c6094b96c (diff) | |
download | elfutils-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>
-rw-r--r-- | src/ChangeLog | 4 | ||||
-rw-r--r-- | src/nm.c | 7 |
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 @@ -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); |