|
From: Ransara W. <ran...@gm...> - 2018-06-12 13:15:58
|
Hi, 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 ) ? Simply, my requirement is to test the code under valgrind only between two events. 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 ? Any help / reference is highly appreciated ! Thanking you in Advance, Ransara -- http://www.linkedin.com/in/ransara http://ransara.blogspot.com |
|
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. |
|
From: Ivo R. <iv...@iv...> - 2018-06-12 14:17:18
|
> > 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. Actually that could be hypothetically doable if also Valgrind+Memcheck state was saved and restored. However that would be another pile of work to do :-) I. |
|
From: Ransara W. <ran...@gm...> - 2018-06-12 17:03:53
|
Hi John, Thank you very much for the details. Require one more clarification. Referring to "Re-direct valgrind's error stream into a file, or use the XML error log ........." Yes, I'm using XML mode output and I check results using Valkyrie. Is there any way that I can FLUSH valgrind output ? or configure it to flush results to file real time ? Asking because , in XML mode ( I have not observed in text output mode ) valgrind output is NOT completely written until the process is terminated. Only when the terminate signal comes, the full output is suddenly written. Thank you, Ransara On Tue, Jun 12, 2018 at 7:27 PM John Reiser <jr...@bi...> wrote: > > 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. > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers > -- http://www.linkedin.com/in/ransara http://ransara.blogspot.com |
|
From: Brenda B. <bj...@mo...> - 2018-06-12 21:01:06
|
#include <valgrind/memcheck.h>
...
printf("Checking mem leak summary\n");
VALGRIND_DO_QUICK_LEAK_CHECK;
...
printf("Checking mem leak details\n");
VALGRIND_DO_LEAK_CHECK;
...
Call VALGRIND_DO_LEAK_CHECK before your "function of interest", then
call your function, then call VALGRIND_DO_LEAK_CHECK after your
"function of interest". If the output is different the second time
from the first time, you had leaks.
bjb
On Tue, Jun 12, 2018 at 1:03 PM, Ransara Wijethunga <ran...@gm...> wrote:
> Hi John,
>
> Thank you very much for the details. Require one more clarification.
>
> Referring to "Re-direct valgrind's error stream into a file, or use the XML
> error log ........."
> Yes, I'm using XML mode output and I check results using Valkyrie.
>
> Is there any way that I can FLUSH valgrind output ? or configure it to flush
> results to file real time ?
> Asking because , in XML mode ( I have not observed in text output mode )
> valgrind output is NOT completely written until the process is terminated.
> Only when the terminate signal comes, the full output is suddenly written.
>
> Thank you,
> Ransara
>
>
|
|
From: Ransara W. <ran...@gm...> - 2018-06-13 02:29:13
|
Hi Brenda,
Thank you very much for the details. Require one more clarification.
Is there any way that I can FLUSH valgrind output ? or configure it to
flush results to file real time ?
Asking because , in XML mode ( I have not observed in text output mode )
valgrind output is NOT completely written until the process is terminated.
Only when the terminate signal comes, the full output is suddenly written.
Thank You,
Ransara
On Wed, Jun 13, 2018 at 2:06 AM Brenda Butler <bj...@mo...> wrote:
> #include <valgrind/memcheck.h>
>
> ...
> printf("Checking mem leak summary\n");
> VALGRIND_DO_QUICK_LEAK_CHECK;
> ...
> printf("Checking mem leak details\n");
> VALGRIND_DO_LEAK_CHECK;
> ...
>
>
>
>
> Call VALGRIND_DO_LEAK_CHECK before your "function of interest", then
> call your function, then call VALGRIND_DO_LEAK_CHECK after your
> "function of interest". If the output is different the second time
> from the first time, you had leaks.
>
> bjb
>
>
> On Tue, Jun 12, 2018 at 1:03 PM, Ransara Wijethunga <ran...@gm...>
> wrote:
> > Hi John,
> >
> > Thank you very much for the details. Require one more clarification.
> >
> > Referring to "Re-direct valgrind's error stream into a file, or use the
> XML
> > error log ........."
> > Yes, I'm using XML mode output and I check results using Valkyrie.
> >
> > Is there any way that I can FLUSH valgrind output ? or configure it to
> flush
> > results to file real time ?
> > Asking because , in XML mode ( I have not observed in text output mode )
> > valgrind output is NOT completely written until the process is
> terminated.
> > Only when the terminate signal comes, the full output is suddenly
> written.
> >
> > Thank you,
> > Ransara
> >
> >
>
--
http://www.linkedin.com/in/ransara
http://ransara.blogspot.com
|
|
From: John R. <jr...@bi...> - 2018-06-13 03:22:28
|
> Is there any way that I can FLUSH valgrind output ? or configure it to flush results to file real time ? Modify the source to valgrind so that valgrind achieves the effect of calling setlinebuf() on the FILE * without actually using libc [valgrind cannot use libc "directly".] Then re-build valgrind, install it somewhere, and run it. [Obviously: "$ man setlinebuf". Not-so-obviously: there's a control bit which can be found in the source for setlinebuf.] |