mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 19:09:31 +08:00
gdb/dwarf: make read_{loc,rng}list_index return sect_offset
I think it's wrong that read_loclist_index and read_rnglist_index return a CORE_ADDR. A CORE_ADDR is an address in the program. These functions return offset in sections (.debug_loclists and .debug_rnglists). I think sect_offset is more appropriate. I'm wondering if struct attribute should have a "set_sect_offset" method, that takes a sect_offset parameter, or if it's better to be left as a simple "unsigned". gdb/ChangeLog: * dwarf2/read.c (read_loclist_index, read_rnglist_index): Return a sect_offset. (read_attribute_reprocess): Adjust. Change-Id: I0e22e0864130fb490072b41ae099762918b8ad4d
This commit is contained in:

committed by
Simon Marchi

parent
2b0c7f41d1
commit
e57933dc9c
@ -1,3 +1,9 @@
|
||||
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
||||
|
||||
* dwarf2/read.c (read_loclist_index, read_rnglist_index): Return
|
||||
a sect_offset.
|
||||
(read_attribute_reprocess): Adjust.
|
||||
|
||||
2021-02-02 Simon Marchi <simon.marchi@efficios.com>
|
||||
|
||||
* dwarf2/die.h (struct die_info) <ranges_base>: Split in...
|
||||
|
@ -20223,7 +20223,8 @@ lookup_loclist_base (struct dwarf2_cu *cu)
|
||||
|
||||
/* Given a DW_FORM_loclistx value LOCLIST_INDEX, fetch the offset from the
|
||||
array of offsets in the .debug_loclists section. */
|
||||
static CORE_ADDR
|
||||
|
||||
static sect_offset
|
||||
read_loclist_index (struct dwarf2_cu *cu, ULONGEST loclist_index)
|
||||
{
|
||||
dwarf2_per_objfile *per_objfile = cu->per_objfile;
|
||||
@ -20273,14 +20274,15 @@ read_loclist_index (struct dwarf2_cu *cu, ULONGEST loclist_index)
|
||||
const gdb_byte *info_ptr = section->buffer + start_offset;
|
||||
|
||||
if (cu->header.offset_size == 4)
|
||||
return bfd_get_32 (abfd, info_ptr) + loclist_base;
|
||||
return (sect_offset) (bfd_get_32 (abfd, info_ptr) + loclist_base);
|
||||
else
|
||||
return bfd_get_64 (abfd, info_ptr) + loclist_base;
|
||||
return (sect_offset) (bfd_get_64 (abfd, info_ptr) + loclist_base);
|
||||
}
|
||||
|
||||
/* Given a DW_FORM_rnglistx value RNGLIST_INDEX, fetch the offset from the
|
||||
array of offsets in the .debug_rnglists section. */
|
||||
static CORE_ADDR
|
||||
|
||||
static sect_offset
|
||||
read_rnglist_index (struct dwarf2_cu *cu, ULONGEST rnglist_index,
|
||||
dwarf_tag tag)
|
||||
{
|
||||
@ -20337,9 +20339,9 @@ read_rnglist_index (struct dwarf2_cu *cu, ULONGEST rnglist_index,
|
||||
const gdb_byte *info_ptr = section->buffer + start_offset;
|
||||
|
||||
if (cu->header.offset_size == 4)
|
||||
return read_4_bytes (abfd, info_ptr) + rnglist_base;
|
||||
return (sect_offset) (read_4_bytes (abfd, info_ptr) + rnglist_base);
|
||||
else
|
||||
return read_8_bytes (abfd, info_ptr) + rnglist_base;
|
||||
return (sect_offset) (read_8_bytes (abfd, info_ptr) + rnglist_base);
|
||||
}
|
||||
|
||||
/* Process the attributes that had to be skipped in the first round. These
|
||||
@ -20360,18 +20362,18 @@ read_attribute_reprocess (const struct die_reader_specs *reader,
|
||||
break;
|
||||
case DW_FORM_loclistx:
|
||||
{
|
||||
CORE_ADDR loclists_sect_off
|
||||
sect_offset loclists_sect_off
|
||||
= read_loclist_index (cu, attr->as_unsigned_reprocess ());
|
||||
|
||||
attr->set_unsigned (loclists_sect_off);
|
||||
attr->set_unsigned (to_underlying (loclists_sect_off));
|
||||
}
|
||||
break;
|
||||
case DW_FORM_rnglistx:
|
||||
{
|
||||
CORE_ADDR rnglists_sect_off
|
||||
sect_offset rnglists_sect_off
|
||||
= read_rnglist_index (cu, attr->as_unsigned_reprocess (), tag);
|
||||
|
||||
attr->set_unsigned (rnglists_sect_off);
|
||||
attr->set_unsigned (to_underlying (rnglists_sect_off));
|
||||
}
|
||||
break;
|
||||
case DW_FORM_strx:
|
||||
|
Reference in New Issue
Block a user