SHA256
1
0
forked from pool/elfutils
elfutils/gcc9-tests-Don-t-printf-a-known-NULL-symname.patch
2019-05-07 09:47:39 +00:00

31 lines
1.0 KiB
Diff

From 6978871366465aac849a303b2ea05ff5ab602261 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Tue, 30 Apr 2019 20:36:39 +0200
Subject: [PATCH] tests: Don't printf a known NULL symname.
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 | 4 ++++
tests/backtrace.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/tests/backtrace.c b/tests/backtrace.c
index ecf55830..36c8b8c4 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -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)++;
--
2.21.0