Valgrind target for GDB

These patches add a Valgrind target to GDB that lets you debug programs running under Valgrind using GDB.

Requirements

GDB 6.0, Valgrind 2.0.0.

Download

Source patches:
gdb-6.0-valgrind.patch (ChangeLog)
valgrind-2.0.0-gdb.patch (ChangeLog)

License

GNU General Public License
© Christopher January 2004

Installation

Download gdb-6.0-valgrind.patch, valgrind-2.0.0-gdb.patch, insight-6.0.tar.bz2 (or gdb-6.0.tar.bz2) and valgrind-2.0.0.tar.bz2 to the same directory. Then:

tar jxf insight-6.0.tar.bz2 (or gdb-6.0.tar.bz2)
cd insight-6.0/gdb (or gdb-6.0/gdb)
patch -p4 <../../gdb-6.0-valgrind.patch
cd .. ./configure
make
make install
cd ..
tar jxf valgrind-2.0.0.tar.bz2
cd valgrind-2.0.0
patch -p3 <../valgrind-2.0.0-gdb.patch
cd ..
./configure
make
make install

Usage

To use the Valgrind support in GDB type target valgrind and then run your program as normal. For this to work the valgrind command needs to be in your path.
The threads running on Valgrind's simulated CPU will show up as normal threads in GDB. Thread 0 is special and represents the real state of the process (i.e. the state of the simulator.)

Leave a Comment