Controlling Program Execution

During a debugging session, CodeWatch maintains an execution pointer, which tracks the current point of program execution. When execution of the program has been halted by a debugger action, the pointer maintains the location as the current execution point. The current execution point can always be determined using the WHERE command. This allows you to control the execution of the program by using one of several simple debugger facilities.

The CONTINUE command is used to begin program execution or to resume execution following a breakpoint or a step operation.

The GOTO command moves the execution pointer to a specified statement. Program execution resumes at this point when a Continue or Step is issued. The statement is specified by a line number, a simple statement label, or a statement label followed by a line number offset or statement offset. The named statement must exist in the current program block. Once the debugger has executed the Goto, it displays the new execution point.

The RELOAD command restarts the user program, preserving any explicitly set breakpoints, tracepoints, and watchpoints with associated action lists. A subsequent Continue or Step will start program execution from the beginning of the program.

The RETURN command transfers the current execution point to the exit point of the current procedure. If the procedure returns a value, an expression must be given indicating the value to be returned. For more information, see the section Modifying Return Values.

The QUIT command causes termination of the debugging session. Selecting the Exit item in the File menu is equivalent to issuing the QUIT command.

CodeWatch does not require a program-to-debug at startup time. If no program-to-debug is supplied to Code Watch, CodeWatch comes up standalone. However, on UNIX systems, it will first look for a.out as the default program name. When CodeWatch comes up standalone, a LOAD or ATTACH command must be used to specify the program to be debugged.

The LOAD command loads the symbol table from a specified file into CodeWatch as the primary executable for debugging. It also purges the internal CodeWatch symbol table of any previously loaded executables or shared libraries.

The ATTACH command attaches CodeWatch to the "pid" (a decimal number) and performs a LOAD command, as described above. Attached programs that call exit () or that die are not automatically reloaded. Use the RELOAD command for this.

Programs may also be attached at the time of invocation, for example,

cwcmd -pid 3268 myprog.out