DOS-debug
/
README.TXT
243 строки · 10.8 Кб
1
21. About Debug/X
3
4Debug/X is a package of debuggers. The most important ones are:
5
6- Debug: is a clone of the MS-DOS DEBUG command - although, "clone"
7isn't the correct name, because it has many features not available in
8the original MS DEBUG. For details see below.
9
10- DebugX: is an extended version of Debug that allows to debug both
11real-mode and protected-mode (DPMI) DOS programs.
12
13- additional variants like DebugXv, DebugXg, DebugB or DebugR that are
14useful for special cases. For details see below.
15
16
172. Added/Missing Features
18
19a. Debug extends MS-Debug in the following ways:
20
21- The assembler and disassembler support all publicly documented
22instructions for Intel chips through the Pentium Pro (P6), except for
23the MMX instructions (as for DebugX, MMX is partially supported since
24v1.18). The assembler and disassembler inform you if any instruction is
25inappropriate for the current processor.
26
27- FPU Opcodes are supported.
28
29- The current processor (for the purposes of assembler and disassembler
30warnings, above) can be declared to be something else via the following
31commands:
32
33m [x] set current processor.
34x=0 current processor is 8088.
35x=1..6 current processor is 80x86. 80586 is a Pentium and
3680686 is a Pentium Pro.
37no argument = print current CPU/FPU types.
38mc [2|N] set math coprocessor.
392 = math coprocessor is a 287 (only valid if current
40processor is a 386).
41N = math coprocessor is absent
42no argument = math coprocessor is present
43
44- 'r register [value]' accepts 32-bit register names (for cpu 80386+).
45
46- You can do `r cx 1234' instead of having to put the `1234' on a
47separate line.
48
49- 'rn' displays FPU register status.
50Just the raw hex values of the registers are displayed, though.
51
52- 'rx' switches among 8086 and 80386 register display (for cpu 80386+).
53
54- When doing `debug < file', debug will not hang if it reaches an end of
55file before encountering a `q' command.
56
57- This debugger saves and restores the program's Control-C and critical
58error interrupts, providing for better isolation between the debugger
59and the program being debugged.
60
61- 'tm 0|1' sets trace command mode, 0 = process INTs (default),
621 = single-step INTs (the MS-DOS Debug compatible mode).
63
64- 'xr' allows to reallocate an EMS handle and 'xa' allows to allocate
65an "empty" EMS handle (with zero pages) - but only if an EMM v4.0
66is present.
67
68- Besides 'i' and 'o' exist the variations 'iw', 'id', 'ow' and 'od'
69to read/write a WORD or DWORD value from/to a port [DWORD values
70require a 80386+ cpu].
71
72- 'h' can handle dword values.
73
74- register names can be used anywhere where a number is expected as
75input. That is, things like "u cs:ip" do work.
76
77- 'dm' displays the DOS memory control block (MCB) chain and the
78current PSP.
79
80- if DOS has set its InDOS flag, Debug will avoid to use int 21h
81internally, which allows to single-step through DOS code.
82
83- 'd', 't' and 'u' are automatically repeated if a blank line is
84entered.
85
86b. DebugX has the following additional features:
87
88- besides real-mode applications it can debug both 16-bit and 32-bit
89DPMI clients.
90[To debug DPMI clients a DPMI host has to be installed. Tested with
91cwsdpmi, hdpmi, WinXP NTVDM, 32rtm. In DosEmu and Windows 95/98/ME
92DOS boxes it is required to single-step through the initial switch
93to protected-mode, else DebugX will loose control of the debuggee.]
94
95- 'dl': display LDT descriptor(s) (in protected-mode only)
96
97- 'di': display interrupt vector(s)
98
99- 'dx': display extended memory (read via Int 15h, ah=87h). Requires a
10080386 cpu. 'dx' is automatically repeated if a blank line is entered.
101Be aware that Int 15h, ah=87h most likely will disable "unreal"-mode
102if it was enabled. This may be an unwanted side effect during debugging.
103
104- 'g','p','t': the 80386+ debug registers may be used if breakpoints are
105to be set. This allows setting breakpoints in code that is read-only.
106The feature may be switched off by cmdline option /s. It's never active
107if DebugX runs on NTVDM or DosEmu, since the debug registers aren't
108accessible there.
109
110- 'rn' displays FPU registers in "readable" format.
111
112- when running in a Windows XP DOS bos, DebugX will try to load and use
113DEBXXVDD.DLL. This DLL will allow DebugX to successfully execute its
114low-level disk access commands L and W in this OS - if the user has
115administrator rights. DEBXXVDD.DLL is public domain, the source can
116be found at http://github.com/Baron-von-Riedesel/debxxf. Please
117be aware that you can do severe damage to your disk data if you use
118those low-level functions without knowing what you are doing.
119
120- 'rm' displays MMX registers.
121
122- commandline option /2 may direct DebugX's output to a monochrome video
123adapter if one is available. Useful for emulators that support this
124feature ( DosBox-x or 86Box, for example ). Needs at least a VGA
125compatible card, and there's no guarantee that it works as expected.
126
127
128c. Optionally, one may create special-purpose variants of Debug.
129Run file makex.bat to create them; you'll need the JWasm assembler
130for a successful run. The many variants may be confusing, basically
131there are 3 branches:
132
133- debugger without protected-mode support ( Debug, DebugB )
134- debugger with DPMI protected-mode support ( DebugX variants )
135- debugger running in protected-mode ring 0 ( DebugR variants )
136
137- DebugB.BIN: a version that is supposed to be loaded during the
138boot process, before DOS is loaded. Has to be installed in "free"
139disk space ( for example, in the "reserved" sectors of a FAT partition
140or behind the disk's MBR ) and must be initialized before it becomes
141active. Definitely not for beginners. See "Installing and Initializing
142DebugB" in DEBUG.TXT for details.
143
144- DebugX variants:
145
146+ DebugXd.COM: a version that doesn't hook int 01 and int 03. This
147allows to debug this variant with a "normal" version of Debug(X).
148
149+ DebugXe.COM: a version which hooks interrupts 06, 0Ch and 0Dh in
150real-mode. This is for - rare - cases when such exceptions may
151occur in real-mode applications.
152
153+ DebugXf.COM: a version which hooks interrupt 31h in protected-mode
154and then rejects any attempt to modify exception vectors 01, 03,
1550Dh and 0Eh. This allows to debug DOS-extended applications that
156modify these vectors.
157
158+ DebugXg.EXE: a version that is in DOS device driver format. This
159variant can be used to debug other device drivers. There are a
160few peculiarities:
161- commands N and Q are rejected;
162- commands R and W can't be used to read/write files;
163- interrupt 06 (invalid opcode exception) is hooked;
164- commands BP/BC to manage permanent breakpoints are activated.
165
166+ DebugXu.COM: a version that uses "unreal" mode to access extended
167memory for the DX command. This is useful to debug applications
168that set/use "unreal" mode themselves, because DebugXU will not
169change the current "unreal" state by its DX command.
170
171+ DebugXv.COM: a variant that has a few nice features activated
172compared to the standard DebugX:
173- takes care that screen output of debuggee and debugger are strictly
174separated; the 'v' command may be used to watch the debuggee screen
175while the debugger is active.
176- the SysReq key is detected and will activate the debugger.
177- the BP/BC commands are active, allowing permanent breakpoints.
178DebugXv is intended to help debugging fullscreen text mode programs.
179
180- DebugR variants. These variants run in ring0 protected-mode. The
181binaries need additional software a) to be loaded and b) to handle the
182i/o requests. No DOS API is used ( actually, not even the BIOS is used )
183and hence these are not really "DOS debuggers" anymore.
184See "DebugR Basics" in DEBUG.TXT for more details.
185
186+ DebugR.BIN: variant for legacy mode, no support for V86 mode.
187+ DebugRV.BIN: variant for legacy mode with support for V86 mode.
188+ DebugRL.BIN: variant for long mode.
189
190d. The following features of MS Debug are not implemented:
191
192- Loading of .HEX files.
193
194
1953. How to (re)build the Debug.COM/DebugX.COM Binaries
196
197MAKE.BAT is intended for rebuilding the debugger binaries. The
198recommended tool for this step is to use the JWasm assembler.
199Alternatively, one can use MS Masm, but then a 16-bit OMF linker
200will be needed as well (Open Watcom's WLink might do the job). Also,
201the DebugRL variant cannot be created with Masm, since it contains
202a 64-bit segment.
203
204
2054. Files Overview
206
207The files in this distribution are:
208
209debug.com the executable binary.
210debugx.com a DPMI aware version of Debug.
211debxxvdd.dll a Win32 dll (VDD) loaded if debugx runs in a Windows XP
212NTVDM "DOS box". Makes debugx's L and W command work with
213sectors on this platform.
214readme.txt this file.
215history.txt list of changes.
216debug.txt a MS-Debug tutorial originally written by Michael Webster,
217extended to describe all additional features of Debug(X).
218SAMPLES contains samples of 16 and 32-bit DPMI clients in Masm
219syntax.
220
221The following files, which may be distributed separately, are needed if
222debug.com or debugx.com is to be rebuilt:
223
224debug.asm Assembler source code for both debug.com and debugx.com.
225Assemble with JWasm or Masm (see Make.bat).
226*.inc several assembly include files, two of them (asmtbl.inc
227and distbl.inc) generated by tool mktables.
228instr.* input data for mktables.
229mktables.c C program to compile the internal instruction-set
230tables into files asmtbl.inc/distbl.inc. It's supposed to
231be translated with Open Watcom's 16bit compiler WCC.
232make.bat batch file to (re)create debug.com and debugx.com.
233makecm.bat batch file to (re)create mktables.exe with MS C.
234makecw.bat batch file to (re)create mktables.exe with OW C.
235makex.bat batch file to create special versions of Debugx.
236
237
2385. Copyright
239
240This program is copyrighted, but feel free to distribute and use it
241as you wish. For full copyright conditions, see the file debug.asm.
242
243Paul Vojta
244vojta@math.berkeley.edu
245
246