From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id ELVBDTaCjGiifgEAWB0awg (envelope-from ) for ; Fri, 01 Aug 2025 05:00:38 -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=WtRYlnIv; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 325181E102; Fri, 1 Aug 2025 05:00:38 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-10.1 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, 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 BDB821E089 for ; Fri, 1 Aug 2025 05:00:37 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4C4433858420 for ; Fri, 1 Aug 2025 09:00:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4C4433858420 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=WtRYlnIv Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 732CA3858C54 for ; Fri, 1 Aug 2025 08:58:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 732CA3858C54 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 732CA3858C54 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=1754038719; cv=none; b=jlpv90zsiykUyVedrAJ+Hqo7tAXm01fDUFkFN4rRuh+ovlA4TgyzyTM0vapWAXT37O77H78SoiMc+IfU75YYSN7pBgyxgCIomCJ5P+ILLYwUDTtz5TCvfxGoqFTiTV2iZMPqGqDUqm670oc5yXCo4aUBsg+hJqjsguid9V2+ZGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1754038719; c=relaxed/simple; bh=Nyry+Xpul3EHE5iun8YCc9wjgYY9a3zd+yZNURHecwM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Jb5j2mIhW7tSKiMQgSxQcC2HOblc2AuP1iZ1m1YTM65usguq9OYfKEmUuxHcfvoyfQz4GGmudf/u86wNSKrIv674vWCb9tFnYSCDfbcl26WTPtVhFbHKS9Ba3a1Qh7+iu9eAsaD4dj/++kMRtC7eL4lHEhYKg8wl0VGmw4eRA78= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 732CA3858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1754038719; 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=zi6x4wzNZ8DrFPxoJmWEKMysIPt1nUgP+BTU4G9/i3U=; b=WtRYlnIvYlyj2fFy7UqMvcpeZsYap0lNBTALNAwgy+AADTmwUrdlJem0pnn6AtMYoVWQxJ v4SDlCPWq7t5i+F1CoeSMpIfAk6OBj2UQqaxgyl0z+jQESDQWS9UMebY7VvM8Et8uCYf0d +yJ7m7xGG2YJ6nsc/PgTQu4dlJIQ+eY= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-61-TypcXHJZMu2mIuGIfLftfQ-1; Fri, 01 Aug 2025 04:58:37 -0400 X-MC-Unique: TypcXHJZMu2mIuGIfLftfQ-1 X-Mimecast-MFC-AGG-ID: TypcXHJZMu2mIuGIfLftfQ_1754038717 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3b78329f180so1277172f8f.3 for ; Fri, 01 Aug 2025 01:58:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754038716; x=1754643516; 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=zi6x4wzNZ8DrFPxoJmWEKMysIPt1nUgP+BTU4G9/i3U=; b=mwlXDSVpjVYkV+zZ6xKwxvDK4DVZku82R68TjgCJ//aTyzibtzE2CKF6AH7QBJvVL3 X4xkOYtswTqFYWt/QOwPflRvgF+/r0ye/+gK7Z1NjdRM/BBL3RaE5s5DQioHhWnbwkA4 67ycvbHJ55JwW8aHrwo8tpVEFo+yGYVJBQRdY0xp2+jkRncoTibqfsvRTFPGjBJ3GWFI thazQ8Oe69a5gpFZUDTUh/ItmlwUo2LIYjvV279g4JO7q9Lhx5sxV/e/WO6us4oHat9c daFKFpoCj9vxaBD6BHgiskIf76bqqQw3/NjLf2dKerlVkv2z1GkA6eNI9D0th1RZABtY LgLA== X-Gm-Message-State: AOJu0YxYH0BYYqmIW+Kya9b/R4qyjlvm7M9qAmxYhaOBUIWEqBOSsmWO t/R2T9bNOzJ5Gt2MLzVISjujBk9uihnK2BC3tu8Sryx5O6XrQwe1leTQBXVrE2ajGpB+ZFfS05V AjHxmTE4/Kl8hS36hqJPnr4ueVzuCYpubSpu0j7lV4ZLmV3lldebvHB8xMZRCMXxqb5H4f/75R1 XgMMquYh8zGhjbcQeGRqY8CdUCtlqVnEWY7vpe9Af/gDCu2zI= X-Gm-Gg: ASbGncuzOclvdrbBrvZQzHtp4UaJp6Op5DASwVFkXqmoI3p3DOuV2mgFZA79Orxv2L+ icc1JZa5vwqnCF4a7MULgbLX7QOHVrGQSjspBvSmnWXJN0ftKKK9hKkoLaSh1ZBAyoCsrVqvT/9 dw/hYG2Z26PHiGtfQScj/Ke9B3F0QU/gkrMh8MVcDt6dft8fHph/G4iqpPZ8XwfM2eStwr3tL7X Uc/eeMazK5UOHXWfuyFhqhHZEeqAnjO65e1WsuDU4jZTG5e6e2MC8ENfbWJtQWXdua4h65gG5v6 3aKNK6BjDcRU7ydrKBT6/7cKsrat4NPYfOG0cbRmBqn4wypwNI/3UN1YgvM= X-Received: by 2002:a05:6000:4212:b0:3a3:63d3:369a with SMTP id ffacd0b85a97d-3b794fc182dmr9274223f8f.25.1754038716330; Fri, 01 Aug 2025 01:58:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1B0k5WEf313awRN4n/0Wsxa9XpfZ0pxCRM/3TlJxpAuGX7npcA/VXO9IlHNXQ0Whm1rRFFw== X-Received: by 2002:a05:6000:4212:b0:3a3:63d3:369a with SMTP id ffacd0b85a97d-3b794fc182dmr9274194f8f.25.1754038715816; Fri, 01 Aug 2025 01:58:35 -0700 (PDT) Received: from localhost (27.81.93.209.dyn.plus.net. [209.93.81.27]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c48a05bsm5186352f8f.69.2025.08.01.01.58.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Aug 2025 01:58:35 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 4/7] gdb: move block range recording into its own function Date: Fri, 1 Aug 2025 09:58:17 +0100 Message-ID: <44a2f95c9a9e17c6fa62a9537b396bce96ec628f.1754038556.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: sVu3GS3pTOWjlx0YrSEiPJ18uAHW9GJYR6QdXzkK_pk_1754038717 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 a68b1434e53..e553a47e970 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