Change section functions to be methods of dwarf2_section_info
This changes various section-related functions to be methods on dwarf2_section_info. I think this clarifies the role of these functions. This also changes one such function to return bool. gdb/ChangeLog 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2read.c (dwarf2_section_buffer_overflow_complaint) (dwarf2_section_size, dwarf2_get_section_info) (create_signatured_type_table_from_debug_names) (create_addrmap_from_aranges, read_debug_names_from_section) (get_gdb_index_contents_from_section, read_comp_unit_head) (error_check_comp_unit_head, read_abbrev_offset) (create_debug_type_hash_table, init_cu_die_reader) (read_cutu_die_from_dwo, dwarf2_build_psymtabs_hard) (read_comp_units_from_section, create_cus_hash_table) (create_dwp_hash_table, create_dwo_unit_in_dwp_v1) (create_dwp_v2_section, dwarf2_rnglists_process) (dwarf2_ranges_process, read_die_and_siblings, read_full_die) (abbrev_table_read_table, read_indirect_string_at_offset_from) (read_indirect_string_from_dwz, read_addr_index_1) (read_str_index, dwarf_decode_line_header, skip_form_bytes) (dwarf_decode_macro_bytes, dwarf_decode_macros) (fill_in_loclist_baton): Update. * dwarf2/section.h (struct dwarf2_section_info) <get_name, get_containing_section, get_bfd_owner, get_bfd_section, get_file_name, get_id, get_flags, empty, read>: Declare methods. (dwarf2_read_section, get_section_name, get_section_file_name) (get_containing_section, get_section_bfd_owner) (get_section_bfd_section, get_section_name, get_section_file_name) (get_section_id, get_section_flags, dwarf2_section_empty_p): Don't declare. * dwarf2/section.c (dwarf2_section_info::get_containing_section) (dwarf2_section_info::get_bfd_owner) (dwarf2_section_info::get_bfd_section) (dwarf2_section_info::get_name) (dwarf2_section_info::get_file_name, dwarf2_section_info::get_id) (dwarf2_section_info::get_flags, dwarf2_section_info::empty) (dwarf2_section_info::read): Now methods. * dwarf-index-write.c (class debug_names): Update. Change-Id: Ic849f182f57a18bad6b1c7c3b9368005d307758a
This commit is contained in:
parent
2c86cff96f
commit
96b792931f
5 changed files with 183 additions and 162 deletions
|
@ -1,3 +1,39 @@
|
|||
2020-02-08 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* dwarf2read.c (dwarf2_section_buffer_overflow_complaint)
|
||||
(dwarf2_section_size, dwarf2_get_section_info)
|
||||
(create_signatured_type_table_from_debug_names)
|
||||
(create_addrmap_from_aranges, read_debug_names_from_section)
|
||||
(get_gdb_index_contents_from_section, read_comp_unit_head)
|
||||
(error_check_comp_unit_head, read_abbrev_offset)
|
||||
(create_debug_type_hash_table, init_cu_die_reader)
|
||||
(read_cutu_die_from_dwo, dwarf2_build_psymtabs_hard)
|
||||
(read_comp_units_from_section, create_cus_hash_table)
|
||||
(create_dwp_hash_table, create_dwo_unit_in_dwp_v1)
|
||||
(create_dwp_v2_section, dwarf2_rnglists_process)
|
||||
(dwarf2_ranges_process, read_die_and_siblings, read_full_die)
|
||||
(abbrev_table_read_table, read_indirect_string_at_offset_from)
|
||||
(read_indirect_string_from_dwz, read_addr_index_1)
|
||||
(read_str_index, dwarf_decode_line_header, skip_form_bytes)
|
||||
(dwarf_decode_macro_bytes, dwarf_decode_macros)
|
||||
(fill_in_loclist_baton): Update.
|
||||
* dwarf2/section.h (struct dwarf2_section_info) <get_name,
|
||||
get_containing_section, get_bfd_owner, get_bfd_section,
|
||||
get_file_name, get_id, get_flags, empty, read>: Declare methods.
|
||||
(dwarf2_read_section, get_section_name, get_section_file_name)
|
||||
(get_containing_section, get_section_bfd_owner)
|
||||
(get_section_bfd_section, get_section_name, get_section_file_name)
|
||||
(get_section_id, get_section_flags, dwarf2_section_empty_p): Don't
|
||||
declare.
|
||||
* dwarf2/section.c (dwarf2_section_info::get_containing_section)
|
||||
(dwarf2_section_info::get_bfd_owner)
|
||||
(dwarf2_section_info::get_bfd_section)
|
||||
(dwarf2_section_info::get_name)
|
||||
(dwarf2_section_info::get_file_name, dwarf2_section_info::get_id)
|
||||
(dwarf2_section_info::get_flags, dwarf2_section_info::empty)
|
||||
(dwarf2_section_info::read): Now methods.
|
||||
* dwarf-index-write.c (class debug_names): Update.
|
||||
|
||||
2020-02-08 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* dwarf2read.h (struct dwarf2_section_info, dwarf2_read_section):
|
||||
|
|
|
@ -960,8 +960,7 @@ private:
|
|||
: m_abfd (dwarf2_per_objfile->objfile->obfd),
|
||||
m_dwarf2_per_objfile (dwarf2_per_objfile)
|
||||
{
|
||||
dwarf2_read_section (dwarf2_per_objfile->objfile,
|
||||
&dwarf2_per_objfile->str);
|
||||
dwarf2_per_objfile->str.read (dwarf2_per_objfile->objfile);
|
||||
if (dwarf2_per_objfile->str.buffer == NULL)
|
||||
return;
|
||||
for (const gdb_byte *data = dwarf2_per_objfile->str.buffer;
|
||||
|
|
|
@ -30,55 +30,57 @@
|
|||
#include "objfiles.h"
|
||||
|
||||
struct dwarf2_section_info *
|
||||
get_containing_section (const struct dwarf2_section_info *section)
|
||||
dwarf2_section_info::get_containing_section () const
|
||||
{
|
||||
gdb_assert (section->is_virtual);
|
||||
return section->s.containing_section;
|
||||
gdb_assert (is_virtual);
|
||||
return s.containing_section;
|
||||
}
|
||||
|
||||
struct bfd *
|
||||
get_section_bfd_owner (const struct dwarf2_section_info *section)
|
||||
dwarf2_section_info::get_bfd_owner () const
|
||||
{
|
||||
if (section->is_virtual)
|
||||
const dwarf2_section_info *section = this;
|
||||
if (is_virtual)
|
||||
{
|
||||
section = get_containing_section (section);
|
||||
section = get_containing_section ();
|
||||
gdb_assert (!section->is_virtual);
|
||||
}
|
||||
return section->s.section->owner;
|
||||
}
|
||||
|
||||
asection *
|
||||
get_section_bfd_section (const struct dwarf2_section_info *section)
|
||||
dwarf2_section_info::get_bfd_section () const
|
||||
{
|
||||
const dwarf2_section_info *section = this;
|
||||
if (section->is_virtual)
|
||||
{
|
||||
section = get_containing_section (section);
|
||||
section = get_containing_section ();
|
||||
gdb_assert (!section->is_virtual);
|
||||
}
|
||||
return section->s.section;
|
||||
}
|
||||
|
||||
const char *
|
||||
get_section_name (const struct dwarf2_section_info *section)
|
||||
dwarf2_section_info::get_name () const
|
||||
{
|
||||
asection *sectp = get_section_bfd_section (section);
|
||||
asection *sectp = get_bfd_section ();
|
||||
|
||||
gdb_assert (sectp != NULL);
|
||||
return bfd_section_name (sectp);
|
||||
}
|
||||
|
||||
const char *
|
||||
get_section_file_name (const struct dwarf2_section_info *section)
|
||||
dwarf2_section_info::get_file_name () const
|
||||
{
|
||||
bfd *abfd = get_section_bfd_owner (section);
|
||||
bfd *abfd = get_bfd_owner ();
|
||||
|
||||
return bfd_get_filename (abfd);
|
||||
}
|
||||
|
||||
int
|
||||
get_section_id (const struct dwarf2_section_info *section)
|
||||
dwarf2_section_info::get_id () const
|
||||
{
|
||||
asection *sectp = get_section_bfd_section (section);
|
||||
asection *sectp = get_bfd_section ();
|
||||
|
||||
if (sectp == NULL)
|
||||
return 0;
|
||||
|
@ -86,61 +88,60 @@ get_section_id (const struct dwarf2_section_info *section)
|
|||
}
|
||||
|
||||
int
|
||||
get_section_flags (const struct dwarf2_section_info *section)
|
||||
dwarf2_section_info::get_flags () const
|
||||
{
|
||||
asection *sectp = get_section_bfd_section (section);
|
||||
asection *sectp = get_bfd_section ();
|
||||
|
||||
gdb_assert (sectp != NULL);
|
||||
return bfd_section_flags (sectp);
|
||||
}
|
||||
|
||||
int
|
||||
dwarf2_section_empty_p (const struct dwarf2_section_info *section)
|
||||
bool
|
||||
dwarf2_section_info::empty () const
|
||||
{
|
||||
if (section->is_virtual)
|
||||
return section->size == 0;
|
||||
return section->s.section == NULL || section->size == 0;
|
||||
if (is_virtual)
|
||||
return size == 0;
|
||||
return s.section == NULL || size == 0;
|
||||
}
|
||||
|
||||
void
|
||||
dwarf2_read_section (struct objfile *objfile, dwarf2_section_info *info)
|
||||
dwarf2_section_info::read (struct objfile *objfile)
|
||||
{
|
||||
asection *sectp;
|
||||
bfd *abfd;
|
||||
gdb_byte *buf, *retbuf;
|
||||
|
||||
if (info->readin)
|
||||
if (readin)
|
||||
return;
|
||||
info->buffer = NULL;
|
||||
info->readin = true;
|
||||
buffer = NULL;
|
||||
readin = true;
|
||||
|
||||
if (dwarf2_section_empty_p (info))
|
||||
if (empty ())
|
||||
return;
|
||||
|
||||
sectp = get_section_bfd_section (info);
|
||||
sectp = get_bfd_section ();
|
||||
|
||||
/* If this is a virtual section we need to read in the real one first. */
|
||||
if (info->is_virtual)
|
||||
if (is_virtual)
|
||||
{
|
||||
struct dwarf2_section_info *containing_section =
|
||||
get_containing_section (info);
|
||||
get_containing_section ();
|
||||
|
||||
gdb_assert (sectp != NULL);
|
||||
if ((sectp->flags & SEC_RELOC) != 0)
|
||||
{
|
||||
error (_("Dwarf Error: DWP format V2 with relocations is not"
|
||||
" supported in section %s [in module %s]"),
|
||||
get_section_name (info), get_section_file_name (info));
|
||||
get_name (), get_file_name ());
|
||||
}
|
||||
dwarf2_read_section (objfile, containing_section);
|
||||
containing_section->read (objfile);
|
||||
/* Other code should have already caught virtual sections that don't
|
||||
fit. */
|
||||
gdb_assert (info->virtual_offset + info->size
|
||||
<= containing_section->size);
|
||||
gdb_assert (virtual_offset + size <= containing_section->size);
|
||||
/* If the real section is empty or there was a problem reading the
|
||||
section we shouldn't get here. */
|
||||
gdb_assert (containing_section->buffer != NULL);
|
||||
info->buffer = containing_section->buffer + info->virtual_offset;
|
||||
buffer = containing_section->buffer + virtual_offset;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -148,12 +149,12 @@ dwarf2_read_section (struct objfile *objfile, dwarf2_section_info *info)
|
|||
Otherwise we attach it to the BFD. */
|
||||
if ((sectp->flags & SEC_RELOC) == 0)
|
||||
{
|
||||
info->buffer = gdb_bfd_map_section (sectp, &info->size);
|
||||
buffer = gdb_bfd_map_section (sectp, &size);
|
||||
return;
|
||||
}
|
||||
|
||||
buf = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, info->size);
|
||||
info->buffer = buf;
|
||||
buf = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, size);
|
||||
buffer = buf;
|
||||
|
||||
/* When debugging .o files, we may need to apply relocations; see
|
||||
http://sourceware.org/ml/gdb-patches/2002-04/msg00136.html .
|
||||
|
@ -162,15 +163,15 @@ dwarf2_read_section (struct objfile *objfile, dwarf2_section_info *info)
|
|||
retbuf = symfile_relocate_debug_section (objfile, sectp, buf);
|
||||
if (retbuf != NULL)
|
||||
{
|
||||
info->buffer = retbuf;
|
||||
buffer = retbuf;
|
||||
return;
|
||||
}
|
||||
|
||||
abfd = get_section_bfd_owner (info);
|
||||
abfd = get_bfd_owner ();
|
||||
gdb_assert (abfd != NULL);
|
||||
|
||||
if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0
|
||||
|| bfd_bread (buf, info->size, abfd) != info->size)
|
||||
|| bfd_bread (buf, size, abfd) != size)
|
||||
{
|
||||
error (_("Dwarf Error: Can't read DWARF data"
|
||||
" in section %s [in module %s]"),
|
||||
|
|
|
@ -45,6 +45,42 @@
|
|||
|
||||
struct dwarf2_section_info
|
||||
{
|
||||
/* Return the name of this section. */
|
||||
const char *get_name () const;
|
||||
|
||||
/* Return the containing section of this section, which must be a
|
||||
virtual section. */
|
||||
struct dwarf2_section_info *get_containing_section () const;
|
||||
|
||||
/* Return the bfd owner of this section. */
|
||||
struct bfd *get_bfd_owner () const;
|
||||
|
||||
/* Return the bfd section of this section.
|
||||
Returns NULL if the section is not present. */
|
||||
asection *get_bfd_section () const;
|
||||
|
||||
/* Return the name of the file this section is in. */
|
||||
const char *get_file_name () const;
|
||||
|
||||
/* Return the id of this section.
|
||||
Returns 0 if this section doesn't exist. */
|
||||
int get_id () const;
|
||||
|
||||
/* Return the flags of this section. This section (or containing
|
||||
section if this is a virtual section) must exist. */
|
||||
int get_flags () const;
|
||||
|
||||
/* Return true if this section does not exist or if it has no
|
||||
contents. */
|
||||
bool empty () const;
|
||||
|
||||
/* Read the contents of this section.
|
||||
OBJFILE is the main object file, but not necessarily the file where
|
||||
the section comes from. E.g., for DWO files the bfd of INFO is the bfd
|
||||
of the DWO file.
|
||||
If the section is compressed, uncompress it before returning. */
|
||||
void read (struct objfile *objfile);
|
||||
|
||||
union
|
||||
{
|
||||
/* If this is a real section, the bfd section. */
|
||||
|
@ -67,55 +103,4 @@ struct dwarf2_section_info
|
|||
bool is_virtual;
|
||||
};
|
||||
|
||||
/* Read the contents of the section INFO.
|
||||
OBJFILE is the main object file, but not necessarily the file where
|
||||
the section comes from. E.g., for DWO files the bfd of INFO is the bfd
|
||||
of the DWO file.
|
||||
If the section is compressed, uncompress it before returning. */
|
||||
|
||||
extern void dwarf2_read_section (struct objfile *objfile,
|
||||
dwarf2_section_info *info);
|
||||
|
||||
extern const char *get_section_name (const struct dwarf2_section_info *);
|
||||
|
||||
extern const char *get_section_file_name (const struct dwarf2_section_info *);
|
||||
|
||||
/* Return the containing section of virtual section SECTION. */
|
||||
|
||||
extern struct dwarf2_section_info *get_containing_section
|
||||
(const struct dwarf2_section_info *section);
|
||||
|
||||
/* Return the bfd owner of SECTION. */
|
||||
|
||||
extern struct bfd *get_section_bfd_owner
|
||||
(const struct dwarf2_section_info *section);
|
||||
|
||||
/* Return the bfd section of SECTION.
|
||||
Returns NULL if the section is not present. */
|
||||
|
||||
extern asection *get_section_bfd_section
|
||||
(const struct dwarf2_section_info *section);
|
||||
|
||||
/* Return the name of SECTION. */
|
||||
|
||||
extern const char *get_section_name
|
||||
(const struct dwarf2_section_info *section);
|
||||
|
||||
/* Return the name of the file SECTION is in. */
|
||||
|
||||
extern const char *get_section_file_name
|
||||
(const struct dwarf2_section_info *section);
|
||||
|
||||
/* Return the id of SECTION.
|
||||
Returns 0 if SECTION doesn't exist. */
|
||||
|
||||
extern int get_section_id (const struct dwarf2_section_info *section);
|
||||
|
||||
/* Return the flags of SECTION.
|
||||
SECTION (or containing section if this is a virtual section) must exist. */
|
||||
|
||||
extern int get_section_flags (const struct dwarf2_section_info *section);
|
||||
|
||||
extern int dwarf2_section_empty_p (const struct dwarf2_section_info *section);
|
||||
|
||||
#endif /* GDB_DWARF2_SECTION_H */
|
||||
|
|
138
gdb/dwarf2read.c
138
gdb/dwarf2read.c
|
@ -2071,8 +2071,8 @@ dwarf2_section_buffer_overflow_complaint (struct dwarf2_section_info *section)
|
|||
{
|
||||
complaint (_("debug info runs off end of %s section"
|
||||
" [in module %s]"),
|
||||
get_section_name (section),
|
||||
get_section_file_name (section));
|
||||
section->get_name (),
|
||||
section->get_file_name ());
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2414,7 +2414,7 @@ dwarf2_section_size (struct objfile *objfile,
|
|||
struct dwarf2_section_info *info)
|
||||
{
|
||||
if (!info->readin)
|
||||
dwarf2_read_section (objfile, info);
|
||||
info->read (objfile);
|
||||
return info->size;
|
||||
}
|
||||
|
||||
|
@ -2451,9 +2451,9 @@ dwarf2_get_section_info (struct objfile *objfile,
|
|||
gdb_assert_not_reached ("unexpected section");
|
||||
}
|
||||
|
||||
dwarf2_read_section (objfile, info);
|
||||
info->read (objfile);
|
||||
|
||||
*sectp = get_section_bfd_section (info);
|
||||
*sectp = info->get_bfd_section ();
|
||||
*bufp = info->buffer;
|
||||
*sizep = info->size;
|
||||
}
|
||||
|
@ -2953,8 +2953,8 @@ create_signatured_type_table_from_debug_names
|
|||
{
|
||||
struct objfile *objfile = dwarf2_per_objfile->objfile;
|
||||
|
||||
dwarf2_read_section (objfile, section);
|
||||
dwarf2_read_section (objfile, abbrev_section);
|
||||
section->read (objfile);
|
||||
abbrev_section->read (objfile);
|
||||
|
||||
gdb_assert (dwarf2_per_objfile->all_type_units.empty ());
|
||||
dwarf2_per_objfile->all_type_units.reserve (map.tu_count);
|
||||
|
@ -3087,7 +3087,7 @@ create_addrmap_from_aranges (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
}
|
||||
}
|
||||
|
||||
dwarf2_read_section (objfile, section);
|
||||
section->read (objfile);
|
||||
|
||||
const bfd_endian dwarf5_byte_order = gdbarch_byte_order (gdbarch);
|
||||
|
||||
|
@ -5214,21 +5214,21 @@ read_debug_names_from_section (struct objfile *objfile,
|
|||
struct dwarf2_section_info *section,
|
||||
mapped_debug_names &map)
|
||||
{
|
||||
if (dwarf2_section_empty_p (section))
|
||||
if (section->empty ())
|
||||
return false;
|
||||
|
||||
/* Older elfutils strip versions could keep the section in the main
|
||||
executable while splitting it for the separate debug info file. */
|
||||
if ((get_section_flags (section) & SEC_HAS_CONTENTS) == 0)
|
||||
if ((section->get_flags () & SEC_HAS_CONTENTS) == 0)
|
||||
return false;
|
||||
|
||||
dwarf2_read_section (objfile, section);
|
||||
section->read (objfile);
|
||||
|
||||
map.dwarf5_byte_order = gdbarch_byte_order (get_objfile_arch (objfile));
|
||||
|
||||
const gdb_byte *addr = section->buffer;
|
||||
|
||||
bfd *const abfd = get_section_bfd_owner (section);
|
||||
bfd *const abfd = section->get_bfd_owner ();
|
||||
|
||||
unsigned int bytes_read;
|
||||
LONGEST length = read_initial_length (abfd, addr, &bytes_read);
|
||||
|
@ -6088,15 +6088,15 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner)
|
|||
{
|
||||
dwarf2_section_info *section = §ion_owner->gdb_index;
|
||||
|
||||
if (dwarf2_section_empty_p (section))
|
||||
if (section->empty ())
|
||||
return {};
|
||||
|
||||
/* Older elfutils strip versions could keep the section in the main
|
||||
executable while splitting it for the separate debug info file. */
|
||||
if ((get_section_flags (section) & SEC_HAS_CONTENTS) == 0)
|
||||
if ((section->get_flags () & SEC_HAS_CONTENTS) == 0)
|
||||
return {};
|
||||
|
||||
dwarf2_read_section (obj, section);
|
||||
section->read (obj);
|
||||
|
||||
/* dwarf2_section_info::size is a bfd_size_type, while
|
||||
gdb::array_view works with size_t. On 32-bit hosts, with
|
||||
|
@ -6291,8 +6291,8 @@ read_comp_unit_head (struct comp_unit_head *cu_header,
|
|||
{
|
||||
int signed_addr;
|
||||
unsigned int bytes_read;
|
||||
const char *filename = get_section_file_name (section);
|
||||
bfd *abfd = get_section_bfd_owner (section);
|
||||
const char *filename = section->get_file_name ();
|
||||
bfd *abfd = section->get_bfd_owner ();
|
||||
|
||||
cu_header->length = read_initial_length (abfd, info_ptr, &bytes_read);
|
||||
cu_header->initial_length_size = bytes_read;
|
||||
|
@ -6419,7 +6419,7 @@ error_check_comp_unit_head (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
struct dwarf2_section_info *section,
|
||||
struct dwarf2_section_info *abbrev_section)
|
||||
{
|
||||
const char *filename = get_section_file_name (section);
|
||||
const char *filename = section->get_file_name ();
|
||||
|
||||
if (to_underlying (header->abbrev_sect_off)
|
||||
>= dwarf2_section_size (dwarf2_per_objfile->objfile, abbrev_section))
|
||||
|
@ -6472,12 +6472,12 @@ read_abbrev_offset (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
struct dwarf2_section_info *section,
|
||||
sect_offset sect_off)
|
||||
{
|
||||
bfd *abfd = get_section_bfd_owner (section);
|
||||
bfd *abfd = section->get_bfd_owner ();
|
||||
const gdb_byte *info_ptr;
|
||||
unsigned int initial_length_size, offset_size;
|
||||
uint16_t version;
|
||||
|
||||
dwarf2_read_section (dwarf2_per_objfile->objfile, section);
|
||||
section->read (dwarf2_per_objfile->objfile);
|
||||
info_ptr = section->buffer + to_underlying (sect_off);
|
||||
read_initial_length (abfd, info_ptr, &initial_length_size);
|
||||
offset_size = initial_length_size == 4 ? 4 : 8;
|
||||
|
@ -6613,10 +6613,10 @@ create_debug_type_hash_table (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
|
||||
if (dwarf_read_debug)
|
||||
fprintf_unfiltered (gdb_stdlog, "Reading %s for %s:\n",
|
||||
get_section_name (section),
|
||||
get_section_file_name (abbrev_section));
|
||||
section->get_name (),
|
||||
abbrev_section->get_file_name ());
|
||||
|
||||
dwarf2_read_section (objfile, section);
|
||||
section->read (objfile);
|
||||
info_ptr = section->buffer;
|
||||
|
||||
if (info_ptr == NULL)
|
||||
|
@ -6624,7 +6624,7 @@ create_debug_type_hash_table (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
|
||||
/* We can't set abfd until now because the section may be empty or
|
||||
not present, in which case the bfd is unknown. */
|
||||
abfd = get_section_bfd_owner (section);
|
||||
abfd = section->get_bfd_owner ();
|
||||
|
||||
/* We don't use cutu_reader here because we don't need to read
|
||||
any dies: the signature is in the header. */
|
||||
|
@ -7060,7 +7060,7 @@ init_cu_die_reader (struct die_reader_specs *reader,
|
|||
struct abbrev_table *abbrev_table)
|
||||
{
|
||||
gdb_assert (section->readin && section->buffer != NULL);
|
||||
reader->abfd = get_section_bfd_owner (section);
|
||||
reader->abfd = section->get_bfd_owner ();
|
||||
reader->cu = cu;
|
||||
reader->dwo_file = dwo_file;
|
||||
reader->die_section = section;
|
||||
|
@ -7158,8 +7158,8 @@ read_cutu_die_from_dwo (struct dwarf2_per_cu_data *this_cu,
|
|||
/* Set up for reading the DWO CU/TU. */
|
||||
cu->dwo_unit = dwo_unit;
|
||||
dwarf2_section_info *section = dwo_unit->section;
|
||||
dwarf2_read_section (objfile, section);
|
||||
abfd = get_section_bfd_owner (section);
|
||||
section->read (objfile);
|
||||
abfd = section->get_bfd_owner ();
|
||||
begin_info_ptr = info_ptr = (section->buffer
|
||||
+ to_underlying (dwo_unit->sect_off));
|
||||
dwo_abbrev_section = &dwo_unit->dwo_file->sections.abbrev;
|
||||
|
@ -7242,7 +7242,7 @@ read_cutu_die_from_dwo (struct dwarf2_per_cu_data *this_cu,
|
|||
{
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"Read die from %s@0x%x of %s:\n",
|
||||
get_section_name (section),
|
||||
section->get_name (),
|
||||
(unsigned) (begin_info_ptr - section->buffer),
|
||||
bfd_get_filename (abfd));
|
||||
dump_die (comp_unit_die, dwarf_die_debug);
|
||||
|
@ -7392,7 +7392,7 @@ cutu_reader::cutu_reader (struct dwarf2_per_cu_data *this_cu,
|
|||
struct dwarf2_per_objfile *dwarf2_per_objfile = this_cu->dwarf2_per_objfile;
|
||||
struct objfile *objfile = dwarf2_per_objfile->objfile;
|
||||
struct dwarf2_section_info *section = this_cu->section;
|
||||
bfd *abfd = get_section_bfd_owner (section);
|
||||
bfd *abfd = section->get_bfd_owner ();
|
||||
struct dwarf2_cu *cu;
|
||||
const gdb_byte *begin_info_ptr;
|
||||
struct signatured_type *sig_type = NULL;
|
||||
|
@ -7422,7 +7422,7 @@ cutu_reader::cutu_reader (struct dwarf2_per_cu_data *this_cu,
|
|||
}
|
||||
|
||||
/* This is cheap if the section is already read in. */
|
||||
dwarf2_read_section (objfile, section);
|
||||
section->read (objfile);
|
||||
|
||||
begin_info_ptr = info_ptr = section->buffer + to_underlying (this_cu->sect_off);
|
||||
|
||||
|
@ -7613,7 +7613,7 @@ cutu_reader::cutu_reader (struct dwarf2_per_cu_data *this_cu,
|
|||
struct dwarf2_per_objfile *dwarf2_per_objfile = this_cu->dwarf2_per_objfile;
|
||||
struct objfile *objfile = dwarf2_per_objfile->objfile;
|
||||
struct dwarf2_section_info *section = this_cu->section;
|
||||
bfd *abfd = get_section_bfd_owner (section);
|
||||
bfd *abfd = section->get_bfd_owner ();
|
||||
struct dwarf2_section_info *abbrev_section;
|
||||
const gdb_byte *begin_info_ptr, *info_ptr;
|
||||
int has_children;
|
||||
|
@ -7630,7 +7630,7 @@ cutu_reader::cutu_reader (struct dwarf2_per_cu_data *this_cu,
|
|||
: get_abbrev_section_for_cu (this_cu));
|
||||
|
||||
/* This is cheap if the section is already read in. */
|
||||
dwarf2_read_section (objfile, section);
|
||||
section->read (objfile);
|
||||
|
||||
m_new_cu.reset (new dwarf2_cu (this_cu));
|
||||
|
||||
|
@ -8347,7 +8347,7 @@ dwarf2_build_psymtabs_hard (struct dwarf2_per_objfile *dwarf2_per_objfile)
|
|||
|
||||
dwarf2_per_objfile->reading_partial_symbols = 1;
|
||||
|
||||
dwarf2_read_section (objfile, &dwarf2_per_objfile->info);
|
||||
dwarf2_per_objfile->info.read (objfile);
|
||||
|
||||
/* Any cached compilation units will be linked by the per-objfile
|
||||
read_in_chain. Make sure to free them when we're done. */
|
||||
|
@ -8426,10 +8426,10 @@ read_comp_units_from_section (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
|
||||
if (dwarf_read_debug)
|
||||
fprintf_unfiltered (gdb_stdlog, "Reading %s for %s\n",
|
||||
get_section_name (section),
|
||||
get_section_file_name (section));
|
||||
section->get_name (),
|
||||
section->get_file_name ());
|
||||
|
||||
dwarf2_read_section (objfile, section);
|
||||
section->read (objfile);
|
||||
|
||||
info_ptr = section->buffer;
|
||||
|
||||
|
@ -11738,7 +11738,7 @@ create_cus_hash_table (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
struct objfile *objfile = dwarf2_per_objfile->objfile;
|
||||
const gdb_byte *info_ptr, *end_ptr;
|
||||
|
||||
dwarf2_read_section (objfile, §ion);
|
||||
section.read (objfile);
|
||||
info_ptr = section.buffer;
|
||||
|
||||
if (info_ptr == NULL)
|
||||
|
@ -11747,8 +11747,8 @@ create_cus_hash_table (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
if (dwarf_read_debug)
|
||||
{
|
||||
fprintf_unfiltered (gdb_stdlog, "Reading %s for %s:\n",
|
||||
get_section_name (§ion),
|
||||
get_section_file_name (§ion));
|
||||
section.get_name (),
|
||||
section.get_file_name ());
|
||||
}
|
||||
|
||||
end_ptr = info_ptr + section.size;
|
||||
|
@ -11950,9 +11950,9 @@ create_dwp_hash_table (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
else
|
||||
index = &dwp_file->sections.cu_index;
|
||||
|
||||
if (dwarf2_section_empty_p (index))
|
||||
if (index->empty ())
|
||||
return NULL;
|
||||
dwarf2_read_section (objfile, index);
|
||||
index->read (objfile);
|
||||
|
||||
index_ptr = index->buffer;
|
||||
index_end = index_ptr + index->size;
|
||||
|
@ -12242,8 +12242,8 @@ create_dwo_unit_in_dwp_v1 (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
}
|
||||
|
||||
if (i < 2
|
||||
|| dwarf2_section_empty_p (§ions.info_or_types)
|
||||
|| dwarf2_section_empty_p (§ions.abbrev))
|
||||
|| sections.info_or_types.empty ()
|
||||
|| sections.abbrev.empty ())
|
||||
{
|
||||
error (_("Dwarf Error: bad DWP hash table, missing DWO sections"
|
||||
" [in module %s]"),
|
||||
|
@ -12267,10 +12267,10 @@ create_dwo_unit_in_dwp_v1 (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
|
||||
std::string virtual_dwo_name =
|
||||
string_printf ("virtual-dwo/%d-%d-%d-%d",
|
||||
get_section_id (§ions.abbrev),
|
||||
get_section_id (§ions.line),
|
||||
get_section_id (§ions.loc),
|
||||
get_section_id (§ions.str_offsets));
|
||||
sections.abbrev.get_id (),
|
||||
sections.line.get_id (),
|
||||
sections.loc.get_id (),
|
||||
sections.str_offsets.get_id ());
|
||||
/* Can we use an existing virtual DWO file? */
|
||||
dwo_file_slot = lookup_dwo_file_slot (dwarf2_per_objfile,
|
||||
virtual_dwo_name.c_str (),
|
||||
|
@ -12348,7 +12348,7 @@ create_dwp_v2_section (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
if (size == 0)
|
||||
return result;
|
||||
|
||||
sectp = get_section_bfd_section (section);
|
||||
sectp = section->get_bfd_section ();
|
||||
|
||||
/* Flag an error if the piece denoted by OFFSET,SIZE is outside the
|
||||
bounds of the real section. This is a pretty-rare event, so just
|
||||
|
@ -14111,7 +14111,7 @@ dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
|
|||
found_base = cu->base_known;
|
||||
base = cu->base_address;
|
||||
|
||||
dwarf2_read_section (objfile, &dwarf2_per_objfile->rnglists);
|
||||
dwarf2_per_objfile->rnglists.read (objfile);
|
||||
if (offset >= dwarf2_per_objfile->rnglists.size)
|
||||
{
|
||||
complaint (_("Offset %d out of bounds for DW_AT_ranges attribute"),
|
||||
|
@ -14279,7 +14279,7 @@ dwarf2_ranges_process (unsigned offset, struct dwarf2_cu *cu,
|
|||
found_base = cu->base_known;
|
||||
base = cu->base_address;
|
||||
|
||||
dwarf2_read_section (objfile, &dwarf2_per_objfile->ranges);
|
||||
dwarf2_per_objfile->ranges.read (objfile);
|
||||
if (offset >= dwarf2_per_objfile->ranges.size)
|
||||
{
|
||||
complaint (_("Offset %d out of bounds for DW_AT_ranges attribute"),
|
||||
|
@ -18151,7 +18151,7 @@ read_die_and_siblings (const struct die_reader_specs *reader,
|
|||
{
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"Read die from %s@0x%x of %s:\n",
|
||||
get_section_name (reader->die_section),
|
||||
reader->die_section->get_name (),
|
||||
(unsigned) (info_ptr - reader->die_section->buffer),
|
||||
bfd_get_filename (reader->abfd));
|
||||
dump_die (die, dwarf_die_debug);
|
||||
|
@ -18248,7 +18248,7 @@ read_full_die (const struct die_reader_specs *reader,
|
|||
{
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"Read die from %s@0x%x of %s:\n",
|
||||
get_section_name (reader->die_section),
|
||||
reader->die_section->get_name (),
|
||||
(unsigned) (info_ptr - reader->die_section->buffer),
|
||||
bfd_get_filename (reader->abfd));
|
||||
dump_die (*diep, dwarf_die_debug);
|
||||
|
@ -18319,7 +18319,7 @@ abbrev_table_read_table (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
sect_offset sect_off)
|
||||
{
|
||||
struct objfile *objfile = dwarf2_per_objfile->objfile;
|
||||
bfd *abfd = get_section_bfd_owner (section);
|
||||
bfd *abfd = section->get_bfd_owner ();
|
||||
const gdb_byte *abbrev_ptr;
|
||||
struct abbrev_info *cur_abbrev;
|
||||
unsigned int abbrev_number, bytes_read, abbrev_name;
|
||||
|
@ -18328,7 +18328,7 @@ abbrev_table_read_table (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
|
||||
abbrev_table_up abbrev_table (new struct abbrev_table (sect_off));
|
||||
|
||||
dwarf2_read_section (objfile, section);
|
||||
section->read (objfile);
|
||||
abbrev_ptr = section->buffer + to_underlying (sect_off);
|
||||
abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read);
|
||||
abbrev_ptr += bytes_read;
|
||||
|
@ -19711,7 +19711,7 @@ read_indirect_string_at_offset_from (struct objfile *objfile,
|
|||
const char *form_name,
|
||||
const char *sect_name)
|
||||
{
|
||||
dwarf2_read_section (objfile, sect);
|
||||
sect->read (objfile);
|
||||
if (sect->buffer == NULL)
|
||||
error (_("%s used without %s section [in module %s]"),
|
||||
form_name, sect_name, bfd_get_filename (abfd));
|
||||
|
@ -19758,7 +19758,7 @@ static const char *
|
|||
read_indirect_string_from_dwz (struct objfile *objfile, struct dwz_file *dwz,
|
||||
LONGEST str_offset)
|
||||
{
|
||||
dwarf2_read_section (objfile, &dwz->str);
|
||||
dwz->str.read (objfile);
|
||||
|
||||
if (dwz->str.buffer == NULL)
|
||||
error (_("DW_FORM_GNU_strp_alt used without .debug_str "
|
||||
|
@ -19819,7 +19819,7 @@ read_addr_index_1 (struct dwarf2_per_objfile *dwarf2_per_objfile,
|
|||
const gdb_byte *info_ptr;
|
||||
ULONGEST addr_base_or_zero = addr_base.has_value () ? *addr_base : 0;
|
||||
|
||||
dwarf2_read_section (objfile, &dwarf2_per_objfile->addr);
|
||||
dwarf2_per_objfile->addr.read (objfile);
|
||||
if (dwarf2_per_objfile->addr.buffer == NULL)
|
||||
error (_("DW_FORM_addr_index used without .debug_addr section [in module %s]"),
|
||||
objfile_name (objfile));
|
||||
|
@ -19922,17 +19922,17 @@ read_str_index (struct dwarf2_cu *cu,
|
|||
ULONGEST str_offset;
|
||||
static const char form_name[] = "DW_FORM_GNU_str_index or DW_FORM_strx";
|
||||
|
||||
dwarf2_read_section (objfile, str_section);
|
||||
dwarf2_read_section (objfile, str_offsets_section);
|
||||
str_section->read (objfile);
|
||||
str_offsets_section->read (objfile);
|
||||
if (str_section->buffer == NULL)
|
||||
error (_("%s used without %s section"
|
||||
" in CU at offset %s [in module %s]"),
|
||||
form_name, get_section_name (str_section),
|
||||
form_name, str_section->get_name (),
|
||||
sect_offset_str (cu->header.sect_off), objf_name);
|
||||
if (str_offsets_section->buffer == NULL)
|
||||
error (_("%s used without %s section"
|
||||
" in CU at offset %s [in module %s]"),
|
||||
form_name, get_section_name (str_section),
|
||||
form_name, str_section->get_name (),
|
||||
sect_offset_str (cu->header.sect_off), objf_name);
|
||||
info_ptr = (str_offsets_section->buffer
|
||||
+ str_offsets_base
|
||||
|
@ -20423,7 +20423,7 @@ dwarf_decode_line_header (sect_offset sect_off, struct dwarf2_cu *cu)
|
|||
= cu->per_cu->dwarf2_per_objfile;
|
||||
|
||||
section = get_debug_line_section (cu);
|
||||
dwarf2_read_section (dwarf2_per_objfile->objfile, section);
|
||||
section->read (dwarf2_per_objfile->objfile);
|
||||
if (section->buffer == NULL)
|
||||
{
|
||||
if (cu->dwo_unit && cu->per_cu->is_debug_types)
|
||||
|
@ -20435,7 +20435,7 @@ dwarf_decode_line_header (sect_offset sect_off, struct dwarf2_cu *cu)
|
|||
|
||||
/* We can't do this until we know the section is non-empty.
|
||||
Only then do we know we have such a section. */
|
||||
abfd = get_section_bfd_owner (section);
|
||||
abfd = section->get_bfd_owner ();
|
||||
|
||||
/* Make sure that at least there's room for the total_length field.
|
||||
That could be 12 bytes long, but we're just going to fudge that. */
|
||||
|
@ -24435,7 +24435,7 @@ skip_form_bytes (bfd *abfd, const gdb_byte *bytes, const gdb_byte *buffer_end,
|
|||
default:
|
||||
{
|
||||
complaint (_("invalid form 0x%x in `%s'"),
|
||||
form, get_section_name (section));
|
||||
form, section->get_name ());
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -24778,10 +24778,10 @@ dwarf_decode_macro_bytes (struct dwarf2_cu *cu,
|
|||
{
|
||||
struct dwz_file *dwz = dwarf2_get_dwz_file (dwarf2_per_objfile);
|
||||
|
||||
dwarf2_read_section (objfile, &dwz->macro);
|
||||
dwz->macro.read (objfile);
|
||||
|
||||
include_section = &dwz->macro;
|
||||
include_bfd = get_section_bfd_owner (include_section);
|
||||
include_bfd = include_section->get_bfd_owner ();
|
||||
include_mac_end = dwz->macro.buffer + dwz->macro.size;
|
||||
is_dwz = 1;
|
||||
}
|
||||
|
@ -24884,13 +24884,13 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
|
|||
}
|
||||
}
|
||||
|
||||
dwarf2_read_section (objfile, section);
|
||||
section->read (objfile);
|
||||
if (section->buffer == NULL)
|
||||
{
|
||||
complaint (_("missing %s section"), section_name);
|
||||
return;
|
||||
}
|
||||
abfd = get_section_bfd_owner (section);
|
||||
abfd = section->get_bfd_owner ();
|
||||
|
||||
/* First pass: Find the name of the base filename.
|
||||
This filename is needed in order to process all macros whose definition
|
||||
|
@ -25150,7 +25150,7 @@ fill_in_loclist_baton (struct dwarf2_cu *cu,
|
|||
= cu->per_cu->dwarf2_per_objfile;
|
||||
struct dwarf2_section_info *section = cu_debug_loc_section (cu);
|
||||
|
||||
dwarf2_read_section (dwarf2_per_objfile->objfile, section);
|
||||
section->read (dwarf2_per_objfile->objfile);
|
||||
|
||||
baton->per_cu = cu->per_cu;
|
||||
gdb_assert (baton->per_cu);
|
||||
|
|
Loading…
Add table
Reference in a new issue