开发者

Analyze with valgrind only some functions and subfunctions

开发者 https://www.devze.com 2023-01-16 11:19 出处:网络
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 sub

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 subfun开发者_如何学Pythonctions (up to some depth level)?

Thanks


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
0

精彩评论

暂无评论...
验证码 换一张
取 消