mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-25 04:11:42 -04:00
add sigbus & print the crashlog
This commit is contained in:
parent
dd7e18fb57
commit
4c4be3657a
1 changed files with 5 additions and 1 deletions
|
@ -56,6 +56,7 @@ static std::string_view getSignalCodeString() {
|
|||
}
|
||||
case SIGTERM: return "SIGTERM: a termination request was sent to the program";
|
||||
case SIGABRT: return "SIGABRT: usually caused by an abort() or assert()";
|
||||
case SIGBUS: return "SIGBUS: Bus error (bad memory access)";
|
||||
default: return "Unknown signal code";
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +251,7 @@ static std::string getStacktrace() {
|
|||
stream >> std::hex >> address >> std::dec;
|
||||
|
||||
if (!line.empty()) {
|
||||
stacktrace << " @ " << std::showbase << std::hex << address << std::dec;
|
||||
stacktrace << " - " << std::showbase << std::hex << address << std::dec;
|
||||
stacktrace << ": " << line << "\n";
|
||||
}
|
||||
else {
|
||||
|
@ -328,6 +329,8 @@ static void handlerThread() {
|
|||
}
|
||||
|
||||
auto text = crashlog::writeCrashlog(faultyMod, getInfo(signalAddress, faultyMod), getStacktrace(), getRegisters());
|
||||
|
||||
log::error("Geode crashed!\n{}" + text);
|
||||
|
||||
s_signal = 0;
|
||||
s_cv.notify_all();
|
||||
|
@ -347,6 +350,7 @@ bool crashlog::setupPlatformHandler() {
|
|||
sigaction(SIGILL, &action, nullptr);
|
||||
sigaction(SIGTERM, &action, nullptr);
|
||||
sigaction(SIGABRT, &action, nullptr);
|
||||
sigaction(SIGBUS, &action, nullptr);
|
||||
|
||||
std::thread(&handlerThread).detach();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue