Oracle® Solaris Studio 12.4: Debugging a Program With dbx

Exit Print View

Updated: January 2015
 
 

Continuing Execution of a Program

To continue a program after it has hit a breakpoint or some event, use the cont command.

(dbx) cont

A variant, cont at line-number, enables you to specify a line other than the current program location line at which to resume program execution. This option enables you to skip over one or more lines of code that you know are causing problems, without having to recompile.

To continue a program at a specified line, type:

(dbx) cont at 124

The line number is evaluated relative to the file in which the program is stopped. The line number given must be within the scope of the current function.

Using the cont at line-number command with the assign command, you can avoid executing a line of code that contains a call to a function that might be incorrectly computing the value of some variable. To quickly adjust incorrectly computed values, use the assign command to give the variable a correct value. Use cont at line-number to skip the line that contains the function call that would have computed the value incorrectly.

For example, assume that a program is stopped at line 123. Line 123 calls a function, how_fast(), that computes incorrectly a variable, speed. You know what the value of speed should be, so you assign a value to speed. Then you continue program execution at line 124, skipping the call to how_fast().

(dbx) assign speed = 180; cont at 124;

If you use the cont command with a when breakpoint command, the program skips the call to how_fast() each time the program attempts to execute line 123.

(dbx) when at 123 { assign speed = 180; cont at 124;}