Modified error handling for display library option 'gui_debug'.

If Bochs debugger is not present now showing an error message box instead of a BX_PANIC for unknown option.
This commit is contained in:
Volker Ruppert 2023-11-19 16:16:09 +01:00
parent a923880b47
commit a9a15d332b
4 changed files with 17 additions and 9 deletions

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2021 The Bochs Project
// Copyright (C) 2002-2023 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -545,8 +545,8 @@ void bx_sdl_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
} else if (!strcmp(argv[i], "nokeyrepeat")) {
BX_INFO(("disabled host keyboard repeat"));
SDL_EnableKeyRepeat(0, 0);
#if BX_DEBUGGER && BX_DEBUGGER_GUI
} else if (!strcmp(argv[i], "gui_debug")) {
#if BX_DEBUGGER && BX_DEBUGGER_GUI
SIM->set_debug_gui(1);
#ifdef WIN32
if (gui_ci) {
@ -559,6 +559,8 @@ void bx_sdl_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
#else
init_debug_dialog();
#endif
#else
SIM->message_box("ERROR", "Bochs debugger not available - ignoring 'gui_debug' option");
#endif
#if BX_SHOW_IPS
} else if (!strcmp(argv[i], "hideIPS")) {

View File

@ -2,7 +2,7 @@
// $Id$
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014-2021 The Bochs Project
// Copyright (C) 2014-2023 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@ -476,8 +476,8 @@ void bx_sdl2_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
} else if (!strcmp(argv[i], "nokeyrepeat")) {
BX_INFO(("disabled host keyboard repeat"));
sdl_nokeyrepeat = 1;
#if BX_DEBUGGER && BX_DEBUGGER_GUI
} else if (!strcmp(argv[i], "gui_debug")) {
#if BX_DEBUGGER && BX_DEBUGGER_GUI
SIM->set_debug_gui(1);
#ifdef WIN32
if (gui_ci) {
@ -490,6 +490,8 @@ void bx_sdl2_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
#else
init_debug_dialog();
#endif
#else
SIM->message_box("ERROR", "Bochs debugger not available - ignoring 'gui_debug' option");
#endif
#if BX_SHOW_IPS
} else if (!strcmp(argv[i], "hideIPS")) {

View File

@ -665,14 +665,16 @@ void bx_win32_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
} else if (!strcmp(argv[i], "traphotkeys")) {
BX_INFO(("trap system hotkeys for Bochs window"));
win32_traphotkeys = 1;
#if BX_DEBUGGER && BX_DEBUGGER_GUI
} else if (!strcmp(argv[i], "gui_debug")) {
#if BX_DEBUGGER && BX_DEBUGGER_GUI
if (gui_ci) {
gui_debug = TRUE;
SIM->set_debug_gui(1);
} else {
BX_PANIC(("Config interface 'win32config' is required for gui debugger"));
}
#else
SIM->message_box("ERROR", "Bochs debugger not available - ignoring 'gui_debug' option");
#endif
#if BX_SHOW_IPS
} else if (!strcmp(argv[i], "hideIPS")) {
@ -1778,11 +1780,11 @@ int bx_win32_gui_c::get_clipboard_text(Bit8u **bytes, Bit32s *nbytes)
if (OpenClipboard(stInfo.simWnd)) {
HGLOBAL hg = GetClipboardData(CF_TEXT);
char *data = (char *)GlobalLock(hg);
*nbytes = strlen(data);
*nbytes = (Bit32s)strlen(data);
*bytes = new Bit8u[1 + *nbytes];
BX_INFO (("found %d bytes on the clipboard", *nbytes));
BX_INFO(("found %d bytes on the clipboard", *nbytes));
memcpy (*bytes, data, *nbytes+1);
BX_INFO (("first byte is 0x%02x", *bytes[0]));
BX_INFO(("first byte is 0x%02x", *bytes[0]));
GlobalUnlock(hg);
CloseClipboard();
return 1;

View File

@ -610,9 +610,11 @@ void bx_x_gui_c::specific_init(int argc, char **argv, unsigned headerbar_y)
if (!strcmp(argv[i], "nokeyrepeat")) {
BX_INFO(("disabled host keyboard repeat"));
x11_nokeyrepeat = 1;
#if BX_DEBUGGER && BX_DEBUGGER_GUI
} else if (!strcmp(argv[i], "gui_debug")) {
#if BX_DEBUGGER && BX_DEBUGGER_GUI
x11_with_debug_gui = 1;
#else
SIM->message_box("ERROR", "Bochs debugger not available - ignoring 'gui_debug' option");
#endif
#if BX_SHOW_IPS
} else if (!strcmp(argv[i], "hideIPS")) {