Sun Studio 12 Update 1: Debugging a Program With dbx

Stopping Execution When Variables Change

To stop program execution if the value of a specified variable has changed, type:

(dbx) stop change variable

Keep these points in mind when using the stop change command:

For more information on specifying a change event, see change variable and stop Command.

dbx implements stop change by causing automatic single stepping together with a check on the value at each step. Stepping skips over library calls if the library was not compiled with the -g option. So, if control flows in the following manner, dbx does not trace the nested user_routine2 because tracing skips the library call and the nested call to user_routine2.

   user_routine calls
      library_routine, which calls
        user_routine2, which changes variable

The change in the value of variable appears to have occurred after the return from the library call, not in the middle of user_routine2.

dbx cannot set a breakpoint for a change in a block local variable, a variable nested in {}. If you try to set a breakpoint or trace in a block local “nested” variable, dbx issues an error informing you that it cannot perform this operation.

Note –

It is faster to watch data changes using the access event than the change event. Instead of automatically single-stepping the program, the access event uses hardware or OS services that are much faster.