This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/gdb-8.2-branch] Record explicit block ranges from dwarf2read.c


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8cad3755f9d24f236699ecf4100c116095f7ab01

commit 8cad3755f9d24f236699ecf4100c116095f7ab01
Author: Kevin Buettner <kevinb@redhat.com>
Date:   Fri Aug 24 22:22:45 2018 -0700

    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.

Diff:
---
 gdb/ChangeLog    | 2 ++
 gdb/dwarf2read.c | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cdd72ee..8a3e574 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -8,6 +8,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-24  Pedro Alves  <palves@redhat.com>
 	    Simon Marchi  <simon.marchi@ericsson.com>
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index a056b85..56113c1 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -14737,6 +14737,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)
 	{
@@ -14745,7 +14746,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.emplace_back (start, end);
 	});
+
+      BLOCK_RANGES(block) = make_blockranges (objfile, blockvec);
     }
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]