From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id G1IMKdUw8WhsNTkAWB0awg (envelope-from ) for ; Thu, 16 Oct 2025 13:52:21 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BBGTyzmy; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 7DFD11E057; Thu, 16 Oct 2025 13:52:21 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 8884C1E057 for ; Thu, 16 Oct 2025 13:52:20 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 21BB33857B91 for ; Thu, 16 Oct 2025 17:52:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21BB33857B91 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BBGTyzmy Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id AD1953858436 for ; Thu, 16 Oct 2025 17:50:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AD1953858436 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine 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 AD1953858436 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1760637006; cv=none; b=nEBOyByi9jBRL9TxxeorNRP7dmhXoKur0Rf1/nzRlXkxHnk94eUSKBeJrRoKuzWwNkY55Qgys/w5BHBM2IXEEAOxhy2Ikpi2zfUl5jEab0x2gkklnqKCQ+qF/OjqYyRlINi4Dlem7cmqFNWkm12fMCe22kOAE7mMc8bSqMCe3lg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1760637006; c=relaxed/simple; bh=0vifNd6pUV4XI4CM8INniFm9IycaBPFYp5JfcwT8UhI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=MZxndQc/ylg1sWQ6iXnK+RkSs6wfqAEpIM/+GrY+aFcU3Jmz9C/5rC82t13XfcnYqLw0DKnf0YSGXROdFXGmWGgF5jYg1UgDySk0O8l2oCmWPgN2sj1rPUNuUYW777SIXfYA4GyMnbKsugMb2thwHOj8xbZe2UpAG5jQma3isOI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AD1953858436 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760637006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XTR8KxH2thg+PSmUwKs3cwqJFety0is8ADshg4k1Hlo=; b=BBGTyzmy9DMRDgCOPBv7hZSqv3VNZNhikUPwwPoR4DLM7u+mAMXeK6pwL+GF5LOJbFuex5 sWMdVkfS0IXaxXlU+Rddbn2oIf6LQkMYWDXrruy9vbTDy+G/ZEIRo/P+5E2e4PuBHFo0+k ULqUJ6UPc/1NvADe0p8mXfLMDPxDXQM= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-688-AfJs8usnOBSc8LNWTNFsmQ-1; Thu, 16 Oct 2025 13:50:05 -0400 X-MC-Unique: AfJs8usnOBSc8LNWTNFsmQ-1 X-Mimecast-MFC-AGG-ID: AfJs8usnOBSc8LNWTNFsmQ_1760637004 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-470fd59d325so5656355e9.0 for ; Thu, 16 Oct 2025 10:50:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760637003; x=1761241803; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XTR8KxH2thg+PSmUwKs3cwqJFety0is8ADshg4k1Hlo=; b=FTqv4VbnIL/v4vUU2haQVIEhNjy1K7l0rF9HjZA3/ZDxC9FmGZW3uyKZDHYUQnJRDQ z0HDsSgVNrnxIPd/i/Msb8i3p24P4TJthx3R/gmMAIJq4n6nNKKSaQymjGjVCbtlQh6W elt5oe+moTHikRDw9c28+eWVlS85ZNGsQRgA4+LZgwR6qkl+zD+qqxWaRIenveozENtF XnAasojjcF5uzzwJj/cDDhGALegDIsAs2UDmOlt7sEhmSzxm9pvpuhtWSCMPi7fR5udn PUcEgmCH0MMV70HYGaVNYOKymFR+9W42QowwhmqTyrjYBASU8+l9mYDQQrkGuUamZ0ME P72w== X-Gm-Message-State: AOJu0Yx69azVf+eaNPC8jYhgEjGgbLBWYh2ClsCKm1PGbwOEwkK3j5ag mx9TSYmpq5tJUTeFyH5s4mqBSEiOWpxsNr+UomcXvDmHBNtShoHvrYzl8aNHAsvW/OliT0H9OJp nEjGeIfMdiCEnFLxaq+DVB2Y4jBkZwYWPS7PRSn1Wn7JOBHOPGYbhjc5lVYbBsGlWVx86hddUWx Q1GKx9twvJda7XtFAhTknG76/xOpV2pgWxDQTGe4wqrf0MD7s= X-Gm-Gg: ASbGncv1JfR68Ijt+CXyVwOPbyGSru6JZ9XHjPI5KLph0atODS3A6IH0Ks3si7OwlbT PPmLtwe5esQ9BvhFlGZHPck3J0q3oh3zERQSv8eEJfHbfI9FrKkAflFzyQ+w5YQLE7qPYEPAxNM 9afWgfD4jdQ4nO2PRzqHt0jYT1uTBVoKWNj+ko9755dx8IKrPhO2on3mD+Aum0R3qMxvF4LLne0 BBJ/E7ZCWBLYD4DBYgwMZ5Q8nunzV68fsLn6qgE4sdq8JuSMLRHao+RJPYv/BpcELloQNE+4A1Y MDLESr22Ux3OrIKD59QEY+WMkfWs79lXXM5q0IyFj/Md1gqqP1QzSLMbHlYljmYYJhtYzg== X-Received: by 2002:a05:600c:3b0c:b0:471:669:ec1f with SMTP id 5b1f17b1804b1-471178785e1mr6529505e9.8.1760637003542; Thu, 16 Oct 2025 10:50:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEcddVWzRj3gAWYGq+EmFX7RRytWeO5zKMgVJnmPdPZ5kwXMn2QNC6HXonXEshvDhJZLC7P6w== X-Received: by 2002:a05:600c:3b0c:b0:471:669:ec1f with SMTP id 5b1f17b1804b1-471178785e1mr6529305e9.8.1760637003059; Thu, 16 Oct 2025 10:50:03 -0700 (PDT) Received: from localhost ([31.111.84.207]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-471144d1765sm52339915e9.17.2025.10.16.10.50.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Oct 2025 10:50:02 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv3 4/7] gdb: move block range recording into its own function Date: Thu, 16 Oct 2025 18:49:50 +0100 Message-ID: <1023052882f93ee1338daa406eabc18be22f8f00.1760636870.git.aburgess@redhat.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: E-NRTg9lT3XfTe6xZXAbHvMFLT5CKqEeGXOL9lRnWEA_1760637004 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 Like the previous commit, this is a refactor that makes a later commit in this series easier. The later commit improves GDB's ability to debug optimised code. To do this I propose to "fix" the address ranges of some inline blocks. In order to know which blocks to fix, I need to record the end address of inline blocks. And so, I'd like to create a single common function where block ranges are recorded, in a later commit I can then hook into this function to record the block's end address(es). This commit sets up this single common function. The new function I'm adding dwarf2_record_single_block_range, takes a currently unused argument unrel_high. This argument will be needed in the later commit. I've added it now as this will allow the later commit to be smaller and more focused. I only plan to push this commit as part of the larger series, so I don't think adding the (currently) unused argument is too much of a problem. There should be no user visible change after this commit. --- gdb/dwarf2/read.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 6c5157ea8d4..023cb07edd8 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -9940,6 +9940,21 @@ dwarf2_record_block_entry_pc (struct die_info *die, struct block *block, } } +/* Helper function for dwarf2_record_block_ranges. This function records + the address range for a single BLOCK. LOW and HIGH are the block's + range, these addresses are inclusive, so LOW is the first address in + the range, and HIGH is the last address inside the range. UNREL_HIGH + is the unrelocated, exclusive version of HIGH, that is, HIGH is the + first address outside the range of BLOCK. */ + +static void +dwarf2_record_single_block_range (struct dwarf2_cu *cu, struct block *block, + CORE_ADDR low, CORE_ADDR high, + unrelocated_addr unrel_high) +{ + cu->get_builder ()->record_block_range (block, low, high); +} + /* Record the address ranges for BLOCK, offset by BASEADDR, as given in DIE. Also set the entry PC for BLOCK. */ @@ -10008,7 +10023,8 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block, in GDB's internal structures, it's just more to search through, and it will never match any address. */ if (high >= low) - cu->get_builder ()->record_block_range (block, low, high); + dwarf2_record_single_block_range (cu, block, low, high, + unrel_high); } attr = dwarf2_attr (die, DW_AT_ranges, cu); @@ -10038,8 +10054,8 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block, { CORE_ADDR abs_start = per_objfile->relocate (start); CORE_ADDR abs_end = per_objfile->relocate (end); - cu->get_builder ()->record_block_range (block, abs_start, - abs_end - 1); + dwarf2_record_single_block_range (cu, block, abs_start, + abs_end - 1, end); blockvec.emplace_back (abs_start, abs_end); }); -- 2.47.1