VOGONS

Common searches


First post, by diaxen

User metadata
Rank Newbie
Rank
Newbie

Hi,

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.

Attachments

  • Filename
    dosbox_gdbserver.diff
    File size
    127.05 KiB
    Downloads
    254 downloads
    File license
    Fair use/fair dealing exception

Reply 3 of 6, by klei

User metadata
Rank Newbie
Rank
Newbie

Is there an easy way to make this work under windows?

To make the patched r3778 compile under mingw/msys I had to re-enable <Winsock2.h> and include <io.h> into gdb_server.cpp and I had to link against -lws2_32. Furthermore I had to call WSAStartup() in DEBUG_Init() otherwise the socket() API failed with WSANOTINITIALISED.

Now it seems that the produced executable is working. I get the following message: GDB: listening on TCP port 1234.

But my remote GDB client, GDB 7.5, throws the following error messages after connection with default settings:

(gdb) target remote localhost:1234 Remote debugging using localhost:1234 Ignoring packet error, continuing... warning: unrecogni […]
Show full quote

(gdb) target remote localhost:1234
Remote debugging using localhost:1234
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
warning: Invalid remote reply: timeout

Furthermore, whatever I try in dosbox results in a possibly endless loop:

585949507: CPU:Illegal Unhandled Interrupt Called 6 585949509: CPU:CPU:GRP5:Illegal Call 7 585949510: CPU:Illegal Unhandled I […]
Show full quote

585949507: CPU:Illegal Unhandled Interrupt Called 6
585949509: CPU:CPU:GRP5:Illegal Call 7
585949510: CPU:Illegal Unhandled Interrupt Called 6
585949512: CPU:CPU:GRP5:Illegal Call 7
585949513: CPU:Illegal Unhandled Interrupt Called 6
585949515: CPU:CPU:GRP5:Illegal Call 7
585949516: CPU:Illegal Unhandled Interrupt Called 6
585949518: CPU:CPU:GRP5:Illegal Call 7
585949519: CPU:Illegal Unhandled Interrupt Called 6
585949521: CPU:CPU:GRP5:Illegal Call 7
585949522: CPU:Illegal Unhandled Interrupt Called 6
585949524: CPU:CPU:GRP5:Illegal Call 7
585949525: CPU:Illegal Unhandled Interrupt Called 6
585949527: CPU:CPU:GRP5:Illegal Call 7
585949528: CPU:Illegal Unhandled Interrupt Called 6
585949530: CPU:CPU:GRP5:Illegal Call 7
585949531: CPU:Illegal Unhandled Interrupt Called 6
585949533: CPU:CPU:GRP5:Illegal Call 7
585949534: CPU:Illegal Unhandled Interrupt Called 6
585949536: CPU:CPU:GRP5:Illegal Call 7
585949537: CPU:Illegal Unhandled Interrupt Called 6
585949539: CPU:CPU:GRP5:Illegal Call 7
585949540: CPU:Illegal Unhandled Interrupt Called 6
585949542: CPU:CPU:GRP5:Illegal Call 7

Reply 5 of 6, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Update it to compile against the latest SVN.
Create a ticket at the DOSBox sourceforge site.
List the benefits of using GDB over the DOSBox debugger.

If none of the above is done it's really sad. Also fake news.

How To Ask Questions The Smart Way
Make your games work offline

Reply 6 of 6, by ssokolow

User metadata
Rank Member
Rank
Member
DosFreak wrote:

List the benefits of using GDB over the DOSBox debugger.

Same benefit WineDbg gains by supporting the gdbserver protocol. Access to advanced frontends like gdbgui and DDD.

Internet Archive: My Uploads
My Blog: Retrocomputing Resources
My Rose-Coloured-Glasses Builds

I also try to announce retro-relevant stuff on on Mastodon.