From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 163AC3858D37 for ; Mon, 29 Apr 2024 14:36:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 163AC3858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 163AC3858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714401396; cv=none; b=FAL09yGmh/ER9bacZ2wParxiKelUTwNNQS3RgCy9An0Wv2K8FFA2yTlSYuYzoWalLEc3rRs7FweL98fPHZJ0p1NgrdIpn2UmT+HZVdlV78936YK3VdQTOOgqT8Y4ET1DOLrN9y74c4Q325/tO+F6pd3dCj+E6rNpJYD5pK3C8e8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714401396; c=relaxed/simple; bh=YFCbOpIvg6V876eswQqJG3wV5QbQaDJ96eW0Z6ohcIc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=j7b20Yr/E25otYdPZwz05PPl+/VjpMboq7WAzPmwH5t2tMlbI4owteAbgwdO1h/6DTz9bACICC5NR2rKOOc1T3LpD+ftKQSOuqx0Ma0CNqwcQ0IjmdUMSV2if5w1i/uiLbONgrB5kaeuat7cR4UXKLKYgljbZff3/JcAtx2VaPs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714401385; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0Rijwf+IgWK0TrvlBwSI7E/YoRbvXyVV1QI1AVkQRe0=; b=Ja+9eqVxmwNcfzhS/8/103PXeZgwcCOZnlhFhBE5HFmVZBk7zu1WrwbK7lEe86O7eskM6r OG6qQ33vXWMsyc/HH2EwyErXPcgaZvyWQHZOWsG2+7LFbnmpHl9f8IX0ZzY5zj2vkjqYa/ cxstH+hKAUCLFOuUJQioORYUKM/ngws= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-223-KW-Xa8eOPPS1MoKeXHkzdg-1; Mon, 29 Apr 2024 10:36:24 -0400 X-MC-Unique: KW-Xa8eOPPS1MoKeXHkzdg-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a4455ae71fcso253714666b.3 for ; Mon, 29 Apr 2024 07:36:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714401382; x=1715006182; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0Rijwf+IgWK0TrvlBwSI7E/YoRbvXyVV1QI1AVkQRe0=; b=hKkomBAua6Y90UOcl45Ui/v1hyvcElIsDHeQILGOaZ95wk1rcQVinJMdh/2I6CXdCM 9mTIC4L2IAjxh1tLkLZklk3j3V5uFm+p1OvD95bRnTLNeboPBJb6UaB5e1bUViM9Kmjw BXLN1AQgXDIIH6N6Pi1vhrS7ERh/gSopzxxpvKHzkKc3qEduiISOBxlgHbcntYYlr66D oaEwmKcvVSZFnIeaNxZ4T/aG0oeHacmy2unmSCADJd5iQlr9tXIO3vzikt4sOOQrPfKE KL7vzCUNpydGvt71JXXL9/EpJ1ddpSV+SVVvAeP0uMK6GknX1A444/M16vZ9NxKEyHE6 iPJw== X-Forwarded-Encrypted: i=1; AJvYcCXScSYQqSVBiYsHmZzSqhMIy2xXfHMNO6o3kx3BojwYAE/KYGgv74q6E1PytK4wjbuIll2USyERyv02DobEG8hE6ne8IkejgtQF/g== X-Gm-Message-State: AOJu0YxJgT4TM2GX1mQesRIvdpzrByt6eU/0uP9MLE3FGynP0P08Se0o +xR6gnsT2pXVXyMZH8K2AQoNFtSwFtxxscKg1y4Bdty818dt/XwccSeKVcvWC7r+bGWiESzSAlM Wpprh7Vlea50yN1cEdaMLWpmr9hJV2xxDiixCYSk/l40eKIzfIUYe8E1hqMn0cVEy4aA= X-Received: by 2002:a17:906:480f:b0:a52:3ff7:744d with SMTP id w15-20020a170906480f00b00a523ff7744dmr7343003ejq.4.1714401382089; Mon, 29 Apr 2024 07:36:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHj2bS7WBgB0Mxenn88jwAiGQz2XwJehRiDNc/L5DPA9ZkJQzUdzV6DGHfJ6HpdWyjJqVyLg== X-Received: by 2002:a17:906:480f:b0:a52:3ff7:744d with SMTP id w15-20020a170906480f00b00a523ff7744dmr7342978ejq.4.1714401381344; Mon, 29 Apr 2024 07:36:21 -0700 (PDT) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id bk5-20020a170907360500b00a58a67afd2fsm5582578ejc.53.2024.04.29.07.36.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 07:36:21 -0700 (PDT) From: Andrew Burgess To: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH 1/5] Remove call to dwarf2_per_objfile::adjust from ranges readers In-Reply-To: <87a5lcpauu.fsf@redhat.com> References: <20240416-dwarf-race-relocate-2-v1-0-1fc912e95e87@tromey.com> <20240416-dwarf-race-relocate-2-v1-1-1fc912e95e87@tromey.com> <87cyq8pbnp.fsf@redhat.com> <87a5lcpauu.fsf@redhat.com> Date: Mon, 29 Apr 2024 15:36:20 +0100 Message-ID: <87zftcnsm3.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Andrew Burgess writes: > Andrew Burgess writes: > >> Hi Tom, >> >> So, I don't know the details of the DWARF reader too well, so my attempt >> to review this patch might be just wasting your time. But I didn't >> really understand what was going on here, so... >> >> Tom Tromey writes: >> >>> dwarf2_per_objfile::adjust applies gdbarch_adjust_dwarf2_addr to an >>> address, leaving the result unrelocated. However, this adjustment is >>> only needed for text-section symbols -- it isn't needed for any sort >> >> I didn't know if the use of the word 'symbols' here was significant. >> gdbarch_adjust_dwarf2_addr operates on addresses, and I guess symbol >> could be a synonym for address in some contexts. But the addresses here >> do seem to be .text addresses, so clearly there's some important >> distinction that I'm not understanding. >> >>> of address mapping. Therefore, these calls can be removed from >> >> gdbarch_adjust_dwarf2_addr seems to be relevant for .text addresses, >> which is what you're handling here, but you are creating a map, but it's >> not clear _why_ those addresses wouldn't need to be updated. > > A follow on question. Looking through gdb/dwarf/ there seem to be > several other places where the addrmap_mutable::set_empty is called, and > in at least some of those places the addresses are still being > adjusted. E.g.: > > dwarf2_ranges_read > cooked_indexer::check_bounds > cooked_indexer::scan_attributes > > Why do these not need changing? And an additional question. Are lookups in these maps not done via the two ::find_per_cu functions? Which are passed, and are documented to expected an un-adjusted (i.e. have text_section_offset removed) address. If we don't add text_section_offset in to begin with doesn't that cause problems? Or maybe the bit I'm missing is that the two paths you've changed already are adjusted? Thanks, Andrew > > Thanks, > Andrew > > > >> >> Sorry to ask what are probably obvious questions... >> >> Thanks, >> Andrew >> >>> read_addrmap_from_aranges and create_addrmap_from_gdb_index. >>> --- >>> gdb/dwarf2/aranges.c | 2 -- >>> gdb/dwarf2/read-gdb-index.c | 2 -- >>> 2 files changed, 4 deletions(-) >>> >>> diff --git a/gdb/dwarf2/aranges.c b/gdb/dwarf2/aranges.c >>> index d577db62726..0d1dc11e27a 100644 >>> --- a/gdb/dwarf2/aranges.c >>> +++ b/gdb/dwarf2/aranges.c >>> @@ -190,8 +190,6 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, >>> continue; >>> } >>> ULONGEST end = start + length; >>> - start = (ULONGEST) per_objfile->adjust ((unrelocated_addr) start); >>> - end = (ULONGEST) per_objfile->adjust ((unrelocated_addr) end); >>> mutable_map->set_empty (start, end - 1, per_cu); >>> } >>> >>> diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c >>> index 8c0895b9639..cc6361674e8 100644 >>> --- a/gdb/dwarf2/read-gdb-index.c >>> +++ b/gdb/dwarf2/read-gdb-index.c >>> @@ -566,8 +566,6 @@ create_addrmap_from_gdb_index (dwarf2_per_objfile *per_objfile, >>> continue; >>> } >>> >>> - lo = (ULONGEST) per_objfile->adjust ((unrelocated_addr) lo); >>> - hi = (ULONGEST) per_objfile->adjust ((unrelocated_addr) hi); >>> mutable_map.set_empty (lo, hi - 1, per_bfd->get_cu (cu_index)); >>> } >>> >>> >>> -- >>> 2.43.0