|
|
HP WDB-GUI Reference Manual: HP-UX 11i v2 > Chapter 3 Debugging with WDB GUIAdvancing Through Your Program |
|
You can use the commands in this section to advance through your program during the debugging process. You can use the Step commands to help you locate the section of your program that is causing a problem. For example, you can set a breakpoint at the beginning of a section, step through the code, and examine variables until you isolate the problem. You can use the other commands in this section to change or show the location of the program counter. The Step Into command provides a single step execution of the current instruction. If the instruction is a function call, Step Into enters the function and single-steps through it. You can use Step Into to traverse a program in detail by stepping into each instruction as it is called. The Step Over command provides a single step execution of the current instruction, unless the instruction is a function call. If the instruction is a function call, Step Over executes the entire function, then pauses at the instruction immediately following the function call. Program execution also pauses at breakpoints that are set in a function. You can use Step Over to traverse the current stack frame without stepping through the detail of each function call. The Step Out command executes the program through completion of the current function. Then the debugger pauses at the statement immediately following the function call. You can use Step Out to return execution to the calling stack frame when you no longer want to look at the detail of a function. The Step Last command steps into the function call without stepping into the argument evaluation function calls. You can use Step Last to step into a function call without stepping through the detail of each of its argument evaluation function calls. If a function call has arguments which further makes function calls, steplast executes all argument evaluation function calls and will step into the function. Program execution also pauses at breakpoints that are set in argument function. If steplast is not meaningful at the current line, gdb will display the following warning message: “Steplast is not meaningful for the current line; behaviour undefined.” In C++, the steplast command is helpful while debugging heavy templated functions, because it directly steps into the call, thus skipping the constructor calls, if any. This behaviour is unlike the step command that steps into the constructor itself. The Run To Cursor command continues executing the program until it reaches the current cursor location. The program begins execution at the program counter (indicated by a yellow arrow) and pauses at the current cursor location. You can use the Run To Cursor command to advance to a specific location without having to set a temporary breakpoint.
The Set Next Statement command sets the program counter at the current cursor location. The program begins execution from the newly set statement instead of from the previous program counter location. You can use the Set Next Statement command to change the flow of execution if you want to re-execute or skip a portion of the program. The Show Next Statement command updates the WDB GUI to show the next statement to be executed. The command updates all applicable views, such as the Source, Disassembly, and Call Stack views. You can use the Show Next Statement command to return to the current stack frame and instruction when you have been looking at a different source file or stack frame. |
|