7.7. Displaying Current Values

The gdb utility allows you to display the value of almost anything that is relevant to the program, from a variable of any complexity to a valid expression or even a library function. However, the most common task is to display the value of a variable.
To display the current value of a certain variable, run the following command:
print variable_name

Example 7.9. Displaying the Current Values of Variables

Assuming that you have followed the instructions in Example 7.8, “Executing the fibonacci Binary File” and the execution of the fibonacci binary stopped after reaching the breakpoint at line 10, you can display the current values of variables a and b as follows:
(gdb) print a
$1 = 0
(gdb) print b
$2 = 1