|
From: Nicholas N. <nj...@cs...> - 2005-08-26 18:16:27
|
On Fri, 26 Aug 2005, Jeroen N. Witmond wrote: > Just for a lark, I ran the program in my previous post under > valgrind/memcheck 3.1.SVN. Unfortunately, this shows a possible problem in > valgrind: the output of the printf on line 16 is produced twice. The > output of valgrind -v appears below. I think what Valgrind is doing is ok. Your printf() call doesn't end in a newline and so the output doesn't have to be flushed to stdout immediately. As a result, it's still sitting in the printf buffer when the fork occurs. And then it subsequently gets flushed in the parent and the child. If you add a newline to the printf() call, or call fflush(stdout) after the printf() call, the string only gets printed once when run under Valgrind. > Also unfortunately, I cannot get gdb to do useful things with the core > produced under valgrind. Valgrind's core-dumping code got disabled in the 2.x-to-3.x transition because it had lots of x86-specific code, and it hasn't been reenabled yet. It would be a good project for someone who's feeling motivated. Nick |