Brussels / 1 & 2 February 2014


Combining the power of Valgrind and GDB

This talk will describe basic and more advanced functionalities provided by the combination of GDB and Valgrind.

Valgrind has an embedded GDB server. That means it is possible to control a Valgrind run from GDB, doing all the usual things that GDB can do (single stepping, breakpoints, examining data, etc). Interactive Valgrind tool-specific functionality is available. For example, it is possible to query the definedness state of variables or memory from within GDB when running Memcheck; arbitrarily large memory watchpoints are supported; incremental leak search etc.

If time permits, a demo or description will be given for all or most or many or some of the below:

  • basic use

    • how to activate the Valgrind gdbserver and connect GDB to it using the vgdb relay.
    • valgrind monitor command handling
    • Valgrind output redirection
    • List the errors (or last error) found by Valgrind
  • Memcheck advanced functionalities

    • interactive leak search
    • display the addresses and content of leaked blocks
    • find who still has pointer(s) to a not freed piece of memory
    • arbitrary large memory watchpoints (unlimited 'simulated' hardware watchpoints)
    • examine or change the Accessibility and Validity bits
    • shadow registers examination
  • Use vgdb to command Valgrind tools from the shell or from shell scripts.

  • Other Valgrind tools interactive control

    • Massif memory snaphots
    • Dump or zero Callgrind counters
  • Other Valgrind gdbserver "core" functionality

    • Threads state display
    • Display "leaked" file descriptors
    • Display some internal information about Valgrind
    • Limitations of the Valgrind gdbserver


Philippe Waroquiers