Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Raúl Huertas" <raulh39@ya.com>
To: gdb@sourceware.org
Subject: Re: segmentation fault
Date: Sat, 11 Nov 2006 21:02:00 -0000	[thread overview]
Message-ID: <45563A6A.1060000@ya.com> (raw)
In-Reply-To: <20061111204559.GA15104@nevyn.them.org>

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... :*)


  reply	other threads:[~2006-11-11 21:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-11  1:21 Oliver Block
2006-11-11 20:29 ` Raúl Huertas
2006-11-11 20:46   ` Daniel Jacobowitz
2006-11-11 21:02     ` Raúl Huertas [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-11-11  1:23 Oliver Block
2004-06-10 21:08 John

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45563A6A.1060000@ya.com \
    --to=raulh39@ya.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox