Sun Studio 12 Update 1: Debugging a Program With dbx

Monitoring Expressions

Monitoring the value of an expression each time the program stops is an effective technique for learning how and when a particular expression or variable changes. The display command instructs dbx to monitor one or more specified expressions or variables. Monitoring continues until you turn it off with the undisplay command. The watch command evaluates and prints expressions at every stopping point in the scope current at that stop point.

To display the value of a variable or expression each time the program stops, type:


display expression, ...

You can monitor more than one variable at a time. The display command used with no options prints a list of all expressions being displayed.

For more information, see display Command.

To watch the value of expression expression at every stopping point, type:


watch expression, ...

For more information, see watch Command.