From 05954ee5bfac1b6f573849ea3d03a3bb84a94ed6 Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Wed, 27 Nov 2024 23:44:56 +0100 Subject: [PATCH] fixed segfault that happen when Bochs has configuration error and binary is compiled with debugger support solves the issue #397 --- bochs/bx_debug/dbg_main.cc | 4 ---- bochs/main.cc | 11 ++--------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/bochs/bx_debug/dbg_main.cc b/bochs/bx_debug/dbg_main.cc index 6504492042..83b88cb1bf 100644 --- a/bochs/bx_debug/dbg_main.cc +++ b/bochs/bx_debug/dbg_main.cc @@ -793,10 +793,6 @@ void bx_dbg_exit(int code) fclose(debugger_log); debugger_log = NULL; - for (int cpu=0; cpu < BX_SMP_PROCESSORS; cpu++) { - if (BX_CPU(cpu)) BX_CPU(cpu)->atexit(); - } - delete [] dbg_cpu_list; dbg_cpu_list = NULL; diff --git a/bochs/main.cc b/bochs/main.cc index 5f5d9cb3d2..1f71904c1b 100644 --- a/bochs/main.cc +++ b/bochs/main.cc @@ -1378,15 +1378,8 @@ int bx_atexit(void) // so that the user can see any messages left behind on the console. SIM->set_display_mode(DISP_MODE_CONFIG); -#if BX_DEBUGGER == 0 - if (SIM && SIM->get_init_done()) { - for (int cpu=0; cpuatexit(); - } -#endif + for (int cpu=0; cpuatexit(); BX_MEM(0)->cleanup_memory();