views:

28

answers:

0

Is there a way to test if a convenience variable has been set in gdb?

For example:

(gdb) if $_exitcode == 0
 >quit
 >end
Invalid type combination in equality test.
(gdb) p $_exitcode
$1 = void

$_exitcode is void because it is not set until the program terminates. The closest available construct is init-if-undefined, but this would require setting the variable to some sentinel value and testing against that.