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.
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.
debug g command syntax
g [=address] [breakpoints]
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
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
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
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
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
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!