VOGONS


DOSBox debugger

Topic actions

Reply 102 of 159, by junglemontana

User metadata
Rank Newbie
Rank
Newbie

These are old posts, but I agree that such features would be highly useful. Especially the ability to set a memory read breakpoint.

manku wrote:

Would be really nice if debugger has ability to set breakpoint on *read* access on some memory fragment. Something like

BPMR [segment]:[offset] [length]

E.g. BMPR 0010:0100 0A -> break program execution if reading from 0010:0100-0010:01009 occured.

egons wrote:

all things what i want from debugger:
1. conitional BP's like bp if edx=value. this feature supported in Syser kernel debugger.
...

I saw some patches that implement break-on-read, but they were very old.

Someone mentioned using OllyDbg to attach into DOSbox but it sounds rather complicated. Also, OllyDbg is Windows software. I guess it gets even more complicated on Linux.

Last edited by junglemontana on 2019-06-16, 10:47. Edited 1 time in total.

Reply 103 of 159, by voxel

User metadata
Rank Newbie
Rank
Newbie

Thanks for making the debugger available, it seems very useful! I would like to know if there is some way to automate sending commands to the debugger, perhaps via a script? For instance, if I need certain breakpoints set each time it would be nice to be able to have these defined in a file that is run when the debugger is launched, or to set BPINT 3 * for every launch.

Reply 104 of 159, by junglemontana

User metadata
Rank Newbie
Rank
Newbie

Another feature that would be useful, I think: Ability to declare variable sizes and arrays with the IV command.

For example:

IV [seg]:[off] [name] --- this is what we have now
IV [seg]:[off] [name] [size] --- declare a variable with a specified size
IVARR [seg]:[off] [name] [n_elems] [elem_size] --- declare an array of n_elems elements having a size of elem_size

Reply 106 of 159, by junglemontana

User metadata
Rank Newbie
Rank
Newbie

This may be a dumb question, but how does the IV command actually work? Or what are its limitations? I started a program (protected mode NE exe) under the debugger by doing "debug program.exe", then used the IV command to name some addresses as variables. I also saved the variable list with the SV command.

When the program reached the part where these memory location were accessed, the variables in the variable list showed just 0000 or some other invalid values, not the actual values of these memory locations. Also, the saved file doesn't contain the addresses in the format which I typed them in.

Also, I noticed that the Alt+X key combo doesn't work with my SVN version 4254 on Windows, see:
DOSBox Compilation Guides

Using the D command works of course, but it's slower and less convenient.

Reply 107 of 159, by INT1

User metadata
Rank Newbie
Rank
Newbie
Qbix wrote:
if you have experience with debugging you can try the DOSBox debugger DOSBox debugger EXE 0.74-3 DOSBox debugger EXE 0.74-2 DOSB […]
Show full quote

if you have experience with debugging you can try the DOSBox debugger
DOSBox debugger EXE 0.74-3
DOSBox debugger EXE 0.74-2
DOSBox debugger EXE 0.74

All these builds are crashing at launch (Error c0000005). My system is Win7sp1x86. Every other build of DosBox works fine (I've tried official 0.74.3, SVN r4259, SVN Daum, ECE r4259 and DosBox-X). Can you please fix the problem?

Reply 108 of 159, by siddhartha

User metadata
Rank Newbie
Rank
Newbie
voxel wrote on 2019-05-13, 09:48:

Thanks for making the debugger available, it seems very useful! I would like to know if there is some way to automate sending commands to the debugger, perhaps via a script? For instance, if I need certain breakpoints set each time it would be nice to be able to have these defined in a file that is run when the debugger is launched, or to set BPINT 3 * for every launch.

I really liked this idea. I've created a patch for 0.74-3 that does just this. I've attached both the patch and a binary. The changes to dosbox.conf should look like this:

[debug]
# autoexec: Automatically run commands on debug startup from the file specified.
autoexec=debug-autoexec.txt

This can be a full path to any file on your computer. This file contains a list of debugger commands. For example:

BPINT 3
BP 01DD:0107

If you intend to apply the patch, please note a couple things:

1. In debug.cpp I needed to change the switches for keypresses from (toupper(key)) to just (key) based on other posts in this topic. This may not be necessary based on your environment. I'm using MinGW with PDCurses 3.4 on Windows 10.
2. When applying this patch to trunk, #define MAXCMDLEN 254 is already defined in the latest debug.cpp, so you can leave that out of the patch.
3. The patch also includes changes so that BPINT 3 will break on an INT3 (0xCC) instruction as well as INT 3 (0xCD 0x03).

Have fun!

EDIT: Proper license in attachments and modified the patch to use the standard library for reading the autoexec file.

EDIT 2: See post below for updated files against the SVN.

EDIT 3: A new version is located here.

Attachments

Last edited by siddhartha on 2021-05-11, 17:40. Edited 6 times in total.

Reply 110 of 159, by tigrou

User metadata
Rank Newbie
Rank
Newbie

I have compiled DOSBox on Windows with debugger enabled.
Everything works fine, except Fn keys.

If I press ALT-pause, DOSBox will pause execution but pressing F5 won't do anything (DOSBox won't resume).
I took a look at code. To make it work I had to remove the following toupper() call in debug.cpp :

switch (toupper(key)) { ... }

It's clearly a hack (I mean what I did to make it work). Something else must be wrong. Any idea?
I used the guide described here

Reply 114 of 159, by Stiletto

User metadata
Rank l33t++
Rank
l33t++
jal wrote on 2020-10-09, 11:56:

The links in the first post don't seem to work anymore? Or is this a temporary glitch?

I am having a weird issue in latest Chrome Beta this morning where clicking on the link doesn't start the download, but clicking to open in a new tab will.
I haven't troubleshooted it yet but maybe you are having the same issue.

"I see a little silhouette-o of a man, Scaramouche, Scaramouche, will you
do the Fandango!" - Queen

Stiletto

Reply 115 of 159, by jal

User metadata
Rank Oldbie
Rank
Oldbie

Indeed! That seemed the case, even though I'm running an offical build (85.0.4183.121). Funnily enough, even middle-button click, which should also open in new tab, doesn't work, the tab closes immediately. But opening a new tab from the context menu works. Really weird...

Reply 116 of 159, by siddhartha

User metadata
Rank Newbie
Rank
Newbie

Version 2 of my autoexec patch includes support for BPINT [intNum] [ah] [al] breakpoints. This is taken with help from the DOSBox-X fork.

EDIT: See below for updated patch against the SVN.

Last edited by siddhartha on 2021-05-11, 17:40. Edited 2 times in total.

Reply 117 of 159, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

You really should consider making your patch against SVN -- case in point: https://sourceforge.net/p/dosbox/code-0/3849/
There are many other improvements to the debugger in SVN as well.

Reply 118 of 159, by siddhartha

User metadata
Rank Newbie
Rank
Newbie

Well that's embarrassing. I'll make an autoexec patch against the SVN (assuming it's not in there already).

EDIT: Attached are the updated files.

EDIT 2: New version is located here.

Attachments

Last edited by siddhartha on 2021-05-11, 17:41. Edited 1 time in total.

Reply 119 of 159, by llm

User metadata
Rank Member
Rank
Member
Akuma wrote on 2020-06-03, 08:16:

I would like to set a breakpoint on memory reads . That's the only thing I really miss.

i try to implement that feature: how to add read/write data breakpoint?

maybe you can have a look and help with the idea/implementation