|
From: dizzy <di...@ro...> - 2008-04-04 13:52:46
|
Hi I have noticed that sometimes, it would be very useful if valgrind would offer some kind of SDK for its checks that it already does transparently with memcheck but with the SDK I would be able to perform some more checks in key points in the source. To give a specific example, I have a networking layer that aggregates data sent by the high level code until it reaches a max size, then it flushes the data cached so far then it starts caching it again (this buffering is used in order to format the sent data in "chunks"). Now using valgrind memcheck reports (probably quite correct) that the send() socket call is sending some uninitialized bytes in the given buffer. Since there is decoupling from the point of adding bytes to the buffer to the point of actually flushing/sending the buffer over the network, the backtrace valgrind shows me with the moment of the wrong send() call which is not useful (it also shows the backtrace for the allocation of that buffer which is even less useful). I thought that if valgrind had some SDK so that I could (for debugging) call something like "valgrind_check(data, len)" in the code to perform the same check it does on send() system call buffer but I would call it on each call that adds data to the chunk buffer and as such a backtrace that I would get from valgrind when I get the uninitialized data will point me exactly at the source of the problem. Any idea how to achieve this? Thanks! -- Mihai RUSU Email: di...@ro... "Linux is obsolete" -- AST |
|
From: Paul W. <pa...@bl...> - 2008-04-04 15:46:26
|
On Fri, Apr 04, 2008 at 04:51:41PM +0300, dizzy wrote: > Any idea how to achieve this? valgrind/memcheck.h has a set of macros (e.g. VALGRIND_CHECK_MEM_IS_DEFINED) which seem to be exactly what you're after. -- Paul |