|
From: John R. <jr...@bi...> - 2018-06-12 13:56:12
|
> When Valgrind tool memcheck + leak check all is used, how can I ask valgrind to show me errors only after a certain point ( valgind interactive mode OR start valgrind after a particular function call in the code ) until a certain point ( valgind interactive mode OR stop valgrind after a particular > function call in the code ) ? Re-direct valgrind's error stream into a file, or use the XML error log. Note the length of the file at the first certain point and at the second certain point. Use a text editor to view only the indicated range of bytes. > > Simply, my requirement is to test the code under valgrind only between two events. This is impossible. The worth of valgrind is precisely that valgrind has examined the entire execution of the process from the very beginning to the current point. > I do not want it to to be profiled from the start if the program to the termination of the program. > How can I do this ? You cannot. > > Any help / reference is highly appreciated ! The only way is to "checkpoint" or "un-exec" the process at the first point (create an ELF file that contains the entire memory image of the process), then run valgrind on that new file, and stop at the second point. This is a _lot_ of work, both tedious and artistic/inventive (such as capturing and restoring the state of open files, network connections, shared memory, etc.) You also silently convert to "initialized" any memory that actually was uninitialized at the first point. |