Computer and Software Support


Debug: G (Go)

Page updated January 21, 2005

 

Runs the program currently in memory. Used without parameters, g starts running at the current address in the CS:IP registers.
 
Syntax
g [=Address] [BreakPoints]
Parameters
Address
Specifies the address in the program currently in memory where you want to begin running the program.
BreakPoints
Specifies 1 to 10 temporary breakpoints that you can set as part of the g subcommand.
?
Displays a list of debug subcommands.
Remarks
  • Windows XP and the Windows Server 2003 family of products do not use this command. It is included only to preserve compatibility with existing MS-DOS files, but it has no effect at the command line because the functionality is automatic.
  • Specifying valid Address entries

    Address is a two-part designation, containing either an alphabetic segment register or a four-digit segment address with an offset value. You can omit the segment register or segment address. CS is the default segment for the following debug subcommands: a, g, l, t, u, and w. DS is the default segment for all other subcommands. All numeric values are in hexadecimal format. You must include a colon between the segment name and the offset value. The following are valid addresses:

    CS:0100

    04BA:0100

  • Using the Address parameter

    Precede the Address parameter with an equal sign (=) to distinguish Address from the breakpoint addresses (BreakPoints).

  • Specifying breakpoints

    The program stops at the first breakpoint it encounters, regardless of where you typed the breakpoint in the BreakPoints list. Debug.exe replaces the original instruction at each breakpoint with an interrupt code.

    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 instruction that was executed. Debug.exe displays the same information it displays when you use the r (register) subcommand and specify the breakpoint address.

    If you do not stop the program at one of the breakpoints, Debug.exe does not replace the interrupt codes with the original instructions.

    You can set breakpoints only at addresses containing the first byte of an 8086 operation code (opcode). If you set more than 10 breakpoints, Debug.exe displays 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 an iret instruction to jump to the program that you want to test. Debug.exe sets the user stack pointer and pushes the user flags, the code segment register, and the instruction pointer onto the user stack. (If the user stack is not valid or is too small, the operating system might fail.) Debug.exe places an interrupt code (that is, 0CCh) at the specified breakpoint address or addresses.

  • Restarting a program

    Do not restart a program after the following message appears:

    Program terminated normally

    To run the program properly, reload it by using the n (Name) and l (Load) subcommands.

  • For information about executing a loop, a repeated string instruction, a software interrupt, or a subroutine by using the p (proceed) subcommand, see Related Topics.
  • For information about executing one instruction by using the t (trace) subcommand, see Related Topics.
Examples
To run the program currently in memory up to the breakpoint address 7550 in the CS segment, type:

gcs:7550

Debug.exe displays the contents of the registers and the status of the flags and stops 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 begins at the instruction after the breakpoint, rather than at the starting address.

Formatting legend

Format Meaning
Italic Information that the user must supply
Bold Elements that the user must type exactly as shown
Ellipsis (...) Parameter that can be repeated several times in a command line
Between brackets ([]) Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} Set of choices from which the user must choose only one
Courier font Code or program output

Some of these terms may be the same or similar to DOS commands. For information on DOS Commands, click here