[patch] Connect a Gdb client to DOSBox

Here you can discuss the development of patches.

[patch] Connect a Gdb client to DOSBox

Postby diaxen » 2011-11-29 @ 19:33

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.
You do not have the required permissions to view the files attached to this post.
diaxen
Newbie
 
Posts: 1
Joined: 2011-11-26 @ 17:31

Re: [patch] Connect a Gdb client to DOSBox

Postby jackzhc911 » 2012-3-03 @ 00:51

Thank you.
jackzhc911
Newbie
 
Posts: 4
Joined: 2012-3-03 @ 00:19
Location: Taiwan, ROC

Re: [patch] Connect a Gdb client to DOSBox

Postby ykhwong » 2012-3-03 @ 11:50

Thanks. I updated it a bit for r3778.
You do not have the required permissions to view the files attached to this post.
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: [patch] Connect a Gdb client to DOSBox

Postby klei » 2013-7-01 @ 09:59

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: 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 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
klei
Newbie
 
Posts: 2
Joined: 2010-3-13 @ 09:35

Re: [patch] Connect a Gdb client to DOSBox

Postby Theromented97 » 2018-11-11 @ 03:24

Half a decade later, and this patch is still not merged into DOSBox or any fork. This is really sad.
Theromented97
Newbie
 
Posts: 1
Joined: 2018-11-11 @ 02:52

Re: [patch] Connect a Gdb client to DOSBox

Postby DosFreak » 2018-11-11 @ 09:46

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.
User avatar
DosFreak
l33t++
 
Posts: 9982
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: [patch] Connect a Gdb client to DOSBox

Postby ssokolow » 2018-12-02 @ 04:49

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: DOS & Win16 programming resources, Free Installer Creators for All Eras
My Rose-Coloured-Glasses Builds

I also try to announce anything retro-relevant on on Twitter.
User avatar
ssokolow
Newbie
 
Posts: 46
Joined: 2018-6-14 @ 19:59
Location: Canada


Return to DOSBox Patches

Who is online

Users browsing this forum: knowledge [bot], lmerckx and 2 guests