From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eBGWIZnDfGhHdSoAWB0awg (envelope-from ) for ; Sun, 20 Jul 2025 06:23: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=Bl1QaRqV; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 532B21E11E; Sun, 20 Jul 2025 06:23: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=-6.8 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_SBL_CSS,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE 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 8896B1E11C for ; Sun, 20 Jul 2025 06:23:12 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 35B0F385E007 for ; Sun, 20 Jul 2025 10:23:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 35B0F385E007 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=Bl1QaRqV 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 3887C385B53B for ; Sun, 20 Jul 2025 10:21:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3887C385B53B 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 3887C385B53B 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=1753006864; cv=none; b=qE6OarlOhx5NqJjPimPBS72vhF7qDP/jxqu2oNOhZggUhpY3y/qr2dEBk7UkP+nASLK2Nks+6u1yhtUh98n9ovlmrl3F5zjvya5RNvISGfm/73bmmI2clqAuTccM0Y5Uv+VC6PVy8MKX4b4EZ/rRxwrP8rANxZRI/fKkQQMM/Tk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1753006864; c=relaxed/simple; bh=+s1HxwjYf2nz06FVKQs8kLmk2PVQa7KuWzPrWz8nfnQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=oafXvAz4+14X1WnogZ9ME1hFcREaoRXm4m4aslDW5TUx6/m4NK4UEEhYHdD1OE5AzySletA8zaIHAyHRIh4NdhmshOlgJM63JaY4jpzealDnCXRY53HU2qtUhVU2EYoOUhyyEeonLYPJaHSG9gWSef0h7NgLhOy4aXe1Pl6VUqQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3887C385B53B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1753006864; 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=/+PDGfT6XGLWWlsRqnA8XK4f6A3hC3C2Owrrd2QFLMI=; b=Bl1QaRqVEsksfKqQOmovcPWMibei2t0xD5vQ5vfh1qwXY7a3H0x1x/igINhWayVG8FuH2+ 5F57jx2IcIMu6bC09J6Cd2gZLla9Sl1CZY3hp9By1V+55iKLJwkSoBQLR6bsKPEZL7mQXE U0qNsqFSB3h7ykLSBqPIGYtAswGRuLU= 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-684-U25OYQNIM26An0weJ6BhHA-1; Sun, 20 Jul 2025 06:21:03 -0400 X-MC-Unique: U25OYQNIM26An0weJ6BhHA-1 X-Mimecast-MFC-AGG-ID: U25OYQNIM26An0weJ6BhHA_1753006862 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-455e918d690so25811415e9.1 for ; Sun, 20 Jul 2025 03:21:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753006861; x=1753611661; 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=/+PDGfT6XGLWWlsRqnA8XK4f6A3hC3C2Owrrd2QFLMI=; b=i9ZyvQYW+46ySrxZ86yzjUCwx0tNonFD+91nJjdRoK7vHyk9I0442BOz8WQ195v5aC MT5eoYEW6fa08+/QLXtEl9iL2yUlUKHg5dtHGRns8arx2NJIWoBFqLnh4YEBUtnuVSc7 eDjTirJPNEgcYx12R1g9FsOplJadpKdrKusDL/Lfj52sKLxk/mbTzBOMDtyjw6iIT4Gh NzklbwUMcc7fDmfJQ6q/PCFhbPqdVOur+AlA78Qw3jAzj5URAuNOErM1+bf3VL6nh0uj C4tLysZ6c7OENLRZFxWsMHmyt2DFXDh0c09dllrov7O84a5RlcTPprT8kPAyrWQ5T1oc 4aLw== X-Gm-Message-State: AOJu0Yybh+171j31+fCBt1kj5j+au5mTgz6nWgWt835gIR7/7TjVUeHh xgC5RNUIomhdTQkJPaYkhW0iFFNiB/f4/SaRrbPobOFEIQLIlzHVFYKukcyoHI5DUXiukIBcRnC cOh3v3wgRYuFQ8tEZaOw45Nvbkh1Fe1nhMN/WHDNnbAq69/eVIk9DM4lzpnnZTZMRJsnkoayG9E m/HHobX/vNvwBTGAU2hu5Xj6j9RXrnoIUm52Nv+OUkjrF2Ktg= X-Gm-Gg: ASbGncv5eGQU0FqdlquhEYYjElH2ady5shMd05z10O6eiFrYEeUQYr0+MhjgRwUyyjK cgENHxfBUrD+kTcC40MoXqwtszMibRpp8X2dJpi3vkxPzNxeNec+Htm5MSeyGE5NHatq20N3fx+ JZsoFntQbCHdTxHY/jeQsdWkrNEI7c09jvJ/Qihz9F1U89LnJMRJ/1nfwNKlJ5vCcqeuhimUKwh I/pzJazBWzu2rIJp7ChQVIFe8St4ZUz96IYMTkKaAia8vk/sMOMJhWfGi5tHr18LXsu2eZQGjYR YjuWq25ajdX83BValRbTscpuhRg+URsGVYW1zDY/TYcesfcTO9kJMXKUchzkdw== X-Received: by 2002:a05:600c:890e:b0:43c:f509:2bbf with SMTP id 5b1f17b1804b1-4563a55f2b4mr64955815e9.15.1753006860870; Sun, 20 Jul 2025 03:21:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEWuD8nvAsEUA5c63Jvluo/xCAAWlXoNSRKy+MqkjCFbw69drZO4dDE7bovAxmcOoOcZ8/Vxg== X-Received: by 2002:a05:600c:890e:b0:43c:f509:2bbf with SMTP id 5b1f17b1804b1-4563a55f2b4mr64955655e9.15.1753006860271; Sun, 20 Jul 2025 03:21:00 -0700 (PDT) Received: from localhost (92.40.185.56.threembb.co.uk. [92.40.185.56]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4562e89bfecsm129526785e9.27.2025.07.20.03.20.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Jul 2025 03:20:59 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 4/7] gdb: move block range recording into its own function Date: Sun, 20 Jul 2025 11:20:43 +0100 Message-ID: <73bf5a321cc6bc7622ecba549609edc90c60f1ec.1753006060.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: TKeJSxFiLt-YgcEOOA2lUFhgbe9PKqKddFStoYeW2Mg_1753006862 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 at the same time as the later, 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 | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 46f87c097b4..47fbccbdb08 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -9845,6 +9845,20 @@ 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 version of HIGH. */ + +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. */ @@ -9913,7 +9927,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); @@ -9943,8 +9958,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