diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2025-04-09 17:16:32 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-09 11:16:32 +0200 |
| commit | c9b6b5fbe0888f443a080c43fc38a215fddb42b3 (patch) | |
| tree | 4cc4b7dfa769110faeb7a778dcaa3b4a8d3928d9 /src/libtools/signals.c | |
| parent | 62765f151a2fcd5c1bd4fe5d46fc6277d3a1bee3 (diff) | |
| download | box64-c9b6b5fbe0888f443a080c43fc38a215fddb42b3.tar.gz box64-c9b6b5fbe0888f443a080c43fc38a215fddb42b3.zip | |
Added backtrace.h for holding backtrace-related functions (#2515)
Diffstat (limited to 'src/libtools/signals.c')
| -rw-r--r-- | src/libtools/signals.c | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/src/libtools/signals.c b/src/libtools/signals.c index 5190515e..62081432 100644 --- a/src/libtools/signals.c +++ b/src/libtools/signals.c @@ -18,6 +18,7 @@ #endif #include "os.h" +#include "backtrace.h" #include "box64context.h" #include "debug.h" #include "x64emu.h" @@ -1893,9 +1894,9 @@ dynarec_log(/*LOG_DEBUG*/LOG_INFO, "%04d|Repeated SIGSEGV with Access error on % if((BOX64ENV(showbt) || sig==SIGABRT) && log_minimum<=BOX64ENV(log)) { // show native bt - showNativeBT(log_minimum); + ShowNativeBT(log_minimum); - #define BT_BUF_SIZE 100 +#define BT_BUF_SIZE 100 int nptrs; void *buffer[BT_BUF_SIZE]; char **strings; @@ -2587,35 +2588,6 @@ EXPORT int my_swapcontext(x64emu_t* emu, void* ucp1, void* ucp2) return 0; } -void showNativeBT(int log_minimum) -{ -#ifndef ANDROID - // grab current name - // and temporarily rename binary to original box64 - // to get exact backtrace - size_t boxpath_lenth = strlen(my_context->box64path)+1; - char current_name[boxpath_lenth]; - memcpy(current_name, my_context->orig_argv[0], boxpath_lenth); - memcpy(my_context->orig_argv[0], my_context->box64path, boxpath_lenth); - // show native bt - #define BT_BUF_SIZE 100 - int nptrs; - void *buffer[BT_BUF_SIZE]; - char **strings; - - nptrs = backtrace(buffer, BT_BUF_SIZE); - strings = backtrace_symbols(buffer, nptrs); - if(strings) { - for (int j = 0; j < nptrs; j++) - printf_log(log_minimum, "NativeBT: %s\n", strings[j]); - free(strings); - } else - printf_log(log_minimum, "NativeBT: none (%d/%s)\n", errno, strerror(errno)); - // restore modified name - memcpy(my_context->box64path, my_context->orig_argv[0], boxpath_lenth); -#endif -} - #ifdef USE_SIGNAL_MUTEX static void atfork_child_dynarec_prot(void) { |