Examples of Setting Custom Breakpoint Actions

Related Topics:

Setting Custom Breakpoint Actions Breakpoints Window

Setting a Custom On Condition Breakpoint

You can set an On Condition breakpoint to change the value of a variable when the value of an expression becomes True.

If you were using dbx, the command would be:

when cond x==10 {assign x=15;}

To set the same breakpoint in the Breakpoints window, you would set the following in the Details pane:
Event On Condition x==10
Action CUSTOM assign x=15
Option None

The debugger automatically adds { ;} for assign x=15. The syntax reads:

{assign x=15;}

If you click Add, an extra { ;} will be added in the Action text field.

If you click Change, the selected breakpoint is changed from

when cond x==10 {assign x=15;}

to

when cond x == 10 -replace 2  { assign x=15 ; }

Setting a Custom Breakpoint at a Specific Line Number

You can set a breakpoint to execute a dbx command whenever a particular line of the program is reached.

If you were using dbx, the command would be:

when at `foo.c `6 {print x;}

To set the same breakpoint in the Breakpoints window, you would set the following in the Details pane:
Event At Location `foo.c `6
Action CUSTOM print x
Option None

Setting a Custom On Value Change Breakpoint

You can set a breakpoint to execute a dbx command whenever the value of a variable changes. There are two forms--when modify, which is faster but doesn't work with automatic variables, and when change, which is slower, but accepts automatic variables.

If you were using dbx, the command would be:

when change y { assign x=20; }

To set the same breakpoint in the Breakpoints window, you would set the following in the Details pane:
Event On Value Change y
Action CUSTOM assign x=20
Option None