public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  tromey/operator-new-delete: "fix" to destructor code
@ 2013-03-15 19:44 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2013-03-15 19:44 UTC (permalink / raw)
  To: archer-commits

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-03-15 19:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-15 19:44 [SCM] tromey/operator-new-delete: "fix" to destructor code tromey

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