Oracle® Solaris Studio 12.4: Debugging a Program With dbx

Exit Print View

Updated: January 2015
 
 

Qualifying Breakpoints With Conditional Filters

To set a breakpoint that includes a filter, add an optional -if condition modifier statement to the end of a stop or trace command. The condition can be any valid expression, including function calls, returning Boolean or integer in the language current at the time the command is entered.

You can use a function call as a breakpoint filter. In this example, if the value in the string str is abcde, then execution stops in function foo():

(dbx) stop in foo -if !strcmp(“abcde”,str)

You can use the –if option with function calls:

stop in lookup –if strcmp(name, "troublesome")==0

The following is an example of using a conditional filter with a watchpoint:

(dbx) stop access w &speed -if speed==fast_enough