95 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
97 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
98 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
99 block_search_flags search_flags,
126 for (uint32_t i = 0; i < map.
tu_count; ++i)
140 section->
buffer + to_underlying (sect_off),
146 sig_type->section = section;
147 sig_type->sect_off = sect_off;
149 slot = htab_find_slot (sig_types_hash.get (), sig_type.get (), INSERT);
150 *slot = sig_type.get ();
188 const char *filename,
192 if (section->
empty ())
197 if ((section->
get_flags () & SEC_HAS_CONTENTS) == 0)
204 const gdb_byte *addr = section->
buffer;
208 unsigned int bytes_read;
214 if (bytes_read + length != section->
size)
217 warning (_(
"Section .debug_names in %s length %s does not match "
218 "section length %s, ignoring .debug_names."),
219 filename, plongest (bytes_read + length),
220 pulongest (section->
size));
229 warning (_(
"Section .debug_names in %s has unsupported version %d, "
230 "ignoring .debug_names."),
240 warning (_(
"Section .debug_names in %s has unsupported padding %d, "
241 "ignoring .debug_names."),
259 if (foreign_tu_count != 0)
261 warning (_(
"Section .debug_names in %s has unsupported %lu foreign TUs, "
262 "ignoring .debug_names."),
263 filename,
static_cast<unsigned long> (foreign_tu_count));
283 uint32_t augmentation_string_size =
read_4_bytes (abfd, addr);
289 augmentation_string_size += (-augmentation_string_size) & 3;
290 addr += augmentation_string_size;
312 const gdb_byte *abbrev_table_start = addr;
320 const auto insertpair
322 if (!insertpair.second)
324 warning (_(
"Section .debug_names in %s has duplicate index %s, "
325 "ignoring .debug_names."),
326 filename, pulongest (index_num));
340 if (attr.
form == DW_FORM_implicit_const)
348 indexval.
attr_vec.push_back (std::move (attr));
351 if (addr != abbrev_table_start + abbrev_table_size)
353 warning (_(
"Section .debug_names in %s has abbreviation_table "
354 "of size %s vs. written as %u, ignoring .debug_names."),
355 filename, plongest (addr - abbrev_table_start),
375 for (uint32_t i = 0; i < map.
cu_count; ++i)
390 per_bfd->all_units.push_back (std::move (per_cu));
395 sect_offset sect_off_prev;
396 for (uint32_t i = 0; i <= map.
cu_count; ++i)
398 sect_offset sect_off_next;
408 sect_off_next = (sect_offset) section.
size;
411 if (sect_off_next == sect_off_prev)
413 warning (_(
"Section .debug_names has duplicate entry in CU table,"
414 " ignoring .debug_names."));
417 if (sect_off_next < sect_off_prev)
419 warning (_(
"Section .debug_names has non-ascending CU table,"
420 " ignoring .debug_names."));
425 const ULONGEST length = 0;
428 sect_off_prev, length);
429 per_bfd->all_units.push_back (std::move (per_cu));
431 sect_off_prev = sect_off_next;
445 gdb_assert (
per_bfd->all_units.empty ());
465 auto map = gdb::make_unique<mapped_debug_names> ();
475 if (map->name_count == 0)
484 bfd_get_filename (dwz->
dwz_bfd.get ()),
487 warning (_(
"could not read '.debug_names' section from %s; skipping"),
488 bfd_get_filename (dwz->
dwz_bfd.get ()));
499 if (map->tu_count != 0)
503 if (
per_bfd->types.size () > 1)
515 (per_objfile, *map, section, &
per_bfd->abbrev);
522 per_bfd->index_table = std::move (map);
523 per_bfd->quick_file_names_table =
536 block_search_flags block_index,
556 block_search_flags block_index,
domain_enum domain,
596 const ULONGEST namei_string_offs
613 int (*cmp) (
const char *,
const char *);
615 gdb::unique_xmalloc_ptr<char> without_params;
623 if (strchr (
name,
'(') != NULL)
626 if (without_params != NULL)
627 name = without_params.get ();
644 complaint (_(
"Wrong .debug_names with name index %u but name_count=%u "
653 const uint32_t namei_full_hash
660 if (full_hash == namei_full_hash)
662 const char *
const namei_string = map.
namei_to_name (namei, per_objfile);
667 complaint (_(
"Wrong .debug_names hash for string at index %u "
674 if (cmp (namei_string,
name) == 0)
676 const ULONGEST namei_entry_offs
696 complaint (_(
"Wrong .debug_names with name index %u but name_count=%u "
703 const ULONGEST namei_entry_offs
724 unsigned int bytes_read;
733 complaint (_(
"Wrong .debug_names undefined abbrev code %s "
739 enum class symbol_linkage {
743 } symbol_linkage_ = symbol_linkage::unknown;
750 case DW_FORM_implicit_const:
751 ull = attr.implicit_const;
753 case DW_FORM_flag_present:
768 case DW_FORM_ref_sig8:
773 complaint (_(
"Unsupported .debug_names form %s [in module %s]"),
780 case DW_IDX_compile_unit:
785 complaint (_(
".debug_names entry has bad CU index %s"
792 per_cu = per_bfd->
get_cu (ull);
794 case DW_IDX_type_unit:
798 complaint (_(
".debug_names entry has bad TU index %s"
806 per_cu = per_bfd->
get_cu (nr_cus + ull);
809 case DW_IDX_die_offset:
813 per_cu = per_bfd->
get_cu (0);
815 case DW_IDX_GNU_internal:
818 symbol_linkage_ = symbol_linkage::static_;
820 case DW_IDX_GNU_external:
823 symbol_linkage_ = symbol_linkage::extern_;
829 if (per_cu ==
nullptr)
837 if (symbol_linkage_ != symbol_linkage::unknown)
839 if (symbol_linkage_ == symbol_linkage::static_)
858 case DW_TAG_variable:
859 case DW_TAG_subprogram:
862 case DW_TAG_structure_type:
872 case DW_TAG_structure_type:
882 case DW_TAG_variable:
908 case DW_TAG_variable:
917 case DW_TAG_subprogram:
927 case DW_TAG_structure_type:
968 = *(gdb::checked_static_cast<mapped_debug_names *>
970 const block_search_flags block_flags
973 const char *match_name =
name.ada ().lookup_name ().c_str ();
974 auto matcher = [&] (
const char *symname)
976 if (ordered_compare ==
nullptr)
978 return ordered_compare (symname, match_name) == 0;
990 while ((per_cu = iter.
next ()) != NULL)
1000 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
1002 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
1003 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
1004 block_search_flags search_flags,
1013 gdb_assert (lookup_name !=
nullptr || symbol_matcher ==
nullptr);
1014 if (lookup_name ==
nullptr)
1030 = *(gdb::checked_static_cast<mapped_debug_names *>
1043 while ((per_cu = iter.
next ()) != NULL)
static const gdb_byte * find_vec_in_debug_names(const mapped_debug_names &map, const char *name, dwarf2_per_objfile *per_objfile)
dw2_debug_names_iterator(const mapped_debug_names &map, block_search_flags block_index, domain_enum domain, const char *name, dwarf2_per_objfile *per_objfile)
dwarf2_per_cu_data * next()
const search_domain m_search
block_search_flags m_block_index
dw2_debug_names_iterator(const mapped_debug_names &map, block_search_flags block_index, domain_enum domain, uint32_t namei, dwarf2_per_objfile *per_objfile)
const domain_enum m_domain
const mapped_debug_names & m_map
dwarf2_per_objfile * m_per_objfile
dw2_debug_names_iterator(const mapped_debug_names &map, search_domain search, uint32_t namei, dwarf2_per_objfile *per_objfile, domain_enum domain=UNDEF_DOMAIN)
const gdb_byte * read_and_check_comp_unit_head(dwarf2_per_objfile *per_objfile, struct comp_unit_head *header, struct dwarf2_section_info *section, struct dwarf2_section_info *abbrev_section, const gdb_byte *info_ptr, rcuh_kind section_kind)
#define complaint(FMT,...)
gdb::unique_xmalloc_ptr< char > cp_remove_params(const char *demangled_name)
static ULONGEST extract_unsigned_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
struct dwz_file * dwarf2_get_dwz_file(dwarf2_per_bfd *per_bfd, bool require)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
uint32_t dwarf5_djb_hash(const char *str_)
const struct language_defn * current_language
LONGEST read_signed_leb128(bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read_ptr)
LONGEST read_initial_length(bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read, bool handle_nonstd)
ULONGEST read_unsigned_leb128(bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read_ptr)
static unsigned int read_4_bytes(bfd *abfd, const gdb_byte *buf)
static unsigned int read_2_bytes(bfd *abfd, const gdb_byte *buf)
static ULONGEST read_8_bytes(bfd *abfd, const gdb_byte *buf)
const char * objfile_name(const struct objfile *objfile)
int symbol_compare_ftype(const char *string1, const char *string2)
std::unique_ptr< quick_symbol_functions > quick_symbol_functions_up
static void create_signatured_type_table_from_debug_names(dwarf2_per_objfile *per_objfile, const mapped_debug_names &map, struct dwarf2_section_info *section, struct dwarf2_section_info *abbrev_section)
static bool create_cus_from_debug_names_list(dwarf2_per_bfd *per_bfd, const mapped_debug_names &map, dwarf2_section_info §ion, bool is_dwz)
static bool read_debug_names_from_section(struct objfile *objfile, const char *filename, struct dwarf2_section_info *section, mapped_debug_names &map)
bool dwarf2_read_debug_names(dwarf2_per_objfile *per_objfile)
static bool create_cus_from_debug_names(dwarf2_per_bfd *per_bfd, const mapped_debug_names &map, const mapped_debug_names &dwz_map)
static void create_addrmap_from_aranges(dwarf2_per_objfile *per_objfile, struct dwarf2_section_info *section)
static const gdb_byte dwarf5_augmentation[]
htab_up create_quick_file_names_table(unsigned int nr_initial_entries)
bool dw2_expand_symtabs_matching_symbol(mapped_index_base &index, const lookup_name_info &lookup_name_in, gdb::function_view< expand_symtabs_symbol_matcher_ftype > symbol_matcher, gdb::function_view< bool(offset_type)> match_callback, dwarf2_per_objfile *per_objfile)
dwarf2_per_cu_data_up create_cu_from_index_list(dwarf2_per_bfd *per_bfd, struct dwarf2_section_info *section, int is_dwz, sect_offset sect_off, ULONGEST length)
const char * read_indirect_string_at_offset(dwarf2_per_objfile *per_objfile, LONGEST str_offset)
void finalize_all_units(dwarf2_per_bfd *per_bfd)
void dw_expand_symtabs_matching_file_matcher(dwarf2_per_objfile *per_objfile, gdb::function_view< expand_symtabs_file_matcher_ftype > file_matcher)
bool read_addrmap_from_aranges(dwarf2_per_objfile *per_objfile, dwarf2_section_info *section, addrmap *mutable_map)
bool dw2_expand_symtabs_matching_one(dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, gdb::function_view< expand_symtabs_file_matcher_ftype > file_matcher, gdb::function_view< expand_symtabs_exp_notify_ftype > expansion_notify)
htab_up allocate_signatured_type_table()
dwarf2_per_objfile * get_dwarf2_per_objfile(struct objfile *objfile)
std::unique_ptr< signatured_type > signatured_type_up
std::unique_ptr< dwarf2_per_cu_data, dwarf2_per_cu_data_deleter > dwarf2_per_cu_data_up
const char * dwarf_form_name(unsigned form)
cu_offset type_cu_offset_in_tu
void expand_matching_symbols(struct objfile *, const lookup_name_info &lookup_name, domain_enum domain, int global, symbol_compare_ftype *ordered_compare) override
bool expand_symtabs_matching(struct objfile *objfile, gdb::function_view< expand_symtabs_file_matcher_ftype > file_matcher, const lookup_name_info *lookup_name, gdb::function_view< expand_symtabs_symbol_matcher_ftype > symbol_matcher, gdb::function_view< expand_symtabs_exp_notify_ftype > expansion_notify, block_search_flags search_flags, domain_enum domain, enum search_domain kind) override
void dump(struct objfile *objfile) override
gdb::array_view< dwarf2_per_cu_data_up > all_comp_units
dwarf2_per_cu_data * get_cu(int index) const
std::unique_ptr< dwarf_scanner_base > index_table
gdb::array_view< dwarf2_per_cu_data_up > all_type_units
signatured_type_up allocate_signatured_type(ULONGEST signature)
std::vector< dwarf2_per_cu_data_up > all_units
struct dwarf2_per_bfd * per_bfd
bool symtab_set_p(const dwarf2_per_cu_data *per_cu) const
void read(struct objfile *objfile)
struct bfd * get_bfd_owner() const
enum language la_language
std::vector< attr > attr_vec
const char * namei_to_name(uint32_t namei, dwarf2_per_objfile *per_objfile) const
const gdb_byte * tu_table_reordered
quick_symbol_functions_up make_quick_functions() const override
const gdb_byte * name_table_string_offs_reordered
bfd_endian dwarf5_byte_order
const gdb_byte * entry_pool
const uint32_t * hash_table_reordered
const gdb_byte * cu_table_reordered
size_t symbol_name_count() const override
const uint32_t * bucket_table_reordered
std::unordered_map< ULONGEST, index_val > abbrev_map
const char * symbol_name_at(offset_type idx, dwarf2_per_objfile *per_objfile) const override
const gdb_byte * name_table_entry_offs_reordered
struct gdbarch * arch() const
struct objfile_per_bfd_storage * per_bfd
void gdb_printf(struct ui_file *stream, const char *format,...)