|
From: Peter T. <pt...@li...> - 2008-10-27 23:20:35
|
Hi all I have been using valgrind for a few years - wonderful program! I have just stumbled upon a problem I am uncertain how to handle. I have a C-based program "test_prg" which runs with an argument - of which I have many. I have a test test setup, which runs my program under valgrind with each of the possible arguments. (valgrind ./test_prg AA > valgrind_stdout_AA) >& valgrind_stderr_AA (valgrind ./test_prg AB > valgrind_stdout_AB) >& valgrind_stderr_AB ... <lots of lines discarded> (valgrind ./test_prg ZZ > valgrind_stdout_ZZ) >& valgrind_stderr_ZZ if I have memory problems I see this easily by doing $ grep "ERROR SUMMARY" valgrind_stderr* My problem is that in the valgrind_stderr files I have no easy way nor systematic way to detect if my program exits with a non-zero exit code. Valgrind does not seem to track exits. Can you think of a smart way to both track memory bugs _and_ non-zero exit codes (any exception) in one run. I look forward to your input :-)) Best -- Peter Toft <pt...@li...> |
|
From: Julian S. <js...@ac...> - 2008-10-27 23:34:55
|
> (valgrind ./test_prg AA > valgrind_stdout_AA) >& valgrind_stderr_AA Can't you do something like this (valgrind ./test_prg AB > valgrind_stdout_AB) >& valgrind_stderr_AB ; \ echo $? >> valgrind_stderr_AB ? J |
|
From: Peter T. <pt...@li...> - 2008-10-28 08:26:48
|
2008/10/28 Julian Seward <js...@ac...>: > >> (valgrind ./test_prg AA > valgrind_stdout_AA) >& valgrind_stderr_AA > > Can't you do something like this > > (valgrind ./test_prg AB > valgrind_stdout_AB) >& valgrind_stderr_AB ; \ > echo $? >> valgrind_stderr_AB It does not seem to fly. I think the exit code you catch is that from valgrind, not the process. I don't fully understand whether the valgrind option "--error-exitcode=<code>" could be used. Best -- Peter Toft <pt...@li...> |
|
From: Peter T. <pt...@li...> - 2008-10-28 08:52:09
|
2008/10/28 Peter Toft <pt...@li...>: > 2008/10/28 Julian Seward <js...@ac...>: >> >>> (valgrind ./test_prg AA > valgrind_stdout_AA) >& valgrind_stderr_AA >> >> Can't you do something like this >> >> (valgrind ./test_prg AB > valgrind_stdout_AB) >& valgrind_stderr_AB ; \ >> echo $? >> valgrind_stderr_AB > > It does not seem to fly. I think the exit code you catch is that from > valgrind, not the process. > I don't fully understand whether the valgrind option > "--error-exitcode=<code>" could be used. Sorry, your suggestion is valid and good. I was tricked my the makefile I embedded the hack into. Thanx!! -- Peter Toft <pt...@li...> |