0
votes

I am trying to get value of gdb call command to a python variable using python scripting support.

My Script

import gdb

res = []
res.append(gdb.execute("call factorial(4)"))
res.append(gdb.execute("call factorial(5)"))
print res

Output

$4 = 24
$5 = 120
[None, None]

Anything that I am doing wrong ?

1

1 Answers

1
votes

Looking at the linked question, it looks like you are missing a few flags. Does

import gdb

res = []
res.append(gdb.execute("call factorial(4)", False, True))
res.append(gdb.execute("call factorial(5)", False, True))
print res

work? (doc)