HPlogo HP/DDE Debugger User's Guide: HP 9000 Series 700/800 Computers > Chapter 2 Compiling, Loading, and Executing the Target Program

Executing the Target Program

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Glossary

 » Index

The debugger can execute the target program by stepping through one or more statements at a time.

The easiest method for stepping through a target program is to use one of the step or continue command buttons. They are located below the source file display area.

The debugger commands go, step, and goto are useful when you want to implement more complicated stepping procedures. The less commonly used call command is particularly useful for executing user-created debugging routines or for testing new routines in your program.

In addition, you can invoke execution commands from the Execute menu or from a popup menu in the source file display area. The popup menu appears when you click with the right mouse button.

The following sections give a brief description of the command buttons and the debugger commands.

Using Command Buttons

The following buttons are located below the source file display area:

Title not available (Using Command Buttons )

Step

Execute one statement, then stop. This is called single step execution.

Step Over

Execute a statement, treating any procedure call as a single statement. The procedure is called, but control does not return to the debugger until the procedure returns. When the PC is just before a procedure call, this has the effect of "stepping over" the call.

Continue Out

Execute until the current procedure completes and returns to its caller, or until a breakpoint (or another event that halts execution) is encountered. This is very useful when you accidentally step into a procedure that you do not want to step through, or when you interrupt your program in the middle of nondebuggable code. Each Continue Out will cause your program to "pop out" one procedure level.

Continue

Execute until a breakpoint (or another event that halts execution) is encountered.

When you select one of these buttons, the PC arrow moves to the next statement to be executed.

Routines that are not debuggable, such as system library routines and routines that were not compiled with the -g option, will be stepped over even when using Step.

To pause at a specific point in your program, see “Setting Breakpoints ”.

You can modify the default behavior of these buttons by selecting Options:User Configurable Buttons. The User Configurable Buttons dialog box is displayed. See the online help for this dialog box for more information.

Using the go Command

The go command begins or resumes target program execution.

Execution begins at the current point of execution. If you have just entered the debug command, the current point of execution is the first executable statement in the source code.

If you enter go without options, execution continues until a program event occurs, such as a breakpoint, program signal, or program exit.

If you want program execution to occur up to a certain program location, use the -until option. For example,

go -until freestack

executes the target program until the entry statement for the routine freestack is reached and

go -until 110

executes the target program until line 110 of the source code is reached.

Using the step Command

The step command advances target program execution one source code statement at a time. If you supply a numeric argument to the step command (for example, step 5), it will advance execution by the specified number of source code statements.

If you specify step -instruction, execution advances one assembly instruction. The PC location arrow changes to a broken variant to indicate when the current point of execution is either at another source statement on the same line or at an instruction beyond the statement's first instruction.

However, you must invoke the Assembly Instructions dialog box to see stepping through assembly instructions. Invoke the Assembly Instructions dialog box from Show:Assembly Instructions.

If the current point of execution is a routine call, step advances execution to the first executable statement in the called routine. To advance execution without stepping into a routine, use step -over.

If you accidentally step into a routine, use the go -return command to advance execution to the statement following the routine call.

The step command also has a -return option, but it takes much longer to complete.

By default, the step command does not step into system or library calls. If you want to step into system or library calls, you can enable the loading of symbol information from the Dynamic Images dialog box. Select Execution:Enable Images/Libraries to invoke it.

Alternatively, use the property libraries command with the appropriate library as an argument if you want to step into system or library calls.

See “Debugging Shared Libraries ” for information about debugging shared libraries.

Using the Mouse

A number of execution commands are available by holding down the right mouse button in the source file display area. The Source Actions popup menu appears.

For example, you can:

  1. Scroll to a particular line number in the source file.

  2. Position the cursor on the line.

  3. Invoke the Continue Until command from the Source Actions menu and it will execute the target up to that line in the code.