condition (gdb mode only)

Specify a condition for a breakpoint.

Syntax

condition ID [condexpr]

Parameters

ID

The ID number of the breakpoint. The ID number is an unsigned integer greater than 0 and assigned to a breakpoint by the debugger.

condexpr

Expression denoting a logical condition.

If you do not specify this parameter, the debugger removes the condition from the breakpoint, and the breakpoint becomes an unconditional breakpoint.

Description

This command specifies a condition for breaking execution at a breakpoint.

When the specified breakpoint is encountered during execution, the debugger evaluates the specified expression. If the value of the expression is TRUE, the debugger stops executing the application. Otherwise, the debugger ignores the breakpoint.

Example

Consider line 20 and 21 of code in a Hello World application:

20          glob = 111;
21          glob = 1111;

The following example demonstrates setting a breakpoint at line 21, and then setting a condition so that the debuggee stops executing if it hits a breakpoint when the condition is true.

(idb) break 21
Breakpoint 1 at 0x80483ea: file /site/c_code/hello_simple.c, line 21.

(idb) condition 1 glob == 0

The condition is false, so the debuggee does not stop when it hits the breakpoint:

(idb) run
Starting program: /site/c_code/hello_simple.exe
Hello world!
Program exited with code 1.

Now the condition is set to a condition that is true, and the debuggee stops when it hits the breakpoint:

(idb) condition 1 glob == 111
(idb) run
Starting program: /site/c_code/hello_simple.exe
Hello world!
 
Breakpoint 1, main () at /site/c_code/hello_simple.c:21
21          glob = 1111;
(idb) 

See Also


Submit feedback on this help topic

Copyright © 2001-2011, Intel Corporation. All rights reserved.