public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED] tests: Don't printf a known NULL symname in backtrace-dwarf.c.
@ 2019-05-01 13:30 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2019-05-01 13:30 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Mark Wielaard

GCC9 on 32bit systems might warn about '%s' directive argument is null
for symname in backtrace-dwarf.c. Just check whether symname is NULL.

This is an identical fix for the same issue as found in backtrace.c,
but now in backtrace-dwarf.c

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 tests/ChangeLog         | 5 +++++
 tests/backtrace-dwarf.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index a4f5dd3..d6dafa4 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,10 @@
 2019-04-30  Mark Wielaard  <mark@klomp.org>
 
+	* backtrace-dwarf.c (frame_callback): Explicitly check symname is
+	NULL.
+
+2019-04-30  Mark Wielaard  <mark@klomp.org>
+
 	* backtrace.c (frame_callback): Explicitly check symname is NULL.
 
 2019-03-04  Mark Wielaard  <mark@klomp.org>
diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c
index dfbf185..f446bc3 100644
--- a/tests/backtrace-dwarf.c
+++ b/tests/backtrace-dwarf.c
@@ -101,7 +101,7 @@ frame_callback (Dwfl_Frame *state, void *frame_arg)
   if (mod)
     symname = dwfl_module_addrname (mod, pc_adjusted);
 
-  printf ("%#" PRIx64 "\t%s\n", (uint64_t) pc, symname);
+  printf ("%#" PRIx64 "\t%s\n", (uint64_t) pc, symname ?: "<null>");
 
   if (symname && (strcmp (symname, "main") == 0
 		  || strcmp (symname, ".main") == 0))
-- 
1.8.3.1

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

only message in thread, other threads:[~2019-05-01 13:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-01 13:30 [COMMITTED] tests: Don't printf a known NULL symname in backtrace-dwarf.c Mark Wielaard

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).