From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9288 invoked by alias); 11 Nov 2006 21:02:43 -0000 Received: (qmail 9280 invoked by uid 22791); 11 Nov 2006 21:02:42 -0000 X-Spam-Check-By: sourceware.org Received: from smtp02.ya.com (HELO smtpauth.ya.com) (62.151.11.161) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 11 Nov 2006 21:02:38 +0000 Received: from [83.61.43.102] (helo=[192.168.1.2]) by smtpauth.ya.com with asmtp id 1Gizzm-0005RE-00 for gdb@sourceware.org; Sat, 11 Nov 2006 22:02:34 +0100 Message-ID: <45563A6A.1060000@ya.com> Date: Sat, 11 Nov 2006 21:02:00 -0000 From: =?ISO-8859-1?Q?Ra=FAl_Huertas?= User-Agent: Thunderbird 1.5.0.7 (X11/20060921) MIME-Version: 1.0 To: gdb@sourceware.org Subject: Re: segmentation fault References: <200611110221.11772.oliver@block-online.eu> <455632B3.2020909@ya.com> <20061111204559.GA15104@nevyn.them.org> In-Reply-To: <20061111204559.GA15104@nevyn.them.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-11/txt/msg00076.txt.bz2 Daniel Jacobowitz escribió: > On Sat, Nov 11, 2006 at 09:29:39PM +0100, Raúl Huertas wrote: > >> No. ;) >> 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 > variables. > > Yes, you are right, and I was incorrect: struct servent { char memory[16]; }; int main() { 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... :*)