Setup Pwndbg for Development¤
Installing Pwndbg from source¤
Run the following:
Officially supported is Ubuntu 22.04 and later, but the setup script also supports the following distributions:- Debian-based OSes (via apt-get)
- Fedora and Red Hat (via dnf)
- Clear (via swiped)
- OpenSUSE LEAP (via zypper)
- Arch and Manjaro (via community AUR packages)
- Void (via xbps)
- Gentoo (via emerge)
Tip
If you have an older ubuntu version you may still use Pwndbg:
- for Ubuntu 20.04 use the 2024.08.29 release
- for Ubuntu 18.04 use the 2023.07.17: ubuntu18.04-final release
however if you wish to contribute, it is recommended you upgrade your distribution.
Running with GDB¤
Pwndbg requires GDB 12.1 or later. If the GDB version your distro provides is too old, build GDB from source:
sudo apt install libgmp-dev libmpfr-dev libreadline-dev texinfo # required by build
git clone git://sourceware.org/git/binutils-gdb.git
mkdir gdb-build
cd gdb-build
../binutils-gdb/configure --enable-option-checking --disable-nls --disable-werror --with-system-readline --with-python=$(which python3) --with-system-gdbinit=/etc/gdb/gdbinit --enable-targets=all --disable-binutils --disable-ld --disable-gold --disable-gas --disable-sim --disable-gprof
make -j $(nproc)
./setup.sh
script made it so you source Pwndbg from your ~/.gdbinit
, Pwndbg will start up automatically any time you run gdb
. Running with LLDB¤
Pwndbg requires LLDB 19 or later. You can get it like this on Ubuntu 24.04:
but it will be added to your PATH aslldb-19
so you should either alias it or export it in your shell: so you can invoke it as lldb
. Also export this environment variable: Pwndbg doesn't use the lldb
driver binary directly, it drives its own REPL and interacts with LLDB through liblldb. You can run Pwndbg with LLDB by running: The development environment¤
After installing Pwndbg like described above, there are a few ways to set up the development environment. The simplest one is by running:
but you can also use the docker container or develop using nix.Note
For a proper development environment you must be able to run Pwndbg with both GDB and LLDB, otherwise you won't be able to use some important development features (like doc generation).
Development from docker¤
You can create a Docker image with everything already installed for you. You can use docker compose
or build and run the container withdocker build -t pwndbg .
docker run -it --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v `pwd`:/pwndbg pwndbg bash
Development using Nix¤
Pwndbg supports development with Nix which installs all the required development dependencies:
- Install Nix with Determinate Nix Installer.
- Enter the development shell with
nix develop
or automate this withdirenv
. - Run local changes with
pwndbg
orpwndbg-lldb
. Run tests with./tests.sh
.