0

where should my python files be stored so that I can run that using gdb. I have custom gdb located at /usr/local/myproject/bin. I start my gdb session by calling ./arm-none-eabi-gdb from the above location.

I don't know how this gdb and python are integrated into each other.

Can anyone help.?

3

2 Answers 2

1

You'd better use Python subprocess module - you could start GDB from python and drive GDB from python, passing commands on-the-fly

https://docs.python.org/3.6/library/subprocess.html#subprocess.run

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

2 Comments

I want to establish interactive session so that I can execute my python script and within python script I want to call gdb commands and record the output. I want to do import gdb in my python script
@user2118095 you might want to take a look at sourceware.org/gdb/onlinedocs/gdb/Python.html#Python
0

I was able to figure out. What I understood is

GDB embeds the Python interpreter so it can use Python as an extension language.

You can't just import gdb from /usr/bin/python like it's an ordinary Python library because GDB isn't structured as a library.

What you can do is source MY-SCRIPT.py from within gdb (equivalent to running gdb -x MY-SCRIPT.py).

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.