From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16839 invoked by alias); 15 Mar 2013 19:44:29 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 16797 invoked by uid 306); 15 Mar 2013 19:44:27 -0000 Date: Fri, 15 Mar 2013 19:44:00 -0000 Message-ID: <20130315194427.16782.qmail@sourceware.org> From: tromey@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] tromey/operator-new-delete: "fix" to destructor code X-Git-Refname: refs/heads/tromey/operator-new-delete X-Git-Reftype: branch X-Git-Oldrev: 46e210c07d4ffe7e7885032ac005bec2545c36f0 X-Git-Newrev: aceae9a365ee619f3df2234fc8056ba75f32d1d5 X-SW-Source: 2013-q1/txt/msg00260.txt.bz2 List-Id: 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 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 Date: Thu Mar 14 09:20:30 2013 -0600 comment fix commit 3c18c6693aa0dc8845b5db784f8cbe5e68b36871 Author: Tom Tromey 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.