Skip to content

Commit f4fcc02

Browse files
committed
Added new bochsrc option 'debugger' to set parameters for the Bochs debugger.
- Parameter 'log' replaces the 'debugger_log' option. - Parameter 'gui' is a replacement for the already removed 'gui_debug' option. Now the debugger gui can be activated either with '-dbg_gui' command line option or with '-dbg' in combination with this parameter set to 'true'. This should fix issue #532. TODO: Some more debugger settings could be added there.
1 parent 1519744 commit f4fcc02

File tree

4 files changed

+91
-46
lines changed

4 files changed

+91
-46
lines changed

bochs/.bochsrc

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -796,16 +796,25 @@ debug: action=ignore
796796
#debug: action=ignore, pci=report # report BX_DEBUG from module 'pci'
797797

798798
#=======================================================================
799-
# DEBUGGER_LOG:
800-
# Give the path of the log file you'd like Bochs to log debugger output.
801-
# If you really don't want it, make it /dev/null or '-'. :^(
799+
# DEBUGGER:
800+
# This defines the parameters of the Bochs internal debugger:
802801
#
803-
# Examples:
804-
# debugger_log: ./debugger.out
802+
# LOG:
803+
# Give the path of the log file you'd like Bochs to log debugger output.
804+
# If you really don't want it, make it /dev/null or '-'. :^(
805+
#
806+
# GUI:
807+
# If this parameter is set to 'true' or '1' the debugger gui is used instead
808+
# of the command line version. This parameter available only if Bochs is built
809+
# with debugger gui support and the debugger is activated with the command
810+
# line option '-dbg'.
811+
#
812+
# Example:
813+
# debugger: log=./debugger.out, gui=true
805814
#=======================================================================
806-
#debugger_log: /dev/null
807-
#debugger_log: debugger.out
808-
debugger_log: -
815+
#debugger: log=/dev/null
816+
#debugger: log=debugger.out
817+
debugger: log=-
809818

810819
#=======================================================================
811820
# COM1, COM2, COM3, COM4:

