On Sun, 01 Jun 2003 17:57:50 +0100 John Lamb <J.D.Lamb@btinternet.com> wrote:
Does anyone have suggestions for a good way to find out what (local) pointers are pointing at what items on the heap?
I have a bug in a program that's almost certainly caused by two pointers pointing to the same object when they should be pointing to separate ones.
Treat this as a 'newbie' question. The answer might be a debugger, but I haven't had a bug serious enough to use a debugger in four years - one of the benefits of using c++ - so I've forgotten how to use one. I
usually just print variables to stdandard output. In addition to Salman's excellent response, you might also want to look at Valgrind. But, DDD can give you a very graphical description of your pointers and objects. With GDB and DDD you should be able to isolate when the pointers are set.
-- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9