From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id wo51MWAxB2pOVT0AWB0awg (envelope-from ) for ; Fri, 15 May 2026 10:44:48 -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=vyOj9ibh; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B14C11E0B1; Fri, 15 May 2026 10:44:48 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 97FB21E093 for ; Fri, 15 May 2026 10:44:47 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 11F7040A1F96 for ; Fri, 15 May 2026 14:44:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 11F7040A1F96 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=vyOj9ibh Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id 8A23C40A24B1 for ; Fri, 15 May 2026 14:44:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8A23C40A24B1 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 8A23C40A24B1 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=1778856259; cv=none; b=jy5WZszYYlS7i8jmZMiwb8fujivQMPePVN+PPlEVyfvhjlR28yNHqUGT2Xunt99RDATTjIIK/7GftySX8qf9ZL/UgBhmvpWCjQjWm7GDH4ajXyHfxe4zz2kIPwLvzxFzuGmTJFxDHmgOfP2WW1kE8kM2gRbL5WmBM7q+RfmN9YI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778856259; c=relaxed/simple; bh=F6TS3AoiQ7JSrv9C7hI95gECBVhXLqX8FUwI/46EGw8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Wd8JLLnF4eXwN2D/c4zzvHYM/wjuvidp6pi1K0XdFz9XpTa0EN6QLx9/3+669RLw/IWyRqeZQmAg5fAHWKqBZE4NrD9TO2w3AWQYjv6jbTwzjYvjGE08NT/+OkFD14AsC8/8E6vwCJ2V8Qq9WR2xG4xp41tTocj7zU4zd5ZmMpI= 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=vyOj9ibh reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A23C40A24B1 Received: from eig-obgw-6005b.ext.cloudfilter.net ([10.0.30.162]) by cmsmtp with ESMTPS id NtgywdRpunv6VNtlywFqgI; Fri, 15 May 2026 14:44:18 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id NtltwaGMaD6ICNtltwRALv; Fri, 15 May 2026 14:44:14 +0000 X-Authority-Analysis: v=2.4 cv=DcUXqutW c=1 sm=1 tr=0 ts=6a073142 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=NGcC8JguVDcA:10 a=ItBw4LHWJt0A:10 a=20KFwNOVAAAA:8 a=pg_ta6pbCdHhzeuryqgA: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=cBN4b0AhAShsScEic/tRCA9Mc0AQE929LAmD/N4bzmk=; b=vyOj9ibhla/Wr6yXhCpGlHp3bf tfVXK+ADiHGekK5Qd9WHVVixUgoQR41JApqk0Xix8zypqxyGOpHV+NGIjN2Khsq5/r6FwdzwXkdHP A7yshfVfeuUNEmOEOnjuDsrYw; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:45382 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.99.2) (envelope-from ) id 1wNtlt-00000003FbR-18bV; Fri, 15 May 2026 08:44:13 -0600 From: Tom Tromey To: Andrew Burgess Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH 2/6] gdb: use TARGET_CHAR_BIT more in dwarf2/expr.c In-Reply-To: <87y0hkdgs4.fsf@redhat.com> (Andrew Burgess's message of "Fri, 15 May 2026 13:00:11 +0100") References: <7865aefc9044e187b325f71ed2443f1ccf43c30e.1778579473.git.aburgess@redhat.com> <87tssbl58d.fsf@tromey.com> <87y0hkdgs4.fsf@redhat.com> X-Attribution: Tom Date: Fri, 15 May 2026 08:44:12 -0600 Message-ID: <87o6igivgj.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: 1wNtlt-00000003FbR-18bV X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net (bapiya) [75.166.225.82]:45382 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: MS4xfEKTw+HzNOLPjx4+CwOnACgEyqgJsnhFNWotfOnmsQI/DkJ6IRUyh+SmuuWdK31eWh1v7Aix6WTxf/Rk9v4n1nAnTg+6Nuopu2iBNaKRvf6kmw4rxM43 Q9c9WNy9/HHzu50wa7D2krvbFwupaMM7ZyJfEmiLOwQoguqJE0JqsXguJ0KS4bWXyuaH2Hd19tyMp94OtaZQnOD/eTN4KMjNtOg= 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 >>>>> "Andrew" == Andrew Burgess writes: Andrew> if (!check_optimized) Andrew> copy_bitwise (v_contents, offset, Andrew> - buffer.data (), bits_to_skip % 8, Andrew> + buffer.data (), bits_to_skip % TARGET_CHAR_BIT, Andrew> this_size_bits, bits_big_endian); >> In this situation it seems to me that gdb is manipulating host-side data. Andrew> Aren't the value contents pulled from the inferior though? And Andrew> bits_to_skip and this_size_bits are all from DWARF properties that Andrew> describe the inferior's data, so I don't understand why TARGET_CHAR_BIT Andrew> wouldn't be correct? I got really confused trying to reason this all Andrew> through. Yeah, I think it's confusing as well, and I'm not really sure if I am correct. But, my reasoning is that here we are dealing with host-side data. It is stored as 8-bit bytes in 'buffer'. And, in this spot we are dealing with bit offsets. To find the correct data, we have to convert this to a byte offset in 'buffer' -- but buffer is in host-side units and so, I think, we need a host-side conversion. If the DWARF originally specified the offset as a byte offset, then it was already multiplied by TARGET_CHAR_BIT when converting to a bit offset. Alternatively if the DWARF originally specified the offset as a bit offset, bit offsets aren't dependent on the byte size. So using the host size is still correct since that will find the correct data in 'buffer'. Andrew> Maybe the 8-bit byte assumption is just baked into GDB too much? My feeling is yes. If gdb ever had to target a machine with 9-bit bytes I would quit and start a farm or learn deep-sea welding. Something easy. I think there's been some attempt at targeting a machine with 16-bit "bytes" (see the addressable_memory_unit_size gdbarch hook). Some multiple of 8 is maybe doable. Andrew> I eventually just decided to drop this patch from the series. I'm sorry about that. I do think it's fine to do, as a marker for what might need to change. Tom