diff --git a/src/Common/ExceptionHandler/ExceptionHandler_posix.cpp b/src/Common/ExceptionHandler/ExceptionHandler_posix.cpp index 61809680..9e418307 100644 --- a/src/Common/ExceptionHandler/ExceptionHandler_posix.cpp +++ b/src/Common/ExceptionHandler/ExceptionHandler_posix.cpp @@ -10,6 +10,10 @@ #include "ELFSymbolTable.h" #endif +#if __ANDROID__ +#include +#endif // __ANDROID__ + #if BOOST_OS_LINUX void DemangleAndPrintBacktrace(char** backtrace, size_t size) { @@ -61,7 +65,6 @@ void DemangleAndPrintBacktrace(char** backtrace, size_t size) // handle signals that would dump core, print stacktrace and then dump depending on config void handlerDumpingSignal(int sig, siginfo_t *info, void *context) { -#if !__ANDROID__ if(!CrashLog_Create()) return; // give up if crashlog was already created @@ -75,7 +78,10 @@ void handlerDumpingSignal(int sig, siginfo_t *info, void *context) // should never be the case printf("Unknown core dumping signal!\n"); } - + CrashLog_WriteLine(fmt::format("Error: signal {}:", sig)); +#if __ANDROID__ + CrashLog_WriteLine(to_string(boost::stacktrace::stacktrace())); +#else void* backtraceArray[128]; size_t size; @@ -87,8 +93,6 @@ void handlerDumpingSignal(int sig, siginfo_t *info, void *context) backtraceArray[0] = (void *)uc->uc_mcontext.gregs[REG_RIP]; #endif - CrashLog_WriteLine(fmt::format("Error: signal {}:", sig)); - #if BOOST_OS_LINUX char** symbol_trace = backtrace_symbols(backtraceArray, size); @@ -104,6 +108,7 @@ void handlerDumpingSignal(int sig, siginfo_t *info, void *context) #else backtrace_symbols_fd(backtraceArray, size, STDERR_FILENO); #endif +#endif // __ANDROID__ std::cerr << fmt::format("\nStacktrace and additional info written to:") << std::endl; std::cerr << cemuLog_GetLogFilePath().generic_string() << std::endl; @@ -119,7 +124,6 @@ void handlerDumpingSignal(int sig, siginfo_t *info, void *context) raise(sig); return; } -#endif // __ANDROID__ // exit process ignoring all issues _Exit(1); } diff --git a/vcpkg.json b/vcpkg.json index 8ddc07d3..8bec5d9e 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -35,6 +35,10 @@ "name": "boost-iostreams", "platform" : "android" }, + { + "name": "boost-stacktrace", + "platform" : "android" + }, "boost-random", "fmt", "libpng",