I am new to gdb python api. But I am not sure how can I get the get the value of a particular variable during the debug session
import gdb
print("Import Sucess")
gdb.execute('b 36')
gdb.execute('r')
gdb.execute('stepi')
#o=gdb.parameter('print check_counter')
print("Check Counter")
print(gdb.value)
print("Done")
Use gdb.parse_and_eval to get a gdb.Value
with the value of your variable.
For instance, if you have a variable called "v" in your program you can do
v = gdb.parse_and_eval("v")
The v
variable that you get in the gdb's python interpreter is a gdb.Value
object that you can print, get the value of a field (if the original v
variable is an object), etc.