|
From: Julian S. <js...@ac...> - 2006-05-16 11:56:39
|
This is a FAQ, although I can't find it on any of our documentation. Most likely explanation is that V isn't handling uninitialised memory in the way you expect. See here for details http://www.valgrind.org/docs/manual/mc-manual.html#mc-manual.machine The short story is that whilst it's true that callocing the buffer gives you a defined buffer, it's what happens after calloc and before the write that matters. Hence: char* p = calloc(...) p[1] = .. some uninitialised value .. write(.., p, ..) will get you the same complaint. Usually, the uninitialised junk in the buffer is as a result of doing assignments to struct-typed lvalues in the buffer. The uninitialised stuff is padding bytes in the struct(s). > Is it possible to directly manipulate the A and V bits of memcheck from > within the program by linking with some sort of valgrind stub library > which could communicate with valgrind at runtime. Naturally. It doesn't even require a stub library. See http://www.valgrind.org/docs/manual/manual-core.html#manual-core.clientreq and http://www.valgrind.org/docs/manual/mc-manual.html#mc-manual.clientreqs (you need to read both; read the first URL first). J |