From 7059ea3ef7fe242fa1d248f67eafcf82fc03e12f Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Mon, 30 Oct 2023 19:44:34 +0100 Subject: [PATCH] Proper check for signal frames --- CRT.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CRT.c b/CRT.c index 05acc92ac..68020e374 100644 --- a/CRT.c +++ b/CRT.c @@ -1165,11 +1165,10 @@ static void print_backtrace(void) { #endif } - const char* frame = ""; - if (unw_is_signal_frame(&cursor) > 0) - frame = "{signal frame}"; + const bool is_signal_frame = unw_is_signal_frame(&cursor) > 0; + const char* frame = is_signal_frame ? " {signal frame}" : ""; - fprintf(stderr, "%2u: %#14lx %s (%s+%#lx) [%p]%s%s\n", item++, pc, fname, symbolName, offset, ptr, frame ? " " : "", frame); + fprintf(stderr, "%2u: %#14lx %s (%s+%#lx) [%p]%s\n", item++, pc, fname, symbolName, offset, ptr, frame); } #elif defined(HAVE_EXECINFO_H) void* backtraceArray[256];