Skip to content

Instantly share code, notes, and snippets.

@yunghoy
Created December 6, 2016 07:15
Show Gist options
  • Save yunghoy/89c7faef0c8a418b7cd5f25eea1d9a5f to your computer and use it in GitHub Desktop.
Save yunghoy/89c7faef0c8a418b7cd5f25eea1d9a5f to your computer and use it in GitHub Desktop.
I believe you can connect gdb to a running valgrind process, and instruct it to run a leak check explicitly.
I haven't tried this, just seen it in the docs.
In case of link breakage:
Connecting GDB to a Valgrind gdbserver
$ valgrind --tool=memcheck --vgdb=yes --vgdb-error=0 ./prog
(the error parameter is the number of errors before the gdbserver becomes active: zero means it starts running right away).
Then start gdb on your program and connect to the remote target
$ gdb ./prog
(gdb) target remote | vgdb
and to trigger the check
(gdb) monitor leak_check full reachable any
See your docs or the linked ones for full details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment