if

Conditionalize command execution.

Syntax

GDB Mode:

if expr
cmdlist  
[else]
[cmdlist]
end

IDB Mode:

if expr "{" cmdlist "}" [ else "{" cmdlist "}" ]

Parameters

expr

The conditional expression.

cmdlist

The command list to be executed.

Description

This command defines the beginning of a conditional block.

This command only applies when you are using the debugger in command-line mode. It has no effect when you are using the Console window in the GUI.

GDB Mode:

To define a conditional block, enter if expr, followed by each command in cmdlist on a separate line, an optional else clause, and finally, close the conditional block with end.

The debugger then evaluates the block.

IDB Mode:

In this command, the first cmdlist is executed if expr evaluates to a non-zero value. Otherwise, the cmdlist in the else clause is executed, if specified.

Example

GDB Mode:

(idb) p my_pid
$1 = -1
(idb) if my_pid == 0
 > print "is zero"
 > else
 > print "is not zero"
 >end
$2 = is not zero
(idb)  

IDB Mode:

(idb) set $c = 1
(idb) assign pid = 0
(idb) if pid < $c { print "Greater" } else { print "Lesser" }
Greater

See Also


Submit feedback on this help topic

Copyright © 1996-2010, Intel Corporation. All rights reserved.