How to use debug g command?

藏色散人
Release: 2020-09-08 17:12:11
Original
10536 people have browsed it

The G command in DEBUG is used to execute code. Its syntax is "g [=address] [breakpoints]". This command can be followed by address and breakpoint. It will pause after running to the code at the specified location in the memory. , if no parameters are added, the default is to run from the current IP to the end of the program.

How to use debug g command?

DEBUG The G command is used to execute the code. This command can be followed by addresses and breakpoints, that is, the format is g [=address] [breakpoints]. It will pause after running the code at the specified location in the memory. If no parameters are added, the default is to run from the current IP to the end of the program.

How to use debug g command?

debug g command syntax

g [=address] [breakpoints]
Copy after login

Parameters:
address, for the program currently in memory, Specify the address from which it will start running.
breakpoints, specifies 1 to 10 temporary breakpoints that can be set as part of the g subcommand.
?, displays the debug subcommand list.

Note:
Windows XP does not use this command. Use it only for compatibility with MS-DOS files.
Specify a valid address item. Address is a two-digit name containing an alphabetic segment record or a four-digit field address plus an offset. Segment registers or segment addresses can be ignored.

CS is the default section for the following "debug" subcommands: a, g, l, t, u, and w. The default segment for all other commands is DS. All values ​​are in hexadecimal format. A colon must be included between the segment name and offset. Valid addresses are as follows:

CS:0100
04BA:0100
Copy after login

Use the address parameter
The equal sign (=) must be used before the address parameter to distinguish address from breakpoint addresses (breakpoints).

Specify breakpoints
No matter where you type a breakpoint in the breakpoint list, the program will stop at the first breakpoint. Debug.exe replaces the original instruction with break code at each breakpoint.

When the program reaches a breakpoint, Debug.exe restores all breakpoint addresses to their original instructions and displays the contents of all registers, the status of all flags, and the decoded form of the last executed instruction. Debug.exe now displays the same information as when using the r (register) subcommand and specifying the breakpoint address.

If you do not stop the program at a breakpoint, Debug.exe will not replace the interrupt code with the original instruction.

You can set a breakpoint only on the address containing the first byte of the 8086 operation code (opcode). If more than 10 breakpoints are set, Debug.exe will display the following message:

bp error
Copy after login

Using the user stack pointer
The user stack pointer must be valid and must have 6 bytes available for the g subcommand . The g subcommand uses the iret instruction to jump to the program that needs to be tested. Debug.exe sets the user stack pointer and pushes the user flags, code segment register, and instruction pointer onto the user stack. (The operating system may fail if the user stack is invalid or too small. Debug.exe places a break code (0CCh) at the specified breakpoint address or at the specified address.

Restart the program
Do not restart the program after the following message appears:

Program terminated normally
Copy after login

To run the program correctly, you must reload the program by using the n (Name) and l (Load) subcommands.

For information on using the p subcommand to execute loops, repeated string instructions, software interrupts, or subroutines, see "Related Topics"
For information on using the t subcommand to execute an instruction, see "Related Topics"

Example
To run the program currently in memory and execute to the breakpoint address 7550 in the CS segment, type:

gcs:7550
Copy after login

Debug.exe will display the contents of the registers and the status of the flags, then terminate the g subcommand.

To set two breakpoints, type:

gcs:7550, cs:8000
Copy after login

If you type the g subcommand again after Debug.exe encounters a breakpoint, execution will begin from the instruction after the breakpoint instead of the starting address.

The above is the detailed content of How to use debug g command?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template