Skip to content

Instantly share code, notes, and snippets.

@tyhoff tyhoff/.gdbinit
Last active Oct 8, 2019

Embed
What would you like to do?
.gdbinit modifications for using a Virtualenv with GDB Pythong scripts
# All of your normal .gdbinit commands, functions, and setup tasks
# Update GDB's Python paths with the `sys.path` values of the local Python installation,
# whether that is brew'ed Python, a virtualenv, or another system python.
# Convert GDB to interpret in Python
python
import sys
import os
import subprocess
# Execute a Python using the user's shell and pull out the sys.path from that version
paths = eval(subprocess.check_output('python -c "import sys;print(sys.path)"', shell=True).strip())
# Extend the current GDB instance's Python paths
sys.path.extend(paths)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.