Skip to content

Commit 8cad375

Browse files
committed
Record explicit block ranges from dwarf2read.c
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.
1 parent 76dae9e commit 8cad375

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

gdb/ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
macros for accessing ranges in struct block.
99
(make_blockranges): New declaration.
1010
block.c (make_blockranges): New function.
11+
* dwarf2read.c (dwarf2_record_block_ranges): Fill in BLOCK_RANGES
12+
for block.
1113

1214
2018-08-24 Pedro Alves <[email protected]>
1315
Simon Marchi <[email protected]>

gdb/dwarf2read.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14737,6 +14737,7 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
1473714737
unsigned long offset = (DW_UNSND (attr)
1473814738
+ (need_ranges_base ? cu->ranges_base : 0));
1473914739

14740+
std::vector<blockrange> blockvec;
1474014741
dwarf2_ranges_process (offset, cu,
1474114742
[&] (CORE_ADDR start, CORE_ADDR end)
1474214743
{
@@ -14745,7 +14746,10 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
1474514746
start = gdbarch_adjust_dwarf2_addr (gdbarch, start);
1474614747
end = gdbarch_adjust_dwarf2_addr (gdbarch, end);
1474714748
record_block_range (block, start, end - 1);
14749+
blockvec.emplace_back (start, end);
1474814750
});
14751+
14752+
BLOCK_RANGES(block) = make_blockranges (objfile, blockvec);
1474914753
}
1475014754
}
1475114755

0 commit comments

Comments
 (0)