0

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 Answer 1

1

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)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.