Here is a patch which allows using the GNU debugger as an alternative to
the DOSBox built-in debugger. The built-in debugger may be more
convenient to show x86 specific information about execution state,
whereas Gdb is useful for C and C++ source level debugging.
This patch applies against svn revision 3761. Once applied the configure
script can be used with a new option:
./autogen.sh
./configure --enable-debug=gdbserver
DOSBox then listen on TCP port 1234 and a Gdb client compiled for x86_64
or i686 targets can be connected:
$ gdb
(gdb) target remote localhost:1234
The gdb architecture must be set depending on the code your are trying
to disassemble (16 or 32 bits), for instance:
(gdb) set architecture i8086
(gdb) x/32i $eip
Breakpoints and watchpoints are supported and some DOSBox specific
features are available through the gdb "monitor" command.
This patch adds the following files:
- src/debug/gdb_server.cpp file
- src/debug/debug_log.cpp
- src/debug/debug_helpers.cpp
The debug.cpp file has been split in 3 files so that the original file
now contains built-in debugger stuff only and
debug_log.cpp/debug_helpers.cpp files contain common code used by both
built-in and Gdb debuggers. Some variables which were previously local
to debug.cpp have been prefixed by DEBUG_ and debug.h has been updated
accordingly.
Tested under GNU/Linux.
Co-authored-by: ykhwong
Imported-from: https://www.vogons.org/viewtopic.php?p=259378#p259378