This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] nm: Handle dwarf_linesrc returning NULL.


https://bugzilla.redhat.com/show_bug.cgi?id=1170810#32

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 src/nm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/nm.c b/src/nm.c
index b6a1e6e..7d20bbb 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);
-- 
2.1.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]