From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102562 invoked by alias); 10 Jul 2019 17:02:57 -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 102554 invoked by uid 89); 10 Jul 2019 17:02:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Jul 2019 17:02:56 +0000 Received: from [172.16.0.120] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 830A41E05C; Wed, 10 Jul 2019 13:02:54 -0400 (EDT) Subject: Re: [PATCH 3/9] Change jit.c to use type-safe registry To: Tom Tromey , gdb-patches@sourceware.org References: <20190710153947.25721-1-tromey@adacore.com> <20190710153947.25721-4-tromey@adacore.com> From: Simon Marchi Message-ID: <1e4013e9-2673-681f-1dba-a2dcf693cb3a@simark.ca> Date: Wed, 10 Jul 2019 17:02:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20190710153947.25721-4-tromey@adacore.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-07/txt/msg00269.txt.bz2 > diff --git a/gdb/jit.c b/gdb/jit.c > index 62942fc7ab0..fba2482ff13 100644 > --- a/gdb/jit.c > +++ b/gdb/jit.c > @@ -50,8 +50,6 @@ static const char *const jit_break_name = "__jit_debug_register_code"; > > static const char *const jit_descriptor_name = "__jit_debug_descriptor"; > > -static const struct program_space_data *jit_program_space_data = NULL; > - > static void jit_inferior_init (struct gdbarch *gdbarch); > static void jit_inferior_exit_hook (struct inferior *inf); > > @@ -263,6 +261,8 @@ struct jit_program_space_data > struct breakpoint *jit_breakpoint; > }; > > +static program_space_key jit_program_space_key; > + > /* Per-objfile structure recording the addresses in the program space. > This object serves two purposes: for ordinary objfiles, it may > cache some symbols related to the JIT interface; and for > @@ -316,29 +316,16 @@ add_objfile_entry (struct objfile *objfile, CORE_ADDR entry) > if not already present. */ > > static struct jit_program_space_data * > -get_jit_program_space_data (void) > +get_jit_program_space_data () > { > struct jit_program_space_data *ps_data; > > - ps_data > - = ((struct jit_program_space_data *) > - program_space_data (current_program_space, jit_program_space_data)); > + ps_data = jit_program_space_key.get (current_program_space); > if (ps_data == NULL) > - { > - ps_data = XCNEW (struct jit_program_space_data); > - set_program_space_data (current_program_space, jit_program_space_data, > - ps_data); > - } > - > + ps_data = jit_program_space_key.emplace (current_program_space); > return ps_data; > } Do the fields of jit_program_space_data need to be initialized? The previous code used XCNEW, initializing them to 0. Simon