Sun Studio 12: Debugging a Program With dbx

ProcedureTo Resume Program Execution at a Specific Line

  1. Use the assign command to give the variable a correct value.

  2. Use cont at line_number to skip the line that contains the function call that would have computed the value incorrectly.

    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;

    For more information, see cont Command.

    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;}

    For more information on the when command, see: