From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id a9szNrK0X2q8PiEAWB0awg (envelope-from ) for ; Tue, 21 Jul 2026 14:04:34 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=MKmpm5QX; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id CD4FE1E09E; Tue, 21 Jul 2026 14:04:34 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (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 E14F81E033 for ; Tue, 21 Jul 2026 14:04:33 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1A29B4BA2E27 for ; Tue, 21 Jul 2026 18:04:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A29B4BA2E27 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=MKmpm5QX Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id C34F14BA2E2B for ; Tue, 21 Jul 2026 18:03:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C34F14BA2E2B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C34F14BA2E2B Authentication-Results: sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784657018; cv=none; b=wAFMPCYusM3w0iyPMD90R5OTO1VoG6vnpphYpyZsCvQUJBpjIzTu7Ns3Jl/dVGb2ubVIgPCy2e5nQQJ581Y8dn4iuZEjzW3ZXU5vKlGtH+x/rbElMuWbNW0DzmUCzgn0zLj3oXgqfBGfeFkDCyoKM0Y+LOayUaqzxMffzvUcCLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784657018; c=relaxed/simple; bh=EP1VfPIsvu9QFWsF7rahBaInLd5qqVX0F2ypOE/OHCo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=T1a2goDzrjWHSQdt+cGwMlkwvZLHLh3zfwiWDBHc+cAgPy1mUAKk49Bp2j/+c69iyR0u0AJHtpUoc/hkU8GIx9RK27YgPyEoaLkv2jri7VzpCQLimDFuXmpDugQxgKZ33QeYQUGS13WUvqJv4DUW28qoxjmJHwwQEZ6+45ZF7Q8= ARC-Authentication-Results: i=1; sourceware.org; dkim=policy (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=MKmpm5QX reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C34F14BA2E2B Received: from eig-obgw-6005b.ext.cloudfilter.net ([10.0.30.162]) by cmsmtp with ESMTPS id mA4rwDRclQ4O6mEocwxqMi; Tue, 21 Jul 2026 18:03:38 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id mEobws2TbOYlBmEobwrkvX; Tue, 21 Jul 2026 18:03:37 +0000 X-Authority-Analysis: v=2.4 cv=FLYbx/os c=1 sm=1 tr=0 ts=6a5fb479 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=RAioF0-LDSMA:10 a=ItBw4LHWJt0A:10 a=zd2uoN0lAAAA:8 a=NfhPsLRo4QoasnGdE4kA:9 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=6NTIQWFSWcsDi1eijTtYjSqNVvMRzcxRCFu0g6otu5I=; b=MKmpm5QXQyrcsWc/l48BK7Txy2 jEzK44Yr39JggphKzC3A8wtR05/YwS6jehDBDkH/zR2WYmz0KSySYamk8TtuC/HOP7OnLPsaJuAWP ivmJ6RzkO2qh6aFJzXikrWq2E; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:42584 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.99.2) (envelope-from ) id 1wmEoa-00000003AeT-3UaD; Tue, 21 Jul 2026 12:03:36 -0600 From: Tom Tromey To: Tankut Baris Aktemur Cc: Subject: Re: [PATCH 02/16] gdb: convert address_class_type_flags_to_name to address_class_id_to_name In-Reply-To: <20260713-users-aktemur-type-instance-flags-v1-2-779cad0c85ec@amd.com> (Tankut Baris Aktemur's message of "Mon, 13 Jul 2026 09:00:01 -0500") References: <20260713-users-aktemur-type-instance-flags-v1-0-779cad0c85ec@amd.com> <20260713-users-aktemur-type-instance-flags-v1-2-779cad0c85ec@amd.com> X-Attribution: Tom Date: Tue, 21 Jul 2026 12:03:35 -0600 Message-ID: <87v7a8te2w.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.225.82 X-Source-L: No X-Exim-ID: 1wmEoa-00000003AeT-3UaD X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net (bapiya) [75.166.225.82]:42584 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfOxh3RFrKTeo8Xd9u3oZ/3HT42rHjvKZ/OGo1n2mshELcl3V8wzFwLnq26G85dGocJwdJROm8IYo0RsNlr5xyPD4VGOl49ToFOVxZHxajV32GZp3ku/k y/qsPSJy2fejskq2m1E8aFLtUGbbxeWgwBuE2pYiRee0GuxCg+g2lOZgQypUqfAtyDaUCYAxeV1pTWoScRTWpkNBbTSHdLwZi/4= 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 >>>>> Tankut Baris Aktemur writes: > In type instance flags, two bits are allocated for encoding the > address class. Although defined like a bitmask, those two bits in > fact represent an architecture-specific enum value. As a step towards > making this conceptual separation clear, refactor the gdbarch method > 'address_class_type_flags_to_name'. This method is used for returning > the name for the address class id encoded in type instance flags. > Make this clear by passing it the address class id, instead of the > whole flags. I have two small suggestions. > +ft32_address_class_id_to_name (struct gdbarch *gdbarch, > + unsigned int address_class) > { > - if (type_flags & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1) > + if (address_class == 1) First, I just wanted to point this out explicitly: normally I'd ding this for using a hard-coded constant; but in this case another function in the same file does essentially the same, and anyway this is a tdep file that hasn't perhaps had a non-refactoring patch since 2017. So I think this can slide. > Method( > type="const char *", > - name="address_class_type_flags_to_name", > - params=[("type_instance_flags", "type_flags")], > + name="address_class_id_to_name", > + params=[("unsigned int", "address_class")], > predicate=True, > ) I think this is a good opportunity to add a comment to describe the method. > - else if ((space_flag & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL) > - && gdbarch_address_class_type_flags_to_name_p (gdbarch)) > - return gdbarch_address_class_type_flags_to_name (gdbarch, space_flag); > + > + unsigned int aclass = TYPE_ADDRESS_CLASS_FROM_INSTANCE_FLAGS (space_flag); > + > + if (aclass != 0 > + && gdbarch_address_class_id_to_name_p (gdbarch)) > + return gdbarch_address_class_id_to_name (gdbarch, aclass); Here I think the code could check gdbarch_address_class_id_to_name_p and then unconditionally call it with whatever the value happens to be -- IMO we can assume that the arch methods handle 0. thanks, Tom