Skip to main content

gdb scripts in Python

Project description

License: GPL v3 made-with-python Downloads

gdbPy

Not so many people are skilled in the dark arts of gdb scripting... and I'm not one of those! gdbPy is an attempt to help all this people to write a higher level gdb scripts.
gdbPy relies on GNU Python APIs for gdb to do the work, but without the need of installing gdb module on python (more on this matter)

Installation

The project is on Pypi. Install with:

python3 -m pip install gdbPy

GDB module for Python

The major dependency (and major problem) of gdbPy is gdb module for Python: it cannot be easily installed as a normal module but, as far as I know, there's only one online guide (written in 2008 and never updated) to install it.
In short gdb it's not a Python library, and its import will work only if it's running within the gdb process. Fortunately gdb embeds python interpreter, so we can rerun the scripts importing gdbPy like

gdb -q -x script.py

Don't worry, gdbPy will do it for you!

Doc

Here

Examples

from gdbPy import *

set_file("exFile")

# Breakpoints
set_breakpoint("main+42")
set_breakpoint(0xdeadbeef)
set_breakpoint("*0xdeadbeef")

# Start execution
start()/run()

# Debugging actions
next_instruction()/next_instruction(repeat=2)
step_in()
countinue_exec()

# Can't find the command you need?
res = execute("command")

# Now quit gdb
quit()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gdbPy-0.1.2.tar.gz (21.8 kB view hashes)

Uploaded Source

Built Distribution

gdbPy-0.1.2-py3-none-any.whl (22.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page