From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id lSaYLDCEBWdFYQYAWB0awg (envelope-from ) for ; Tue, 08 Oct 2024 15:12:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1728414768; bh=akj1UJAWDupGp1s5j4pQXDlgX+Nq5Y05p3SCIqSXdiM=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Pe4Q6i9Nf+BjrjVGhSx4oTGBsF0UMa7kqMGlk7kaLOZKmXdHVTd1O45GQQSxMEoH0 Q3bq2BzkZn+yc6GkZQJrLd9AzaZ44qe1il8a8hk3Sj5EWmwHYaO47DzfBfcfRsuVXl qcPseG1Eh6G0+btnM/YeRQQfMViEOF9FTKyrV0LQ= Received: by simark.ca (Postfix, from userid 112) id 903FB1E355; Tue, 8 Oct 2024 15:12:48 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,URIBL_BLOCKED,URIBL_DBL_BLOCKED_OPENDNS autolearn=unavailable autolearn_force=no version=4.0.0 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=OnYTKHN2; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=AyFGCvlY; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 083881E05C for ; Tue, 8 Oct 2024 15:12:48 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 97682385DDDD for ; Tue, 8 Oct 2024 19:12:47 +0000 (GMT) Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 471CD384F4BE for ; Tue, 8 Oct 2024 19:12:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 471CD384F4BE Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 471CD384F4BE Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728414750; cv=none; b=C1456gHwrWNFZRk0aMw4JGiCiPFSYd9QriF8TynQp46xbg10FU97ojj46D6l/9Q+v6Cj2Dxm6yx1NcHiFVk7w4MVOzus2/NHepIlhYnfCHCyfWC4PeH/boJs/1obrRAuMjH1VK/hXT4LDhUPU2J6YN6n8ShILSZBzW/xCHMkdEs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728414750; c=relaxed/simple; bh=akj1UJAWDupGp1s5j4pQXDlgX+Nq5Y05p3SCIqSXdiM=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version: Subject:To:From; b=kg+iOL3h/u5PcbrZHSq9uCn6fr0E++13wx8jgh5KhCqXOjLa5urWQMlbiIsg/swk6fSLiOey12Awb88OlA613Jjp6+BYDioCKRj8GxzBT5NTMrRIeqB78MIFNnUx15qs18ew734P5fxa5CIs/mMwdDLE/BAqAdxeAm10n0UrKsI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1728414746; bh=akj1UJAWDupGp1s5j4pQXDlgX+Nq5Y05p3SCIqSXdiM=; h=Date:Subject:To:References:From:In-Reply-To:From; b=OnYTKHN2Hb4HreQBMqsr6OfqoE1M0hpbHWWuXZ6vC4PpGpLTSW3C48SHoy0GvMILh wFTPMi8j7xTXJqzuBbmOFL0U1eD1mExVf+Qvqzfw36UMVvtHV5gpY20UlF9PL0NUt9 J1aFr5aHK1dGxzOnqxd7dGf3Vkdztvs+fozPF5fU= Received: by simark.ca (Postfix, from userid 112) id BBA331E356; Tue, 8 Oct 2024 15:12:26 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1728414745; bh=akj1UJAWDupGp1s5j4pQXDlgX+Nq5Y05p3SCIqSXdiM=; h=Date:Subject:To:References:From:In-Reply-To:From; b=AyFGCvlYq/SezClSvk3mLs2dYEfT1PYTy+lw1ta157daKJAGWHrp0iu1n3Qck1qw7 XZV5chJDfs1fzBR01JUK/CzU4ikPCMVd2lLDh7h7VWy5CS9FfWFFR6aBL4+3TGNAwJ 5Q2Z9wtqGhDe5JogHbHaCMCSnmt+s1xa+XyqYym4= Received: from [10.0.0.11] (modemcable238.237-201-24.mc.videotron.ca [24.201.237.238]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id A71931E05C; Tue, 8 Oct 2024 15:12:25 -0400 (EDT) Message-ID: Date: Tue, 8 Oct 2024 15:12:25 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/3] gdb: make use of set_tdesc_osabi overload in features/ files To: Andrew Burgess , gdb-patches@sourceware.org References: <805ec50236bae86f1e7e1d77ceff99763ec00ba4.1728239729.git.aburgess@redhat.com> Content-Language: en-US From: Simon Marchi In-Reply-To: <805ec50236bae86f1e7e1d77ceff99763ec00ba4.1728239729.git.aburgess@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 2024-10-06 14:37, Andrew Burgess wrote: > There are two versions of the set_tdesc_osabi function in GDB: > > void > set_tdesc_osabi (struct target_desc *target_desc, const char *name) > { > set_tdesc_osabi (target_desc, osabi_from_tdesc_string (name)); > } > > void > set_tdesc_osabi (struct target_desc *target_desc, enum gdb_osabi osabi) > { > target_desc->osabi = osabi; > } > > In the gdb/features/ files we call the second of these functions, like > this: > > set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("GNU/Linux")); > > This can be replaced with a call to the first set_tdesc_osabi > function, so lets do that. I think that this makes the features/ code > slightly simpler and easier to understand. > > There should be no user visible changes after this commit. Just a nit but... while at it, couldn't we change them to use the enumerator directly, to save lookups at runtime? set_tdesc_osabi (result.get (), GDB_OSABI_LINUX); I guess we would need a enum -> string (GDB_OSABI_LINUX -> "GDB_OSABI_LINUX") function, which we have for other enums. We just don't have it for this enum yet. Another case for adding a "magic enum" library :). Simon