Sun Studio 12: Debugging a Program With dbx

Data Change Event Specifications

The following are event specifications for events that involve access or change to the contents of a memory address.

access mode address-expression [, byte-size-expression]

The memory specified by address-expression has been accessed.

mode specifies how the memory was accessed. It can be composed of one or all of the letters:


The memory at the specified address has been read.


The memory has been written to.


The memory has been executed.

mode can also contain either of the following:


Stops the process after the access (default).


Stops the process before the access.

In both cases the program counter will point at the offending instruction. The “before” and “after” refer to the side effect.

address-expression is any expression that can be evaluated to produce an address. If you give a symbolic expression, the size of the region to be watched is automatically deduced; you can override it by specifying byte-size-expression. You can also use nonsymbolic, typeless address expressions; in which case, the size is mandatory. For example:

stop access w 0x5678, sizeof(Complex)

The access command has the limitation that no two matched regions may overlap.

Note –

The access event specification is a replacement for the modify event specification.

change variable

The value of variable has changed. The change event is roughly equivalent to:

when step { if [ $last_value !=$[variable]] 

This event is implemented using single-stepping. For faster performance, use the access event (see access mode address-expression [, byte-size-expression]).

The first time variable is checked causes one event, even though no change is detected. This first event provides access to the initial value of variable. Subsequent detected changes in the value of variable trigger additional events.

cond condition-expression

The condition denoted by condition-expression evaluates to true. You can specify any expression for condition-expression, but it must evaluate to an integral type. The cond event is roughly equivalent to:

stop step -if conditional_expression