One, the use of Debug
1. What is Debug
Debug is a real-mode (8086 mode) program debugging tool provided by both Dos and Windows. Using it, you can view the contents of various registers of the CPU. The memory situation and tracking program operation at the machine code level.
2. Debug common functions
command | Features |
---|---|
r | View and change the contents of CPU registers |
d | View the contents of the memory |
e | Overwrite the contents of the memory |
u | Translate the machine instructions in the content into assembly instructions |
t | Execute a machine instruction |
a | Write a machine instruction in the memory in the format of an assembly instruction |
3. Enter Debug
Support and win7 32 bits or less
(1) win+R
, then enter canmand
, enter after enteringDebug
4. R command to view and change the contents of CPU registers
5. D command to view the contents of the memory
(1) Method one: d 段地址:偏移地址
(2) Method two:d 段地址:起始偏移地址 结尾偏移地址
6. The e command rewrites the contents of the memory
Format: For e 起始地址 数据 数据 数据 ...
example, write the contents of the memory unit 1000:0~1000:9 as 0, 1, 3, 4, 5, 6, 7, 8, 9 respectively
Case 1:
Case 2: Writing characters
7. 1 e command to write machine code to memory
机器码 对应汇编命令
b80100 mov ax,0001
b90200 mov cx,0002
01c8 add ax,cx
7.2 U command translation into assembly command
7.3 t command to execute assembly instructions
(1) Modify first cs:ip=1000:0
(2) -t
Execute