* dwarf2read.c (dwarf2_cu): Enhance comment.

(dwarf2_get_pc_bounds): Only add ranges_base for DIEs that live in
	the DWO file.
	(dwarf2_record_block_ranges): Ditto.
This commit is contained in:
Doug Evans 2012-12-10 22:02:34 +00:00
parent 9325cb04b5
commit ab4352599f
2 changed files with 25 additions and 3 deletions

View File

@ -1,5 +1,10 @@
2012-12-10 Doug Evans <dje@google.com>
* dwarf2read.c (dwarf2_cu): Enhance comment.
(dwarf2_get_pc_bounds): Only add ranges_base for DIEs that live in
the DWO file.
(dwarf2_record_block_ranges): Ditto.
* dwarf2read.c (create_dwo_in_dwp): Tweak comment.
* symtab.c (find_pc_sect_symtab): Add comment.

View File

@ -483,7 +483,12 @@ struct dwarf2_cu
(zero is a valid value though).
Note this value comes from the stub CU/TU's DIE.
Also note that the value is zero in the non-DWO case so this value can
be used without needing to know whether DWO files are in use or not. */
be used without needing to know whether DWO files are in use or not.
N.B. This does not apply to DW_AT_ranges appearing in
DW_TAG_compile_unit dies. This is a bit of a wart, consider if ever
DW_AT_ranges appeared in the DW_TAG_compile_unit of DWO DIEs: then
DW_AT_ranges_base *would* have to be applied, and we'd have to care
whether the DW_AT_ranges attribute came from the skeleton or DWO. */
ULONGEST ranges_base;
/* Mark used when releasing cached dies. */
@ -10056,7 +10061,14 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
attr = dwarf2_attr (die, DW_AT_ranges, cu);
if (attr != NULL)
{
unsigned int ranges_offset = DW_UNSND (attr) + cu->ranges_base;
/* DW_AT_ranges_base does not apply to DIEs from the DWO skeleton.
We take advantage of the fact that DW_AT_ranges does not appear
in DW_TAG_compile_unit of DWO files. */
int need_ranges_base = die->tag != DW_TAG_compile_unit;
unsigned int ranges_offset = (DW_UNSND (attr)
+ (need_ranges_base
? cu->ranges_base
: 0));
/* Value of the DW_AT_ranges attribute is the offset in the
.debug_ranges section. */
@ -10217,10 +10229,15 @@ dwarf2_record_block_ranges (struct die_info *die, struct block *block,
if (attr)
{
bfd *obfd = objfile->obfd;
/* DW_AT_ranges_base does not apply to DIEs from the DWO skeleton.
We take advantage of the fact that DW_AT_ranges does not appear
in DW_TAG_compile_unit of DWO files. */
int need_ranges_base = die->tag != DW_TAG_compile_unit;
/* The value of the DW_AT_ranges attribute is the offset of the
address range list in the .debug_ranges section. */
unsigned long offset = DW_UNSND (attr) + cu->ranges_base;
unsigned long offset = (DW_UNSND (attr)
+ (need_ranges_base ? cu->ranges_base : 0));
gdb_byte *buffer = dwarf2_per_objfile->ranges.buffer + offset;
/* For some target architectures, but not others, the