bochs/config.cc

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,15 +2412,7 @@ int bx_split_option_list(const char *msg, const char *rawopt, char **argv, int m
24122412

24132413
bool is_deprecated_option(const char *oldparam, const char **newparam)
24142414
{
2415-
if ((!strcmp(oldparam, "keyboard_serial_delay")) ||
2416-
(!strcmp(oldparam, "keyboard_paste_delay")) ||
2417-
(!strcmp(oldparam, "keyboard_type")) ||
2418-
(!strcmp(oldparam, "keyboard_mapping")) ||
2419-
(!strcmp(oldparam, "keyboardmapping"))) {
2420-
// replaced v2.6 / removed v2.6.7
2421-
*newparam = "keyboard";
2422-
return 1;
2423-
} else if (!strcmp(oldparam, "user_shortcut")) {
2415+
if (!strcmp(oldparam, "user_shortcut")) {
24242416
// replaced v2.6.1 / removed v2.6.9
24252417
*newparam = "keyboard";
24262418
return 1;
@@ -2435,6 +2427,12 @@ bool is_deprecated_option(const char *oldparam, const char **newparam)
24352427
// replaced / removed after v2.6.11
24362428
*newparam = "plugin_ctrl";
24372429
return 1;
2430+
#endif
2431+
#if BX_DEBUGGER
2432+
} else if (!strcmp(oldparam, "debugger_log")) {
2433+
// replaced / removed after v3.0
2434+
*newparam = "debugger";
2435+
return 1;
24382436
#endif
24392437
}
24402438
return 0;
@@ -2748,11 +2746,6 @@ static int parse_line_formatted(const char *context, int num_params, char *param
27482746
PARSE_ERR(("%s: logprefix directive has wrong # args.", context));
27492747
}
27502748
SIM->get_param_string(BXPN_LOG_PREFIX)->set(params[1]);
2751-
} else if (!strcmp(params[0], "debugger_log")) {
2752-
if (num_params != 2) {
2753-
PARSE_ERR(("%s: debugger_log directive has wrong # args.", context));
2754-
}
2755-
SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->set(params[1]);
27562749
} else if (!strcmp(params[0], "panic")) {
27572750
if (num_params < 2) {
27582751
PARSE_ERR(("%s: panic directive malformed.", context));
@@ -3188,6 +3181,28 @@ static int parse_line_formatted(const char *context, int num_params, char *param
31883181
PARSE_ERR(("%s: port_e9_hack directive malformed.", context));
31893182
}
31903183
}
3184+
} else if (!strcmp(params[0], "debugger")) {
3185+
#if BX_DEBUGGER
3186+
for (i=1; i<num_params; i++) {
3187+
if (!strncmp(params[i], "log=", 4)) {
3188+
SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->set(&params[i][4]);
3189+
} else if (!strncmp(params[i], "gui=", 4)) {
3190+
#if BX_DEBUGGER_GUI
3191+
if (params[i][4] == '0' || !strcmp(&params[i][4], "false")) {
3192+
bx_dbg.debugger_gui = false;
3193+
} else if (params[i][4] == '1' || !strcmp(&params[i][4], "true")) {
3194+
bx_dbg.debugger_gui = true;
3195+
}
3196+
#else
3197+
PARSE_WARN(("%s: Bochs debugger gui not available", context));
3198+
#endif
3199+
} else {
3200+
PARSE_WARN(("%s: unknown parameter for debugger ignored.", context));
3201+
}
3202+
}
3203+
#else
3204+
PARSE_WARN(("%s: Bochs is not compiled with internal debugger support", context));
3205+
#endif
31913206
} else if (!strcmp(params[0], "iodebug")) {
31923207
#if BX_SUPPORT_IODEBUG
31933208
if (num_params != 2) {
@@ -3448,7 +3463,8 @@ int bx_write_debugger_options(FILE *fp)
34483463
{
34493464
#if BX_DEBUGGER
34503465
char str[40];
3451-
fprintf(fp, "debugger_log: %s\n", SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->getptr());
3466+
fprintf(fp, "debugger: log=%s, gui=%s\n", SIM->get_param_string(BXPN_DEBUGGER_LOG_FILENAME)->getptr(),
3467+
bx_dbg.debugger_gui ? "true":"false");
34523468
bx_dbg_get_magic_bp_str_from_mask(bx_dbg.magic_break, str);
34533469
fprintf(fp, "magic_break: enabled=%d%s\n", bx_dbg.magic_break != 0, str);
34543470
// TODO: debug symbols

bochs/doc/docbook/user/user.dbk

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4370,16 +4370,29 @@ problem like "could not find hard drive image."
43704370
</tip>
43714371
</section>
43724372

4373-
<section><title>debugger_log</title>
4373+
<section><title>debugger</title>
43744374
<para>
43754375
Examples:
43764376
<screen>
4377-
debugger_log: debugger.out
4378-
debugger_log: /dev/null (Unix only)
4379-
debugger_log: -
4377+
debugger: log=debugger.out, gui=true
4378+
debugger: log=/dev/null (Unix only)
4379+
debugger: log=-
43804380
</screen>
4381+
</para>
4382+
<para>
4383+
This defines the parameters of the Bochs internal debugger.
4384+
</para>
4385+
<para><command>log</command></para>
4386+
<para>
43814387
Give the path of the log file you'd like Bochs to log debugger output.
4382-
If you really don't want it, make it '/dev/null', or '-'.
4388+
If you really don't want it, make it /dev/null or '-'.
4389+
</para>
4390+
<para><command>gui</command></para>
4391+
<para>
4392+
If this parameter is set to 'true' or '1' the debugger gui is used instead
4393+
of the command line version. This parameter available only if Bochs is built
4394+
with debugger gui support and the debugger is activated with the command
4395+
line option '-dbg'.
43834396
</para>
43844397
</section>
43854398

@@ -7729,17 +7742,13 @@ For example:
77297742
</screen>
77307743
</para>
77317744
<para>
7732-
At runtime you need to add the value <option>gui_debug</option> to the
7733-
<link linkend="bochsopt-displaylibrary">display_library</link> options parameter
7734-
in order to use the GUI instead of the command line debugger. This example shows
7735-
how to use it with the 'x' GUI:
7736-
<screen>
7737-
display_library: x, options="gui_debug"
7738-
</screen>
7745+
At runtime you need use the command line option <option>-dbg_gui</option> or the
7746+
command option <option>-dbg</option> in combination with the <option>gui</option>
7747+
parameter of the <option>debugger</option> bochsrc option in order to use the GUI
7748+
instead of the command line debugger.
77397749
</para>
7740-
<note><para>The wxWidgets port of Bochs always uses this debugger GUI. Passing
7741-
the option to the display library is not necessary, since the command line
7742-
interface is not available then.
7750+
<note><para>The wxWidgets port of Bochs always uses this debugger GUI, since the
7751+
command line interface is not available then.
77437752
</para></note>
77447753
<section><title>Overview</title>
77457754
<para>
@@ -11688,7 +11697,7 @@ pci: enabled=0
1168811697
# no loader
1168911698
log: osr5.log
1169011699
logprefix: %t-%e-%i%d
11691-
debugger_log: -
11700+
debugger: log=-
1169211701
panic: action=ask
1169311702
error: action=report
1169411703
info: action=report

bochs/doc/man/bochsrc.5

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\"Document Author: Timothy R. Butler - tbutler@uninetsolutions.com"
2-
.TH bochsrc 5 "28 Jan 2026" "bochsrc" "The Bochs Project"
2+
.TH bochsrc 5 "14 Feb 2026" "bochsrc" "The Bochs Project"
33
.\"SKIP_SECTION"
44
.SH NAME
55
bochsrc \- Configuration file for Bochs.
@@ -853,14 +853,25 @@ Example:
853853
debug: action=ignore
854854

855855
.TP
856-
.I "debugger_log:"
856+
.I "debugger:"
857+
This defines the parameters of the Bochs internal debugger.
858+
859+
log
860+
857861
Give the path of the log file you'd like Bochs to log debugger output.
858-
If you really don't want it, make it '/dev/null', or '-'.
862+
If you really don't want it, make it /dev/null or '-'.
859863

860-
Example:
861-
log: debugger.out
862-
log: /dev/null (unix only)
863-
log: -
864+
gui
865+
866+
If this parameter is set to 'true' or '1' the debugger gui is used instead
867+
of the command line version. This parameter available only if Bochs is built
868+
with debugger gui support and the debugger is activated with the command
869+
line option '-dbg'.
870+
871+
Examples:
872+
debugger: log=debugger.out, gui=true
873+
debugger: log=/dev/null (unix only)
874+
debugger: log=-
864875

865876
.TP
866877
.I "com1: \fP, \fIcom2: \fP, \fIcom3: \fPor \fIcom4:"

0 commit comments

Comments
 (0)