views:

44

answers:

1

Hi,

I want to debug a "big" C code, and use valgrind, in particular the tool memcheck. The output is very long, due to the size of the program, and I only want to focus on some function and relative subfunctions of the program. Is it possible in valgrind only to analyze certain function and subfunctions (up to some depth level)?

Thanks

A: 

Valgrind must supervise the process from the start; it is not possible to attach it to already running process (or, equivalently, to ignore the process until some point in execution, then start emulating/checking).

The reverse is not true -- you can "detach" valgrind after some number of instructions; but I am guessing that's not what you want.

Please note that:

  • the "output is very long" is a poor excuse -- Valgrind errors are usually true positives (unless you are using optimized code, in which case: don't do that), and should really be addressed, and
  • you can concentrate on the more serious problems (heap corruption) before addressing the use of uninitialized values, by using --undef-value-errors=no
Employed Russian