Skip to content

Commit

Permalink
Proper check for signal frames
Browse files Browse the repository at this point in the history
  • Loading branch information
BenBE committed Oct 30, 2023
1 parent a06ff08 commit 7059ea3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions CRT.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 7059ea3

Please sign in to comment.