Building GDB from Source

This post covers compiling the GDB source code on an x86 or amd64 machine, in order to set up a local development environment. Note that it may take over an hour.

Download Linux Hypervisor

vagrant init debian/stretch64
vagrant up

Install Dependencies

vagrant ssh
sudo apt-get build-dep gdb
sudo apt-get install -y texinfo flex bison dejagnu
sudo apt-get install -y emacs vim git automake
git clone git://sourceware.org/git/binutils-gdb.git gdb

Dependencies Reference

Compile and Test

cd gdb
./configure --enable-targets=all --with-expat
make
sudo make install
make check -j4 >& output.log
logout
vagrant halt

Testing Reference

For a more comprehensive guide, “Working on GDB” from gbenson.net is an excellent resource.