Record explicit block ranges from dwarf2read.c
authorKevin Buettner <kevinb@redhat.com>
Thu, 23 Aug 2018 23:00:49 +0000 (16:00 -0700)
committerKevin Buettner <kevinb@redhat.com>
Thu, 23 Aug 2018 23:12:15 +0000 (16:12 -0700)
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/ChangeLog
gdb/dwarf2read.c

index 82eaa824556aa48ad7b392c91f70ab7aac7e5a17..9dc0441fe2bf907492fdac52a87e4bce1811a425 100644 (file)
@@ -7,6 +7,8 @@
        macros for accessing ranges in struct block.
        (make_blockranges): New declaration.
        block.c (make_blockranges): New function.
+       * dwarf2read.c (dwarf2_record_block_ranges): Fill in BLOCK_RANGES
+       for block.
 
 2018-08-23  Xavier Roirand  <roirand@adacore.com>
 
index 81a0087c26d463095d5397a2eee66e43c9ad6afb..8834d08a1c6f53d6c275dac034c0da3427e55133 100644 (file)
@@ -14846,6 +14846,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<blockrange> blockvec;
       dwarf2_ranges_process (offset, cu,
        [&] (CORE_ADDR start, CORE_ADDR end)
        {
@@ -14854,7 +14855,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);
          cu->builder->record_block_range (block, start, end - 1);
+         blockvec.emplace_back (start, end);
        });
+
+      BLOCK_RANGES(block) = make_blockranges (objfile, blockvec);
     }
 }
 
This page took 0.040094 seconds and 4 git commands to generate.