From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id 08DBE3857836 for ; Fri, 28 May 2021 19:08:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 08DBE3857836 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jhb@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4F1EF93AB2; Fri, 28 May 2021 19:08:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FsDjc1Rfqz4ZrW; Fri, 28 May 2021 19:08:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id BDF98EE36; Fri, 28 May 2021 19:08:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: [PATCH] Fix printing of non pointer types when memory tagging is enabled To: Luis Machado , gdb-patches@sourceware.org References: <20210518202004.3492036-1-luis.machado@linaro.org> From: John Baldwin Message-ID: <579a4169-9f1c-0bc6-9f61-f9e777fa85a0@FreeBSD.org> Date: Fri, 28 May 2021 12:08:18 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <20210518202004.3492036-1-luis.machado@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 May 2021 19:08:36 -0000 On 5/18/21 1:20 PM, Luis Machado via Gdb-patches wrote: > When the architecture supports memory tagging, we handle pointer types > in a special way, so we can validate tags and show mismatches. > @@ -1266,18 +1266,22 @@ print_value (value *val, const value_print_options &opts) > static bool > should_validate_memtags (struct value *value) > { > - if (target_supports_memory_tagging () > - && gdbarch_tagged_address_p (target_gdbarch (), value)) > - { > - gdb_assert (value != nullptr && value_type (value) != nullptr); > + gdb_assert (value != nullptr && value_type (value) != nullptr); > > - enum type_code code = value_type (value)->code (); > + enum type_code code = value_type (value)->code (); > > - return (code == TYPE_CODE_PTR > - || code == TYPE_CODE_REF > - || code == TYPE_CODE_METHODPTR > - || code == TYPE_CODE_MEMBERPTR); > + try > + { > + if (code == TYPE_CODE_PTR > + && target_supports_memory_tagging () > + && gdbarch_tagged_address_p (target_gdbarch (), value)) > + return true; Hmm, so why only TYPE_CODE_PTR in the new code but TYPE_CODE_REF and method/member pointers in the old? -- John Baldwin