public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
From: tromey@sourceware.org
To: archer-commits@sourceware.org
Subject: [SCM]  tromey/operator-new-delete: "fix" to destructor code
Date: Fri, 15 Mar 2013 19:44:00 -0000	[thread overview]
Message-ID: <20130315194427.16782.qmail@sourceware.org> (raw)

The branch, tromey/operator-new-delete has been updated
       via  aceae9a365ee619f3df2234fc8056ba75f32d1d5 (commit)
       via  813476a933b4f8a31c6e744e47fc3f08b1216864 (commit)
       via  3c18c6693aa0dc8845b5db784f8cbe5e68b36871 (commit)
      from  46e210c07d4ffe7e7885032ac005bec2545c36f0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit aceae9a365ee619f3df2234fc8056ba75f32d1d5
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Mar 14 12:55:09 2013 -0600

    "fix" to destructor code
    
    this fixes the destructor-finding code
    however, it then causes other crashes since we
    aren't following the ABI for array deletion

commit 813476a933b4f8a31c6e744e47fc3f08b1216864
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Mar 14 09:20:30 2013 -0600

    comment fix

commit 3c18c6693aa0dc8845b5db784f8cbe5e68b36871
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Mar 14 09:20:03 2013 -0600

    more README.archer updates

-----------------------------------------------------------------------

Summary of changes:
 README.archer  |   12 ++++++++++++
 gdb/valarith.c |   15 +++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

First 500 lines of diff:
diff --git a/README.archer b/README.archer
index 32cd4c7..15cdc67 100644
--- a/README.archer
+++ b/README.archer
@@ -13,8 +13,20 @@ It is incomplete:
   see definition of trivial dtor at least
 * also [class.free]
   when operator delete takes a second argument
+  when is this called?
 * No cookie is required if the new operator being used is ::operator
   new[](size_t, void*).
 * syntax for calling a destructor explicitly
   do we need to handle this specially?
   cannot be used with an implicit "this", must always be qualified
+  note this is ok:
+     typedef int I;
+     I *z;
+     z->I::~I();
+
+* the delete function is looked up at the point of definition of the
+  *dynamic* type's destructor
+  need a test for this
+  also a test for operator in namespace
+
+* operator delete with extra args
diff --git a/gdb/valarith.c b/gdb/valarith.c
index b2c5d44..8cd4de4 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -756,7 +756,7 @@ value_construct (struct type *type, int argc, struct value **argv)
 
   if (function == NULL)
     {
-      /* No construct is fine for a POD.  */
+      /* No constructor is fine for a POD.  */
       if (argc == 1)
 	return;
 
@@ -855,10 +855,12 @@ struct value *
 value_destruct (struct value *object, int is_array)
 {
   const char *destr_name;
+  char *destr_qual_name;
   struct type *type;
   int i;
   struct symbol *sym;
   struct value *function;
+  struct cleanup *cleanup;
 
   type = check_typedef (value_type (object));
   gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR);
@@ -870,6 +872,9 @@ value_destruct (struct value *object, int is_array)
   if (TYPE_CODE (type) != TYPE_CODE_STRUCT)
     return NULL;
 
+  if (TYPE_NAME (type) == NULL)
+    return NULL;
+
   /* Find the destructor name, if we can.  */
   destr_name = NULL;
   for (i = 0; destr_name == NULL && i < TYPE_NFN_FIELDS (type); ++i)
@@ -892,7 +897,13 @@ value_destruct (struct value *object, int is_array)
   if (destr_name == NULL)
     return NULL;
 
-  sym = lookup_symbol (destr_name, NULL, VAR_DOMAIN, NULL);
+  destr_qual_name = concat (TYPE_NAME (type), "::", destr_name,
+			    (char *) NULL);
+  cleanup = make_cleanup (xfree, destr_qual_name);
+
+  sym = lookup_symbol (destr_qual_name, NULL, VAR_DOMAIN, NULL);
+  do_cleanups (cleanup);
+
   if (sym == NULL)
     return NULL;
 


hooks/post-receive
--
Repository for Project Archer.


                 reply	other threads:[~2013-03-15 19:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20130315194427.16782.qmail@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=archer-commits@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).