From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 1C1333858C52 for ; Fri, 3 Feb 2023 15:53:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1C1333858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675439595; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0MgEA1Cj+vs5am6TkcN/TyuYx9ug8NjQ9urV7s49p0k=; b=EOSyA2Hq2IqUmET9vF4hrshDlPLpzazFfSDZhPAoDWMnbRGepzUm3rizKxe9wlYWPdmi4K IlZtqwPYSyeGnWAMO5eaJQ0mIymnlRK7V03MoivSaW5ZzXp1W/0JyR1tsa/mGSlHYpaCQk MWQL9SSaFXHUOUIHSvCyizwHXJC3j8M= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-67-qcmeHJokPWaTsVQve9v1lw-1; Fri, 03 Feb 2023 10:53:14 -0500 X-MC-Unique: qcmeHJokPWaTsVQve9v1lw-1 Received: by mail-qt1-f199.google.com with SMTP id l3-20020a05622a174300b003b9b6101f65so2824022qtk.11 for ; Fri, 03 Feb 2023 07:53:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0MgEA1Cj+vs5am6TkcN/TyuYx9ug8NjQ9urV7s49p0k=; b=7R8o//yho5J+EUxlp/xSdgfn9WqG0FSfgAF46Np/CExBMbfnzODE1GyfROw2yvjDwq Agv63AhNy2xg0we39PCjZySn/6TDCn+AG8+ZXPhgQY0rlv83J/OBspRQmU0XZg4Dcb5y 7aS8kigqEiwN05tJZmDOnGix1PDk+gLewFwliT2RunC1JNW7e66GXNwrDc5gEqxA5B2X 8UPDry3UIOmUnvhNb1GPy4A8u8kJc1Q7VKG/qmnM6EG7Z5xAzJDpcnG8vr1GZ7yf48vP YWeke4A59W3lKf4TAOFBUOJDq0ZN3AqKcLgVWPZomVitEhUNYUgrbA1j24gUf4fk+wOa PlKQ== X-Gm-Message-State: AO0yUKXxfgWFQ/sIxCQipuFuLIopTGEi4JKc7eG6vJQhB18/zGyRU/RM 9lQ7n6SRndCbI8Wr2bbBwnqqNMDInvPUXyvou5RjOWEFJM+6m4UszkJFCSQp1Pkj3UJeURPndJu ytoKceFaDl0fjsKpIoYP0mzssCSxOCARJFzn0ubiZ5n6rZUmiUscdUzDkSWu9zuqGpjcDvF4g4A == X-Received: by 2002:ad4:4f14:0:b0:548:b6e0:fc2d with SMTP id fb20-20020ad44f14000000b00548b6e0fc2dmr14016565qvb.2.1675439593922; Fri, 03 Feb 2023 07:53:13 -0800 (PST) X-Google-Smtp-Source: AK7set/2Wj0kKOxOfy9sICvHrTKKirQjXg4mOb3ve7TZcbY1K3SDce6M83ToloIY3An16JztM0Gsgg== X-Received: by 2002:ad4:4f14:0:b0:548:b6e0:fc2d with SMTP id fb20-20020ad44f14000000b00548b6e0fc2dmr14016538qvb.2.1675439593479; Fri, 03 Feb 2023 07:53:13 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id bk19-20020a05620a1a1300b006f9f3c0c63csm2074661qkb.32.2023.02.03.07.53.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 07:53:13 -0800 (PST) From: Andrew Burgess To: Simon Marchi via Gdb-patches , gdb-patches@sourceware.org Cc: Simon Marchi Subject: Re: [PATCH 3/5] gdb: remove get_tdesc_info In-Reply-To: <20230203142126.286866-4-simon.marchi@polymtl.ca> References: <20230203142126.286866-1-simon.marchi@polymtl.ca> <20230203142126.286866-4-simon.marchi@polymtl.ca> Date: Fri, 03 Feb 2023 15:53:11 +0000 Message-ID: <874js2sq3c.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Simon Marchi via Gdb-patches writes: > Remove this function, since it's now a trivial access to > inferior::tdesc_info. > > Change-Id: I3e88a8214034f1a4163420b434be11f51eef462c > --- > gdb/target-descriptions.c | 28 ++++++++++------------------ > 1 file changed, 10 insertions(+), 18 deletions(-) > > diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c > index 049e42c7ea77..0561a8098c5c 100644 > --- a/gdb/target-descriptions.c > +++ b/gdb/target-descriptions.c > @@ -436,14 +436,6 @@ struct tdesc_arch_data > gdbarch_register_reggroup_p_ftype *pseudo_register_reggroup_p = NULL; > }; > > -/* Get the inferior INF's target description info. */ > - > -static struct target_desc_info * > -get_tdesc_info (struct inferior *inf) > -{ > - return &inf->tdesc_info; > -} > - > /* A handle for architecture-specific data associated with the > target description (see struct tdesc_arch_data). */ > > @@ -472,8 +464,8 @@ target_desc_info_from_user_p (struct target_desc_info *info) > void > copy_inferior_target_desc_info (struct inferior *destinf, struct inferior *srcinf) > { > - struct target_desc_info *src = get_tdesc_info (srcinf); > - struct target_desc_info *dest = get_tdesc_info (destinf); > + struct target_desc_info *src = &srcinf->tdesc_info; > + struct target_desc_info *dest = &destinf->tdesc_info; > > *dest = *src; Would: destinf->tdesc_info = srcinf->tdesc_info; not be better now? Thanks, Andrew > } > @@ -488,7 +480,7 @@ static std::string tdesc_filename_cmd_string; > void > target_find_description (void) > { > - target_desc_info *tdesc_info = get_tdesc_info (current_inferior ()); > + target_desc_info *tdesc_info = ¤t_inferior ()->tdesc_info; > > /* If we've already fetched a description from the target, don't do > it again. This allows a target to fetch the description early, > @@ -551,7 +543,7 @@ target_find_description (void) > void > target_clear_description (void) > { > - target_desc_info *tdesc_info = get_tdesc_info (current_inferior ()); > + target_desc_info *tdesc_info = ¤t_inferior ()->tdesc_info; > > if (!tdesc_info->fetched) > return; > @@ -571,7 +563,7 @@ target_clear_description (void) > const struct target_desc * > target_current_description (void) > { > - target_desc_info *tdesc_info = get_tdesc_info (current_inferior ()); > + target_desc_info *tdesc_info = ¤t_inferior ()->tdesc_info; > > if (tdesc_info->fetched) > return tdesc_info->tdesc; > @@ -1246,7 +1238,7 @@ static void > set_tdesc_filename_cmd (const char *args, int from_tty, > struct cmd_list_element *c) > { > - target_desc_info *tdesc_info = get_tdesc_info (current_inferior ()); > + target_desc_info *tdesc_info = ¤t_inferior ()->tdesc_info; > > tdesc_info->filename = tdesc_filename_cmd_string; > > @@ -1259,7 +1251,7 @@ show_tdesc_filename_cmd (struct ui_file *file, int from_tty, > struct cmd_list_element *c, > const char *value) > { > - value = get_tdesc_info (current_inferior ())->filename.data (); > + value = current_inferior ()->tdesc_info.filename.data (); > > if (value != NULL && *value != '\0') > gdb_printf (file, > @@ -1274,7 +1266,7 @@ show_tdesc_filename_cmd (struct ui_file *file, int from_tty, > static void > unset_tdesc_filename_cmd (const char *args, int from_tty) > { > - target_desc_info *tdesc_info = get_tdesc_info (current_inferior ()); > + target_desc_info *tdesc_info = ¤t_inferior ()->tdesc_info; > > tdesc_info->filename.clear (); > target_clear_description (); > @@ -1730,7 +1722,7 @@ maint_print_c_tdesc_cmd (const char *args, int from_tty) > architecture's. This lets a GDB for one architecture generate C > for another architecture's description, even though the gdbarch > initialization code will reject the new description. */ > - target_desc_info *tdesc_info = get_tdesc_info (current_inferior ()); > + target_desc_info *tdesc_info = ¤t_inferior ()->tdesc_info; > tdesc = tdesc_info->tdesc; > filename = tdesc_info->filename.data (); > } > @@ -1803,7 +1795,7 @@ maint_print_xml_tdesc_cmd (const char *args, int from_tty) > architecture's. This lets a GDB for one architecture generate XML > for another architecture's description, even though the gdbarch > initialization code will reject the new description. */ > - tdesc = get_tdesc_info (current_inferior ())->tdesc; > + tdesc = current_inferior ()->tdesc_info.tdesc; > } > else > { > -- > 2.39.1