Oracle® Solaris Studio 12.4: Debugging a Program With dbx

Exit Print View

Updated: January 2015
 
 

Continuing After Fixing

You can continue executing using the cont command. Before resuming program execution, be aware of the following conditions that determine the effect of your changes, which are described in this section.

Changing an Executed Function

If you made changes in a function that has already executed, the changes have no effect until. you run the program again or that function is called the next time.

If your modifications involve more than simple changes to variables, use the fix command, then the run command. Using the run command is faster because it does not relink the program.

Changing a Function Not Yet Called

If you have made changes in a function not yet called, the changes will be in effect when that function is called.

Changing a Function Currently Being Executed

    If you have made changes to the function currently being executed, the impact of the fix command depends on where the change is relative to the stopped-in function:

  • If the change is in code that has already been executed, the code is not re-executed. Execute the code by popping the current function off the stack and continuing from where the changed function is called. You need to know your code well enough to determine whether the function has side effects that cannot be undone, for example, opening a file.

  • If the change is in code that is yet to be executed, the new code is run.

Changing a Function Presently on the Stack

If you have made changes to a function presently on the stack, but not to the stopped-in function, the changed code is not used for the present call of that function. When the stopped-in function returns, the old versions of the function on the stack are executed.

    You can solve this problem in several ways:

  • Use the pop command to pop the stack until all changed functions are removed from the stack. You need to know your code to be sure that no problems are created.

  • Use the cont at command to continue from another line.

  • Manually repair data structures with the assign command before continuing.

  • Rerun the program using the run command.

If breakpoints are in modified functions on the stack, the breakpoints are moved to the new versions of the functions. If the old versions are executed, the program does not stop in those functions.