📄 readme.txt
字号:
rounding/precision selections, and status of the C? flags. Note:
if you have a 386 with no coprocessor you will get an error message.
n #, val <CR>
set the value in an FP register. This command will NOT push
stuff on the FP stack, if a register is tagged empty you are out
of luck. If you want to enter infinity that is +inf or -inf,
likewise a NaN is +nan or -nan (although the fpu ignores the
sign on a nan you can still put it in). Only non-signaling NaNs
are supported at this time. Yes, you can enter -0 if you want.
o port, val <CR>
output a (byte) value to a port
ob port, val <CR>
output a (byte) value to a port
There must be no space between the command and the size
qualifier so as to distinguish it from the port value
ow port, val <CR>
output a (word) value to a port
There must be no space between the command and the size
qualifier so as to distinguish it from the port value
od port, val <CR>
output a (word) value to a port
There must be no space between the command and the size
qualifier so as to distinguish it from the port value
p <CR>
step over subroutines, string instructions, int calls. For
loop instructions, it runs until the loop falls through. This is
a DESTRUCTIVE instruction, it modifies the code stream temporarily
if a simple trace won't do.
pr <CR}
proceed until the end of this subroutine. traces until it
hits a ret or iret, nesting is maintained. Calls and interrupts
and repeat string instructions run at full speed. Note that
when it stops you will be after the subroutine call instruction.
warning: I am not sure what happens with recursion. Also in
(vanishingly) rare instances involving run-time stack switches
this will halt with a garbled CS:IP.
q <CR>
exit debugger
r <CR>
show registers
r reg <CR>
prompt for a new value for reg
r reg , value <CR>
stuff a new value in reg
s addr , addr , list <CR>
search. List may be any combination of quoted strings and hex
values. Note: you MAY use a segment value in the second
argument. The segment of the result will be adjusted any time
the offset of the first argument is greater than 8000h.
t <CR>
step into instruction
t count <CR>
single step for count instructions
u <CR>
disassemble from current location. Location gets set to CS:IP
each time an R command or trace/go is executed.
u addr <CR>
dissassemble from address
u addr, addr <CR>
disassemble code between the two addresses. Second address may
NOT be qualified with a segment
w <CR>
write file to disk. If no file is loaded or loaded file
is an EXE file loaded in EXE format you will get an error.
w name <CR>
write the file, giving it a new name. This will allow you to
resave an exe image, but bear in mind if you loaded it as an
exe file you don't get a header and fixups have been performed.
w name len <CR>
write the file, giving it both a name and a length
w ,len <CR>
write the file, with a specific length. Resets the
file length
w @addr name len <CR>
write a file from address of length len with name name. Note that if
an address is given you MUST give a name and length
xr drive: addr, sector <CR>
read one (logical ) sector from the disk.
Note that DRIVE is a letter from a to z.
xr drive: addr, sector, len <CR>
read multiple (logical) sector from the disk.
xw drive: addr, sector <CR>
write one (logical ) sector from the disk.
Note that DRIVE is a letter from a to z.
xw drive: addr, sector, len <CR>
write multiple (logical) sector from the disk.
y pfa, reg <CR>
PCI- read a value from this register of this PFA and display it
y pfa, reg, val <CR>
PCI- write a value to this register of this PFA
y? bus, dev, func <CR>
PCI- calculate the PFA address from the bus, device, and function
given and display it. No PCI access is done.
@ filename <CR>
start logging to a file. ONLY the debug session is logged;
not the program output.
@a filename <CR>
start logging; append instead of truncating. there can be no
space before the 'a' or it will be treated as the file name.
@ <CR>
end logging
? <CR> help
?i <CR>
shows interrupt information. All interrupts hooked since the
debugger has been invoked are shown, along with PIC information.
If an interrupt has a '*' it is currently reserved by the
debugger and the contents will be lost on the next go/trace/proceed.
PIC information shows the PIC mask registers, and in parenthesis
the original values of the PIC mask registers and the current value
of the interrupt request register
for example:
02 : CCE4:0000
03*: 0070:0400
PIC 0 mask: A8 (A8,00)
PIC 1 mask: 89 (89,00)
?m <CR>
shows the arena entry headers belonging to the program.
also shows the address of the top of the program memory
(normally 0a000h). Values are in paragraphs.
For example:
Top of memory: 9FFF
Address: 262E Owner: Q(2659) Size: 0029
Address: 2658 Owner: Q(2659) Size: 79A6
the number in parenthesis is the PSP of the owner. The name will
be expanded to stars if no file is loaded.
?mx <CR>
shows all arena headers in the chain
?o <CR>
show options. See the next section
?o +opt <CR>
set an option
?o -opt <CR>
clear an option
?p <CR>
status about program size, PSP and environment location,
some EXE characteristics, etc.
For example:
Dos version: 07.00
CPU type: Pentium Pro
Program: grdb.exe
Arguments: grdb.exe
File length: 518A
CS:IP = 266E:1AC0
SS:SP = 2B87:0800
minalloc: 0081 maxalloc: FFFF
relocs: 0008
Psp at 265E with length 79A1
Environment at 2633 with 0289 bytes used of 02A0
6) Options
Available options are as follows:
WR - wide registers disabled
FR - flat real commands disabled
32 - 32 bit disassembly enabled
ZR - divide by zero trap enabled
BK - ctrl-break trap enabled
NV - native video disabled
FI - flat real autoinit enabled
F0 - flat from zero disabled
SO - signed immediates disabled
HI - history enable enabled
MD - MSDOS I/O disabled
To set an option, type ?O followed by its two-character option name.
For example:
?o WR <CR>
turns on wide registers
?o +WR -32 <CR>
turns on wide registers and turns off 32-bit instructions.
Options are maintained in a file called 'grdb.opt'. Here are the meanings
for the options:
WR: normally the 'r' command will show the 16-bit registers. Setting
this option will cause it to show the full 32-bit value for each
register.
FR: addresses are normally truncated at 0FFFFH to avoid protection
faults. Setting this option allows commands to utilize the full
32-bit address range, which can be useful in debugging flat real mode
programs.
32: the debugger normally interprets all instructions up through
the Pentium whcn showing disassemblies. Resetting this option will force
it to quit recognizing instructions for any processor above the 80186.
ZR: This debugger traps divide by zero instead of exeiting you to DOS.
If you want it to NOT trap divide by zero, for example you have your own
handler... reset this option.
BK: This debugger intercepts the ctrl-break trap and halts the
program (assuming interrupts are enabled and it isn't totally
runaway). Use this option to disable the handling, e.g. you
want to use your own ctrl-break handler.
NV: in the 'dump' display, the debugger will use native video translations
for most characters in the ascii display ( characters that are translated
by video function 0eh can not be displayed natively). If you want to
see only characters in the ASCII character set, turn this option off.
FI: no function unless the FR option is enabled. If both the FR and FI
options are enabled, the debugger will transition the FS register
into flat real mode in preparation for flat real commands, otherwise
if just the FR option is set it is up to your program to make the
transition into flat real mode.
F0: no function unless the FR option is enabled. If both F0 and FI
are enabled then the assembler will default memory commands from
physical address zero rather than from the default data segment.
SO: signed immediates. Alters the display of the U command to display
signed byte values as 8 bit signed values instead of as 8 bit unsigned
HI: history enable. When this option is on command line history is
enabled. When this option is off command line history is disabled.
Turning this off will save about 1024 bytes of memory if you need it.
MD: msdos I/O enable. Enable this option if you want to use input
redirection to send a script to GRDB
7) guidelines
a) the debugger uses ONLY 1 interrupt table. And it reloads
all interrupts it hooks each time you trace or go. This
means that if you go hooking interrupts the debugger uses
they will get trampled. The following interrupts are ALWAYS
off-limits:
01 - debug trap
03 - breakpoint trap
20 - DOS exit routine
The following interrupts are off-limits unless you set the
appropriate option off:
00 - divide by zero trap
1b - breakpoint trap
In addition, hooking int 21h is problematic since the debugger
needs to hook it for a variety of reasons. if you HAVE to
hook it, do NOT write directly to the interrupt talbe but instead
do a DOS call (function 25h,35h) to keep the debugger in sync
with you.
The debugger does not care what you do with other interrupt
vectors
b) Unless you have logging enabled, the program will not use DOS
for I/O. However it DOES need to go resetting the PSP a lot;
so I'm not sure how safe it is to step through DOS.
c) The debugger maintains a proper program context even when no
program is loaded.
d) int 20h from the wrong CS WILL work, but you will get a
warning message. Note this will cause a crash if the debugger
isn't running!
9) FLAT REAL SUPPORT
There are two options dealing with flat real mode. The first
is the FR option. When enabled, this causes numbers to be
interpreted as 32-bit rather than 16-bit when possible (note
that the assembler will always allow 32-bit numbers).
The second is the FI option, when this is enabled in conjunction
with the FR option the debugger will transition the FS register
into flat real mode and use XMS to enable the A20 line. You should
disable the FI option to test the flat real mode initialize routines
in your own program.
The FI option is disabled if you are in a windows or EMM386 shell.
You probably shouldn't use the FR option at this time either,
it will give incorrect results and maybe a general protection
trap.
The following commands work with 32-bit addresses:
c,d,e,f,m,s
Disassemblies do NOT work with 32-bit addresses as this is a
real-mode debugger, also other commands are not certified to
work with 32-bit addresses at this time.
9) changes
The following changes will be made at a later date:
1) OPTIONS file renamed to fit the program being done, breakpoints
will be logged in the options file
2) command line editing
3) public symbol support
4) command line math ?
5) I'm thinking about a screen-oriented interface :)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -