From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id na3kMZaC+2jeOwYAWB0awg (envelope-from ) for ; Fri, 24 Oct 2025 09:43:50 -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=wsI5qlXg; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id BF38B1E04C; Fri, 24 Oct 2025 09:43:50 -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 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 F22CD1E04C for ; Fri, 24 Oct 2025 09:43:49 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5A1303858433 for ; Fri, 24 Oct 2025 13:43:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A1303858433 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=wsI5qlXg Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id 37C573858D3C for ; Fri, 24 Oct 2025 13:43:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 37C573858D3C 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 37C573858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761313396; cv=none; b=kJM7kq+oMpEFZgQ7HpSN73XoW5t52qSDiggPOopseFgX9I4VRafOXl5t7LR8zEhRyLyYs9LFdf/6rKRz59d3b5Z2KQg1XQldUE4L/5wTXKQgFKIGCJ/4KLP1t9ytfgHCSsm4HDVR1WMwvz3Ryv5keunOreh8xu9a+SO9KQRYduU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761313396; c=relaxed/simple; bh=x47hXsSGwinbFu6O7yABhKuSbDpfwdkpD5hnj3c19/w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=kP8byybtb5kuRKbG30nxnYSr4bpchH6lvCLvzRsfWv9J/733jlxgvJJ5K0hS3KW4AZaFsTPbEtWvBEYEbn0ueekxjLPTar4wkajwCc1i78fgWEG2nBCh6X2RGCFd3UVQIcyVbvP5e1d9QSzkiicu1uESEiT1Jg6BJvQt9EoEfZg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 37C573858D3C Received: from eig-obgw-5002b.ext.cloudfilter.net ([10.0.29.226]) by cmsmtp with ESMTPS id CF7svxcF1SkcfCI4ZvhJ4u; Fri, 24 Oct 2025 13:43:15 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id CI4XvkhPXniktCI4YvUETJ; Fri, 24 Oct 2025 13:43:14 +0000 X-Authority-Analysis: v=2.4 cv=FOIbx/os c=1 sm=1 tr=0 ts=68fb8273 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=x6icFKpwvdMA:10 a=ItBw4LHWJt0A:10 a=MUO95RGLHExF6BnKRxQA:9 a=VS4QxaUSPT0UtbFnIvSC: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=XPB86UtvdFJFKJGh4ZFxnqJdkfEzdvGfIfD31HnheCM=; b=wsI5qlXgDax0rhqxSZ+vszIs+T MicMI3G/7NR9Jk3xn9Gb86IK443ipAzZnX2rVbF8yWqy+OWvbiarot72+BcInhi2uSH3MaC81s/E4 VLVz/tIcNbIwxuGQZEGAdJTYa; Received: from 97-122-110-68.hlrn.qwest.net ([97.122.110.68]:47926 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vCI4X-00000002zHk-2VUC; Fri, 24 Oct 2025 07:43:13 -0600 From: Tom Tromey To: Can Acar Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix: Sign extensions for DW_FORM_addrx were never considered In-Reply-To: <20251023214230.13646-1-canacar@imcan.dev> (Can Acar's message of "Thu, 23 Oct 2025 14:42:26 -0700") References: <20251023214230.13646-1-canacar@imcan.dev> X-Attribution: Tom Date: Fri, 24 Oct 2025 07:43:12 -0600 Message-ID: <878qh0jtzj.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: 97.122.110.68 X-Source-L: No X-Exim-ID: 1vCI4X-00000002zHk-2VUC X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-110-68.hlrn.qwest.net (bapiya) [97.122.110.68]:47926 X-Source-Auth: tom+tromey.com X-Email-Count: 9 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfDREQFHmPZc6Fe4+mmD/UXYu5WJHK2CXksnEemSLjFaHQell4aFc5it8S91mwtyWwFKq4hSWBVmwQLw0GNIcCJHNa1M5K1x9+haWdJDeh6ZFtoE0XN2j Ts8+nUaJq3BQTGlaIdf5QMNsxO6Q3Q+jQUqLrMUlpTTC0pG1IYiVKWWysR2wHwlwiup2gAnN9yookdkeLN1b89UmAP35LuBHXMI= 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 >>>>> "Can" == Can Acar writes: Can> DW_FORM_addr is converted (sign-extended) to a signed value when Can> the dwarf size is less than the size of unrelocated_addr, if the Can> target architecture "naturally" sign extends an address (bfd.c). Thanks for the patch. Can> static unrelocated_addr Can> read_addr_index_1 (dwarf2_per_objfile *per_objfile, unsigned int addr_index, Can> - std::optional addr_base, int addr_size) Can> + std::optional addr_base, unit_head *cu_header) I think it'd be better to merge read_addr_index_1 and read_addr_index, i.e. have it be: static unrelocated_addr read_addr_index (struct dwarf2_cu *cu, unsigned int addr_index) ... Can> + return cu_header->read_address(abfd, info_ptr, &ignore_bytes_read); gdb puts a space before "(" Can> else Can> { Can> cutu_reader reader (*per_cu, *per_objfile, nullptr, nullptr, false, Can> language_minimal); Can> addr_base = reader.cu ()->addr_base; Can> - addr_size = reader.cu ()->header.addr_size; Can> + cu_header = &reader.cu ()->header; I'm not sure it is safe to refer to hold this pointer after cutu_reader is destroyed. Instead this could be refactored slightly to: std::optional reader; if () ... else { reader.emplace (...) cu = reader->cu (); } thanks, Tom