Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Christophe LYON <christophe.lyon@st.com>
To: Daniel Jacobowitz <drow@false.org>, gdb@sourceware.org
Subject: Re: GDB and C++: handling of POD/non-POD objects
Date: Tue, 28 Jun 2005 10:49:00 -0000	[thread overview]
Message-ID: <42C12B0C.39261B06@st.com> (raw)
In-Reply-To: <42B80111.BA626F61@st.com>


> > 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.


Finally, I have not yet taken time to add true tests to the empty
pass-by-ref.exp you supplied.


Thanks for you help,

Christophe


  reply	other threads:[~2005-06-28 10:49 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 [this message]
2005-06-28 13:04       ` Daniel Jacobowitz

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=42C12B0C.39261B06@st.com \
    --to=christophe.lyon@st.com \
    --cc=drow@false.org \
    --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