Skip to content

Commit 3ff53d2

Browse files
committed
Stack traces: backtrace_symbols() is fine to use on both Linux/MacOS, no need to print the raw addresses separatly
1 parent 67231e9 commit 3ff53d2

1 file changed

Lines changed: 0 additions & 13 deletions

File tree

Quake/sys_sdl_unix.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -399,18 +399,6 @@ const char *Sys_StackTrace (void)
399399

400400
int nb_frames = backtrace (buffer, MAX_STACK_FRAMES);
401401

402-
// display on 1 line to pass to addr2line easily:
403-
for (int frame_index = 0; frame_index < nb_frames; frame_index++)
404-
{
405-
q_snprintf (output_buffer + strnlen (output_buffer, OUTPUT_BUFFER_SIZE), OUTPUT_BUFFER_SIZE, "0x%" PRIxPTR " ", (uintptr_t)buffer[frame_index]);
406-
if (frame_index == nb_frames - 1)
407-
q_snprintf (output_buffer + strnlen (output_buffer, OUTPUT_BUFFER_SIZE), OUTPUT_BUFFER_SIZE, "\n");
408-
}
409-
410-
// Then print 1 frame per line, together with its symbol using backtrace_symbols()
411-
// This is not working on MacOS, skip it and only rely on addr2line to solve addresses
412-
#if !defined(PLATFORM_OSX)
413-
414402
char **symbols = backtrace_symbols (buffer, nb_frames);
415403

416404
for (int frame_index = 0; frame_index < nb_frames; frame_index++)
@@ -422,7 +410,6 @@ const char *Sys_StackTrace (void)
422410
}
423411

424412
free (symbols);
425-
#endif
426413

427414
return output_buffer;
428415

0 commit comments

Comments
 (0)