From fc6a4872d6e35266d3b237fbf83b57fc07b85586 Mon Sep 17 00:00:00 2001 From: Mihai Parparita Date: Sat, 9 Mar 2024 11:56:43 -0800 Subject: [PATCH] Ensure that NVRAM is persisted when exiting the debugger after an abort The SIGABRT handler is not invoked by the abort() call in the loguru fatal handler, but either way it's not necessary (it does its own abort). Switch to explicitly cleaning up the machine object, which as a side effect in the destructor chain will persist the NVRAM. --- main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 53ecd2e..8a2a7ed 100644 --- a/main.cpp +++ b/main.cpp @@ -176,7 +176,8 @@ int main(int argc, char** argv) { power_off_reason = po_enter_debugger; enter_debugger(); - abort(); + // Ensure that NVRAM and other state is persisted before we terminate. + delete gMachineObj.release(); }); // redirect SIGINT to our own handler