From: Daniel Jacobowitz <drow@false.org>
To: Christophe LYON <christophe.lyon@st.com>
Cc: gdb@sourceware.org
Subject: Re: GDB and C++: handling of POD/non-POD objects
Date: Tue, 28 Jun 2005 13:04:00 -0000 [thread overview]
Message-ID: <20050628130421.GA28098@nevyn.them.org> (raw)
In-Reply-To: <42C12B0C.39261B06@st.com>
On Tue, Jun 28, 2005 at 12:48:44PM +0200, Christophe LYON wrote:
>
> > > Here's a patch; I haven't updated or tested it in a while. I need to
> > > rework it, and I need to check a couple of existing disabled tests that
> > > it probably affects; I just haven't had the time yet.
> > >
>
> I have managed to include your patch in our gdb-6.1 source tree.
>
> However, I had to remove parts of the infcall.c patch, namely:
> + if (cp_struct_return)
> + {
> + struct value **new_args;
> +
> + /* Add the new argument to the front of the argument list. */
> + new_args = xmalloc (sizeof (struct value *) * (nargs + 1));
> + new_args[0] = value_from_pointer (lookup_pointer_type
> (value_type),
> + struct_addr);
> + memcpy (&new_args[1], &args[0], sizeof (struct value *) * nargs);
> + args = new_args;
> + nargs++;
> + args_cleanup = make_cleanup (xfree, args);
> + }
> + else
> + args_cleanup = make_cleanup (null_cleanup, NULL);
>
> (along with the declaration and cleanup of args_cleanup)
>
> Indeed, for our target, the pointer to the memory area reserved
> to hold the return value is passed as a hidden pointer, before
> 'this', but it does not make all the parameters shift.
>
> From what I found in the C++ abi, 3.1.4, the return value is
> passed in an implicit hidden pointer, so I guess we are right,
> and the code above is incorrect.
What target and compiler is this? This is contrary to the normal
interpretation of the ABI. 3.1.4 specifies that it is "an implicit
first parameter", which does imply a parameter shift.
This makes a substantial difference on ia64; this goes in the first
parameter register, instead of in the normal C structure return
register.
--
Daniel Jacobowitz
CodeSourcery, LLC
prev parent reply other threads:[~2005-06-28 13:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-20 8:45 Christophe LYON
2005-06-20 13:58 ` Daniel Jacobowitz
2005-06-21 11:59 ` Christophe LYON
2005-06-28 10:49 ` Christophe LYON
2005-06-28 13:04 ` Daniel Jacobowitz [this message]
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=20050628130421.GA28098@nevyn.them.org \
--to=drow@false.org \
--cc=christophe.lyon@st.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