Valgrind with dynamically linked GCC plugin

Suryansh Kumar
Wed Jun 3 07:18:00 GMT 2015

I've been using the profiling tool valgrind for a while now. It
requires an executable to run, i.e.

    $    valgrind ./a.out

I want to use it on a dynamically linked GCC plugin, and list the time
taken and the number of calls by each function used in the plugin. I
am running the GCC plugin as follows:

    $    gcc -fplugin=./ myfile.c

When I run the following command, valgrind reports the memory leaks
for only gcc and not for I need a way to run valgrind
exclusively on my plugin, which is a .so file.

    $    valgrind gcc -fplugin=./ myfile.c

    $    gcc -fplugin=./ myfile.c -wrapper valgrind

Is it even possible to do that? I've searched up on this a lot but
haven't found any concrete answer on it.

Suryansh D Kumar

More information about the Gcc-help mailing list