From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 67308 invoked by alias); 26 Jun 2018 06:44:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 66866 invoked by uid 89); 26 Jun 2018 06:44:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Jun 2018 06:44:36 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6CF4BC04BD2E for ; Tue, 26 Jun 2018 06:44:35 +0000 (UTC) Received: from pinnacle.lan (ovpn-117-99.phx2.redhat.com [10.3.117.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 409AE2A336 for ; Tue, 26 Jun 2018 06:44:35 +0000 (UTC) Date: Tue, 26 Jun 2018 06:44:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Subject: [PATCH 2/8] Record explicit block ranges from dwarf2read.c Message-ID: <20180625234434.5c3913fa@pinnacle.lan> In-Reply-To: <20180625233239.49dc52ea@pinnacle.lan> References: <20180625233239.49dc52ea@pinnacle.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-06/txt/msg00602.txt.bz2 This change sets BLOCK_RANGES for the block under consideration by calling make_blockranges(). This action is performed in dwarf2_record_block_ranges(). It should be noted that dwarf2_record_block_ranges() already does some recording of the range via a call to record_block_range(). The ranges recorded in that fashion end up in the address map associated with the blockvector for the compilation unit's symtab. Given an address, the addrmap provides a fast way of finding the block containing that address. The address map does not, however, provide a convenient way of determining which address ranges make up a particular block. While reading a set of ranges, a vector of pairs is used to collect the starting and ending addresses for each range in the block. Once all of the ranges for a block have been collected, make_blockranges() is called to fill in BLOCK_RANGES for the block. The ranges are stored for the block in the order that they're read from the debug info. For DWARF, the starting address of the first range of the block will be the entry pc in cases where DW_AT_entry_pc is not present. (Well, that would ideally be the case. At the moment DW_AT_entry_pc is not being handled.) gdb/ChangeLog: * dwarf2read.c (dwarf2_record_block_ranges): Fill in BLOCK_RANGES for block. --- gdb/dwarf2read.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 4ad0527..2f0f9b9 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -14722,6 +14722,7 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block, unsigned long offset = (DW_UNSND (attr) + (need_ranges_base ? cu->ranges_base : 0)); + std::vector> blockvec; dwarf2_ranges_process (offset, cu, [&] (CORE_ADDR start, CORE_ADDR end) { @@ -14730,7 +14731,10 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block, start = gdbarch_adjust_dwarf2_addr (gdbarch, start); end = gdbarch_adjust_dwarf2_addr (gdbarch, end); record_block_range (block, start, end - 1); + blockvec.push_back (std::make_pair (start, end)); }); + + BLOCK_RANGES(block) = make_blockranges (objfile, blockvec); } }