A logical filter determines whether a detected event should be further considered for breakpoint processing:
logical_filter
: if expression
A detected event is retained for further consideration only if the given expression evaluates to true. If not, the detection is quietly ignored.
The expression is checked syntactically in the context of the place where the breakpoint command is given: it must be syntactically valid according to the language rules that apply there. However, the expression is not evaluated and names that occur in the expression need not be visible. After the syntax check, the expression is remembered in an internal form and is not rechecked later when it is evaluated.
If an error occurs when the expression is evaluated, for example, because a name in the expression is not defined, then the error is reported and the value of the expression is assumed to be true.
An error in the expression does not change the disposition. If continuation was specified, then that is still what occurs. For example:
(idb) when in List<Node>::append if x
[#5: when in void List<Node>::append(class Node* const) if x]
(idb) cont
Symbol "x" is not defined.
[Error while evaluating breakpoint condition - taken as true]
[5] when [void List<Node>::append(class Node* const):148 0x0804ae5a]
Symbol "x" is not defined.
[Error while evaluating breakpoint condition - taken as true]
[5] when [void List<Node>::append(class Node* const):148 0x0804ae5a]
[4] stopped at [int main(void):195 0x08051834]
195 nodeList.append(new IntNode(3)); {static int somethingToReturnTo; somethingToReturnTo++; }
It is valid for a logical filter expression to contain a call to another routine in your program. Such a call is evaluated in the same way as if it occurred in a call or print command. However, execution of the called routine might result in triggering a breakpoint; this is called a recursive breakpoint.