1
0
Fork 0

Add gdb server to debugger

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
This commit is contained in:
diaxen 2020-05-11 17:59:02 -04:00 committed by Alex Page
parent eb0a3dffc2
commit cf4685e7aa
31 changed files with 7979 additions and 1006 deletions

View file

@ -37,7 +37,12 @@ enum LOG_SEVERITIES {
LOG_ERROR
};
#if C_DEBUG
#if C_DEBUG || C_GDBSERVER
struct _LogGroup {
char const* front;
bool enabled;
};
class LOG
{
LOG_TYPES d_type;
@ -48,14 +53,14 @@ public:
d_type(type),
d_severity(severity)
{}
void operator() (char const* buf, ...) GCC_ATTRIBUTE(__format__(__printf__, 2, 3)); //../src/debug/debug_gui.cpp
void operator() (char const* buf, ...) GCC_ATTRIBUTE(__format__(__printf__, 2, 3)); //../src/debug/debug_log.cpp
};
void DEBUG_ShowMsg(char const* format,...) GCC_ATTRIBUTE(__format__(__printf__, 1, 2));
#define LOG_MSG DEBUG_ShowMsg
#else //C_DEBUG
#else //C_DEBUG || C_GDBSERVER
struct LOG
{
@ -84,7 +89,7 @@ struct LOG
void GFX_ShowMsg(char const* format,...) GCC_ATTRIBUTE(__format__(__printf__, 1, 2));
#define LOG_MSG GFX_ShowMsg
#endif //C_DEBUG
#endif //C_DEBUG || C_GDBSERVER
#endif //DOSBOX_LOGGING_H