Last active
April 23, 2024 10:59
-
-
Save Trass3r/589d07f36fd5a431331c2181731ed51d to your computer and use it in GitHub Desktop.
boost stacktrace enabler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define BOOST_STACKTRACE_USE_ADDR2LINE 1 | |
//#define BOOST_STACKTRACE_USE_BACKTRACE 1 | |
#include <boost/stacktrace.hpp> | |
#include <signal.h> // ::signal, ::raise | |
void my_signal_handler(int signum) | |
{ | |
::signal(signum, SIG_DFL); | |
// boost::stacktrace::safe_dump_to("./backtrace.dump"); | |
std::cout << boost::stacktrace::stacktrace(); | |
::raise(SIGABRT); | |
} | |
int main(int argc, char* argv[]) | |
{ | |
::signal(SIGSEGV, &my_signal_handler); | |
::signal(SIGABRT, &my_signal_handler); | |
pthread_setname_np(pthread_self(), "MainThread"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#target_compile_definitions(${TARGET} PRIVATE BOOST_STACKTRACE_USE_BACKTRACE) | |
target_link_libraries(${TARGET} PRIVATE dl) | |
#target_link_libraries(${TARGET} PRIVATE backtrace) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment