Debugger Variables

Debugger variables are pseudovariables that exist within the debugger instead of within your program. They have the following uses:

The following table lists the three different varieties of debugger variables:

Kind of variable Purpose
User-defined variables You create these and can set them to a value of any type.
Preference variables You modify these to change debugger behavior. You can only set a preference variable to a value that is valid for that particular variable.
Display/state variables These variables display the parts of the current debugger state. You cannot modify them.

For more information about debugger variables, see Debugger Variables.

The following commands deal specifically with debugger variables:

 

dbgvar_command

        : set dbgvar_name = expression

        | set dbgvar_name

        | set

        | unset dbgvar_name

 

The dbgvar_name  should not exist anywhere in your program, or you may confuse yourself about which of the occurrences you are actually dealing with. The predefined debugger variables all start with a dollar sign ($), to help avoid this confusion. It is strongly recommended that you follow the same practice; in a future release, all debugger variables will be required to start with a dollar sign.

Note:

If a debugger variable exists that shares a name with a program variable, and you print an expression involving that name, which of the two variables the debugger finds is undefined.

The first form creates the debugger variable if it does not already exist. It then sets the value of the debugger variable to the result of evaluating the expression. For example:

 

(idb) set $myLoopCounter = 0

(idb) print $myLoopCounter

0

 

The second form is equivalent to the command set dbgvar_name = 1. For example:

 

(idb) print $stoponattach

0

(idb) set $stoponattach

(idb) print $stoponattach

1

 

The set form shows all the debugger variables and their values:

 

(idb) set

$_exitcode = 0

$ascii = 0

$beep = 1

$catchexecs = 0

$catchforkinfork = 0

$catchforks = 0

$childprocess = 0

$cmdset = "dbx"

$curcolumn = 0

$curevent = 0

$curfile = "src/x_list.cxx"

$curfilepath = "../src/x_list.cxx"

$curline = 182

$curpc = 0x8052df4

$curprocess = 17633

$cursrcline = 182

$cursrcpc = 0x8052df4

$curthread = 1

$dbxoutputformat = 0

$dbxuse = 0

$debuggerpid = 17631

$decints = 0

$disasm_shows_unwind = 0

$doverbosehelp = 1

$editline = 1

$eventecho = 1

$float80bit = 0

$floatshrinking = 1

$framesearchlimit = 0

$funcsig = 1

$gdb_compatible_output = 0

$givedebughints = 1

$hasmeta = 0

$hexints = 0

$highpc = (internal debugger function)

$historylines = 20

$indent = 1

$isaEM64T = 0

$isaIA32 = 1

$isaIPF = 0

$lang = "C++"

$lasteventmade = 0

$lc_ctype = "en_US.ISO8859-1"

$listwindow = 20

$main = "\"src/x_list.cxx\"`main"

$maxarrlen = 1024

$maxlines = 5000

$maxstrlen = 128

$memorymatchall = 0

$myLoopCounter = 0

$octints = 0

$overloadmenu = 1

$page = 0

$pagewindow = 0

$parentprocess = 0

$pimode = 1

$prompt = "(idb) "

$readtextfile = 0

$regstyle = 1

$repeatmode = 1

$reportsotrans = 0

$showlineonstartup = 0

$showwelcomemsg = 1

$stack_levels = 50

$stackargs = 1

$statusargs = 1

$stepg0 = 0

$stoponattach = 1

$stopparentonfork = 0

$symbolsearchlimit = 100

$threadlevel = "native"

$tracesyscalls = 0

$usedynamictypes = 1

$verbose = 0

 

To see the value of just one debugger variable, print it. For example:

 

(idb) print $catchexecs

0

 

The unset form deletes the debugger variable. Some predefined debugger variables either cannot be deleted or are automatically recreated in the future when needed. For example:

 

(idb) unset $myLoopCounter

(idb) print $myLoopCounter

Symbol "$myLoopCounter" is not defined.

(idb) unset $catchforks

Warning: The debugger variable "$catchforks" was not unset because it is an idb predefined variable