|
From: Paul P. <ppl...@go...> - 2009-08-12 14:23:09
|
On Wed, Aug 12, 2009 at 12:37 AM, Tom Hughes<to...@co...> wrote: > On 12/08/09 07:17, Paul Pluzhnikov wrote: > >> Nick Lewycky<nle...@go...> asks: >> >> ... how to query valgrind about the pointers it's been tracking >> throughout >> the life of the program. Things like "is this pointer still valid (and >> how many bytes may I dereference through it)" or "who freed this pointer >> and what was the call stack at the time" etc. > > This whole question is really based on a misunderstanding of how valgrind > works, or at least how memcheck works. I don't believe there is any misunderstanding. As my example session demonstrates, you have several pointer variables in the program, and you may want to ask "Is the memory pointed by 'q' still allocated? Has it been initialized? How many bytes am I allowed to read via 'q'? Who free()ed it? etc.". These are all questions about the *memory* pointed by 'q', not about 'q' itself. Cheers, -- Paul Pluzhnikov |