From patchwork Thu Mar 13 17:04:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 72 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (caibbdcaabja.dreamhost.com [208.113.200.190]) by wilcox.dreamhost.com (Postfix) with ESMTP id A66A3360158 for ; Thu, 13 Mar 2014 10:05:13 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14314964) id 5123162FFB64C; Thu, 13 Mar 2014 10:05:13 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx23.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx23.g.dreamhost.com (Postfix) with ESMTPS id 19C1F631D4871 for ; Thu, 13 Mar 2014 10:05:13 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=HxWzitwtiSnJLx0QHec4ukTTSMupQ 0KDPHcnpYq0Wu5tApYfMkZC+OPVCLM7jdZCWpl/bI2J/N98gki5OKiwk4VIGj4Wa qqZLGHmqzFWayhp/gGfWQvCG5b/0ZZKN/8Q/7cqxSED7x892ZLuc+jLHXIS4Vfod BtHMikfYX1Z8UM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; s=default; bh=9y956MU1UaDuCkK4Tgb1Wt1wyuw=; b=qIx BM3HgSzlR/hj10y1X1zVsP6JdqIKc6vu8WegFKJ6D/SMM28FiY43YtEA3Sf04q1Y af8uX2tz1wzwIovsw6l3dxDUYxNUXmiUAbgNBW9koSXxaBwqn2xyjripZQfaijLf 6Niu8ZxL7SZRszT3liPnca1cIHVQ5s6cY/eRESxA= Received: (qmail 25537 invoked by alias); 13 Mar 2014 17:05:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 25526 invoked by uid 89); 13 Mar 2014 17:05:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-pd0-f177.google.com Received: from mail-pd0-f177.google.com (HELO mail-pd0-f177.google.com) (209.85.192.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 13 Mar 2014 17:05:09 +0000 Received: by mail-pd0-f177.google.com with SMTP id y10so1323921pdj.22 for ; Thu, 13 Mar 2014 10:05:07 -0700 (PDT) X-Received: by 10.66.118.71 with SMTP id kk7mr3743160pab.14.1394730307553; Thu, 13 Mar 2014 10:05:07 -0700 (PDT) Received: from seba.sebabeach.org.gmail.com (173-13-178-53-sfba.hfc.comcastbusiness.net. [173.13.178.53]) by mx.google.com with ESMTPSA id om6sm8645035pbc.43.2014.03.13.10.05.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Mar 2014 10:05:06 -0700 (PDT) From: Doug Evans To: gdb-patches@sourceware.org Subject: [commit] Fix pr guile/16612 Date: Thu, 13 Mar 2014 10:04:57 -0700 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes X-DH-Original-To: gdb@patchwork.siddhesh.in Hi. fyi, I committed this patch. Regression tested on amd64-linux. 2014-03-13 Doug Evans PR guile/16612 * guile/scm-type.c (tyscm_copy_type_recursive): Move type to its new eq?-hashtab. testsuite/ PR guile/16612 * gdb.guile/scm-value.ep (test_value_after_death): Do a garbage collect after discarding symbols. diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c index 4fa0c28..9345c28 100644 --- a/gdb/guile/scm-type.c +++ b/gdb/guile/scm-type.c @@ -363,11 +363,30 @@ tyscm_copy_type_recursive (void **slot, void *info) type_smob *t_smob = (type_smob *) *slot; htab_t copied_types = info; struct objfile *objfile = TYPE_OBJFILE (t_smob->type); + htab_t htab; + eqable_gdb_smob **new_slot; + type_smob t_smob_for_lookup; gdb_assert (objfile != NULL); htab_empty (copied_types); t_smob->type = copy_type_recursive (objfile, t_smob->type, copied_types); + + /* The eq?-hashtab that the type lived in is going away. + Add the type to its new eq?-hashtab: Otherwise if/when the type is later + garbage collected we'll assert-fail if the type isn't in the hashtab. + PR 16612. + + Types now live in "arch space", and things like "char" that came from + the objfile *could* be considered eq? with the arch "char" type. + However, they weren't before the objfile got deleted, so making them + eq? now is debatable. */ + htab = tyscm_type_map (t_smob->type); + t_smob_for_lookup.type = t_smob->type; + new_slot = gdbscm_find_eqable_gsmob_ptr_slot (htab, &t_smob_for_lookup.base); + gdb_assert (*new_slot == NULL); + gdbscm_fill_eqable_gsmob_ptr_slot (new_slot, &t_smob->base); + return 1; } diff --git a/gdb/testsuite/gdb.guile/scm-value.exp b/gdb/testsuite/gdb.guile/scm-value.exp index a85d5bd..0bcd381 100644 --- a/gdb/testsuite/gdb.guile/scm-value.exp +++ b/gdb/testsuite/gdb.guile/scm-value.exp @@ -286,6 +286,9 @@ proc test_value_after_death {} { "Discard symbol table from.*y or n. $" \ "y" + # First do a garbage collect to delete anything unused. PR 16612. + gdb_scm_test_silent_cmd "gu (gc)" "garbage collect" + # Now create a value using that type. Relies on arg0, created by # test_value_in_inferior. gdb_scm_test_silent_cmd "gu (define castval (value-cast arg0 (type-pointer ptrtype)))" \