SIGINT invokes the built-in debugger.

This commit is contained in:
Maxim Poliakovski 2021-08-19 11:29:44 +02:00
parent a8f400287a
commit c5f45c6f9a
1 changed files with 13 additions and 2 deletions

View File

@ -29,6 +29,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "utils/profiler.h"
#include "ppcemu.h"
#include <cinttypes>
#include <csignal>
#include <cstring>
#include <fstream>
#include <iostream>
@ -40,6 +41,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
using namespace std;
void sigint_handler(int signum) {
enter_debugger();
LOG_F(INFO, "Shutting down...");
delete gMachineObj.release();
exit(0);
}
static string appDescription = string(
"\nDingusPPC - Prototype 5bf5 (8/23/2020) "
"\nWritten by divingkatae and maximumspatium "
@ -118,10 +128,8 @@ int main(int argc, char** argv) {
loguru::init(argc, argv);
loguru::add_file("dingusppc.log", loguru::Append, 0);
} else {
loguru::g_preamble_uptime = false;
loguru::g_stderr_verbosity = loguru::Verbosity_INFO;
loguru::init(argc, argv);
loguru::add_file("exceptions.log", loguru::Truncate, -7);
}
if (*machine_opt) {
@ -163,6 +171,9 @@ int main(int argc, char** argv) {
goto bail;
}
// redirect SIGINT to our own handler
signal(SIGINT, sigint_handler);
#ifdef SDL
if (SDL_Init(SDL_INIT_AUDIO)){
LOG_F(ERROR, "SDL_Init error: %s", SDL_GetError());