From 81ed54d13ecea920583c521373d2a6079fc67040 Mon Sep 17 00:00:00 2001 From: yzct12345 <87620833+yzct12345@users.noreply.github.com> Date: Fri, 13 Aug 2021 18:58:35 +0000 Subject: logging: Display backtrace on crash This implements backtraces so we don't have to tell users how to use gdb anymore. This prints a backtrace after abort or segfault is detected. It also fixes the log getting cut off with the last line containing only a bracket. This change lets us know what caused a crash not just what happened the few seconds before it. I only know how to add support for Linux with GCC. Also this doesn't work outside of C/C++ such as in dynarmic or certain parts of graphics drivers. The good thing is that it'll try and just crash again but the stack frames are still there so the core dump will work just like before. --- src/common/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/common/CMakeLists.txt') diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 57922b51c..316c4dedc 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -176,3 +176,6 @@ if (MSVC) else() target_link_libraries(common PRIVATE zstd) endif() +if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND CMAKE_CXX_COMPILER_ID STREQUAL GNU) + target_link_libraries(common PRIVATE backtrace) +endif() -- cgit v1.2.3