This is the mail archive of the
mailing list for the GDB project.
Re: segmentation fault
Daniel Jacobowitz escribió:
On Sat, Nov 11, 2006 at 09:29:39PM +0100, Raúl Huertas wrote:Yes, you are right, and I was incorrect:
Maybe I'm wrong, but sptr is a pointer, so it uses 0x804b028 and 0x804b029.
The memory pointed by this pointer is the one that has size 16.
You're incorrect, in fact. The original poster's interpretation is
reasonable, assuming that GDB has printed out the correct values of
servent * sptr1 = new servent;
servent * sptr2 = new servent;
servent * sptr3 = sptr1;
(gdb) p sptr1
$1 = (servent *) 0x804a008
(gdb) p sptr2
$2 = (servent *) 0x804a020
(gdb) p sptr3
$3 = (servent *) 0x804a008
gdb shows the content of the pointer, not the position of the pointer.
My idiot error... :*)