To run, start up DOSEMU. Then switch to another virtual console
(or remote login or use another xterm) and do:
If there are more then one dosemu process running, you will need
to pass the pid to dosdebug, e.g:
NOTE: You must be the owner of the running dosemu to 'debug-login'.
You should get connected and a banner message.
If you type 'q', only the terminal client will terminate,
if you type 'kill', both dosemu and the terminal client will be
It may be desirable to debug the DOS or its drivers itself during startup,
to realize that you need to synchronize DOSEMU and your debugger terminal.
This can be done using the -H1 command line option of DOSEMU:
$ dos -H1
DOSEMU will then lock before jumping into the loaded bootsector waiting
for dosdebug to connect. Once connected you are in `stopped' state
and can set breakpoints or singlestep through the bootstrap code.
change contents of 'reg' to 'val'
(e.g: r AX 1234)
e ADDR valuelist
modify memory (0-1Mb)
`ADDR' maybe just a `-' (minus), then last (incremented) address from
a previous `e' or `ed' command is used (this allowes consecutive writes).
`valuelist' is a blank separated list of
such as 0F or C800
enclosed in single quotes such as 'A' or 'b'
any valid register symbol, in this case the current value
(and size) of that registe is take (e.g AX is 2 bytes,
EAX is 4 bytes)
enclosed in double quotes such "this is a string"
The default size of each value is one byte (except registers), this
size can be overridden by suffixing a `W' (word, 2 bytes) or `L' (long, 4
bytes) such as C800w or F0008123L
ed ADDR valuelist
same as above `e' command, except that the
numbers are expected as decimals per default. To write a hexvalue with
`ed' you may prefix it with `0x' as in C or write an octal value
prefixing a `0'.
d ADDR SIZE
dump memory (no limit)
u ADDR SIZE
unassemble memory (no limit)
go (if stopped)
stop (if running)
set mode (0=SEG16, 1=LIN32) for u and d commands
+d enables DPMI mode (default on startup),
-d disables DPMI mode.
single step (may jump over IRET or POPF)
single step, loop forever until key pressed
single step, force over IRET and POPF
NOTE: the scope of 't' 'tf' or a 'come back for break'
is either 'in DPMI' or realmode, depending on
wether a DPMI-client is active (in_dpmi).
dump regs in 32 bit format
set int3 style breakpoint
NOTE: the scope is defined wether a DPMI-client is active
(in_dpmi). The resulting 'come back' will force
the mode that was when you defined the breakpoint.
Clear a breakpoint.
set breakpoint on INT xx
clr breakpoint on INT xx
bpintd xx [ax]
set breakpoint on DPMI INT xx optionaly matching ax.
bcintd xx [ax]
clear breakpoint on DPMI INT xx.
set one shot breakpoint at entry point
of the next loaded DOS-program.
list active breakpoints
set a breakpoint on logoutput using regex. With this
the normal DOSEMU log output (enabled via the -D commandline option
or the dosdebug `log' command) is monitored via the regular
expression `regex' (look at GNU regex manual) and when a match is found
emulation is set into `stopped' mode. There may be 8 log breakpoint
active simultaneously. Without the `regex' given `bplog' such prints
the current active breakpoints.
clears a log break point.
get/set debug-log flags (e.g 'log +M-k')
redirect dbug-log output to the dosdebug terminal
ldt sel [lines]
dump ldt starting at selector 'sel' for 'lines'
'sel' may be a symbolic register name.
(internal command to read /usr/src/dosemu/dosemu.map
at startup time)
rusermap org fn
read microsoft linker format .MAP file "fn"
code origin = "org".
for example if your code is at 1234:0, org would
Addresses may be specified as:
a linear address. Allows 'd' and 'u' commands to look at both
DOSEMU kernel and DOS box memory (0-1Mb).
a seg:off address (0-1Mb)
seg as well as off can be a symbolic registers name (e.g cs:eip)
'seg' under DPMI is resolved via LDT, if so a numeric 'seg' value
is prefixed by # (e.g. #00af:0000.
You may force a seg to treaten as LDT selector by prefixing the '#'.
Accordingly to the default address mode 'off' under DPMI is 16 or
When in DPMI mode, and you want to address/display realmode
stuff, then you must switch off DPMI mode ('mode -d')
a symbolic address. usermap is searched first, then dosemu map.
( not for DPMI programms )
Though you may set breakpoints and do singlestep in Windows31,
this is a 'one shot': It will bomb after you type 'g' again.
( I suspect this is a timer problem, we really should freeze
the timer and all hardware/mouse IRQs while the program is in 'stop').
Debugging and singlestepping through DJGPP code doesn't have any
INT3 type breakpoints in DPMI code are very tricky, because you
never know when the client has remapped/freed the piece of code
that is patched with 0xCC ( the one byte INT3 instruction ).
Use that with caution !!
Single stepping doesn't work correctly on call's. May be the
trap-flag is lost.
However, when in DPMI the problems are minor.
popf sometime clears the trap-flag, so single stepping
results in a 'go' command.
'tf' works around, but we should do it better.
When stopped for a long period, the BIOS-timer will be updated to
fast and may result in stack overflow. We need to also stop the timer
When not stopped, setting break points doesn't work properly.
So, as a work around: Setting breakpoints while not in stop is disabled.