0

I have launched GDB using subprocess.call methond in python .Can any one help how to pass commands to gdb (like 'info threads') from python script.

1 Answer 1

1

It is better to use Pexpect module if you want to interact with interactive shells.

But I suggest you to use Python bindings that shipped with gdb.

infothreads.py:

import gdb
gdb.execute('info threads')
gdb.execute('continue')

Run it using -x option of gdb:

gdb -x infothreads.py -p 21686

Documentation on Python bindings may be found here: Python API

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.