]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
tests: Don't printf a known NULL symname.
authorMark Wielaard <mark@klomp.org>
Tue, 30 Apr 2019 18:36:39 +0000 (20:36 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 30 Apr 2019 18:36:39 +0000 (20:36 +0200)
GCC9 on 32bit systems might warn about '%s' directive argument is null
for symname in backtrace.c. Just check whether symname is NULL.

Signed-off-by: Mark Wielaard <mark@klomp.org>
tests/ChangeLog
tests/backtrace.c

index 71aa178d3e341a027d5c1513075eee0b23b74435..a4f5dd3edbacb7b76c064cc9f4b0408c4797e5d9 100644 (file)
@@ -1,3 +1,7 @@
+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>
 
        * backtrace.c (tgkill): Remove define.
index ecf55830646234a2699d9b5e973ade0fa37b7d25..36c8b8c45079162427492fd4d1987cd27989568c 100644 (file)
@@ -185,7 +185,7 @@ frame_callback (Dwfl_Frame *state, void *frame_arg)
     symname = dwfl_module_addrname (mod, pc_adjusted);
 
   printf ("#%2d %#" PRIx64 "%4s\t%s\n", *framenop, (uint64_t) pc,
-         ! isactivation ? "- 1" : "", symname);
+         ! isactivation ? "- 1" : "", symname ?: "<null>");
   pid_t tid = dwfl_thread_tid (thread);
   callback_verify (tid, *framenop, pc, symname, dwfl);
   (*framenop)++;