From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16262 invoked by alias); 1 Apr 2019 14:59:03 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 16250 invoked by uid 89); 1 Apr 2019 14:59:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-13.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,TRACKER_ID autolearn=ham version=3.3.1 spammy=HTo:U*palves, H*Ad:U*tromey X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 01 Apr 2019 14:59:02 +0000 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 027693082E63; Mon, 1 Apr 2019 14:59:01 +0000 (UTC) Received: from localhost (unused-10-15-17-196.yyz.redhat.com [10.15.17.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F53427CB3; Mon, 1 Apr 2019 14:59:00 +0000 (UTC) From: Sergio Durigan Junior To: Pedro Alves Cc: Tom Tromey , Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH] Destroy allocated values when exiting GDB References: <20190320140846.13031-1-tromey@adacore.com> <87r2azkhmq.fsf@redhat.com> <87mulnkcab.fsf@redhat.com> <87a7hjj7aw.fsf@tromey.com> <87ef6uj408.fsf@tromey.com> <87mulia94w.fsf@redhat.com> <87sgv9bwyg.fsf@tromey.com> <87tvfpr55a.fsf@redhat.com> <87y351mhki.fsf@redhat.com> <87sgv81nld.fsf@tromey.com> <5a2d4016-9e4d-dc18-8c3a-2c9ecf214c94@redhat.com> <87lg0xwe3t.fsf_-_@redhat.com> <369707f4-be00-5234-cbc6-5a5d7b1c5204@redhat.com> Date: Mon, 01 Apr 2019 14:59:00 -0000 In-Reply-To: <369707f4-be00-5234-cbc6-5a5d7b1c5204@redhat.com> (Pedro Alves's message of "Mon, 1 Apr 2019 15:08:46 +0100") Message-ID: <871s2lvkjv.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00003.txt.bz2 On Monday, April 01 2019, Pedro Alves wrote: > On 03/29/2019 09:43 PM, Sergio Durigan Junior wrote: > >> >> diff --git a/gdb/top.c b/gdb/top.c >> index b10b0649e9..ffbe8e517f 100644 >> --- a/gdb/top.c >> +++ b/gdb/top.c >> @@ -1672,6 +1672,9 @@ quit_force (int *exit_arg, int from_tty) >> } >> END_CATCH >> >> + /* Destroy any values currently allocated. */ >> + finalize_values (); > > I think that someone reading this without context may not realize > why we need to do that. How about extending the comment, like: > > /* Destroy any values currently allocated now instead of leaving it > to global destructors, because that may be too late. For > example, the destructors of xmethod values call into the Python > runtime, which is finalized via a final cleanup. */ Done. >> diff --git a/gdb/value.h b/gdb/value.h >> index d3905cc354..7853950ca3 100644 >> --- a/gdb/value.h >> +++ b/gdb/value.h >> @@ -1189,4 +1189,8 @@ extern struct value *call_xmethod (struct value *method, >> extern int value_union_variant (struct type *union_type, >> const gdb_byte *contents); >> >> +/* Destroy the values currently allocated. This is mostly called when >> + GDB is exiting (e.g., on quit_force). */ > > s/mostly// Done. >> +extern void finalize_values (); >> + >> #endif /* !defined (VALUE_H) */ > > LGTM with those changes. Thanks for the review. Pushed: 9d1447e09d4aa673826039321163b5a684e8e043 -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/