71#include "gdb/gdb-index.h"
77#include "gdbsupport/function-view.h"
78#include "gdbsupport/gdb_optional.h"
79#include "gdbsupport/underlying.h"
80#include "gdbsupport/hash_enum.h"
85#include <unordered_map>
86#include "gdbsupport/selftest.h"
88#include "gdbsupport/pathstuff.h"
89#include "count-one-bits.h"
90#include <unordered_set>
94#include "gdbsupport/parallel-for.h"
95#include "gdbsupport/thread-pool.h"
104#define dwarf_read_debug_printf(fmt, ...) \
105 debug_prefixed_printf_cond (dwarf_read_debug >= 1, "dwarf-read", fmt, \
110#define dwarf_read_debug_printf_v(fmt, ...) \
111 debug_prefixed_printf_cond (dwarf_read_debug >= 2, "dwarf-read", fmt, \
150#define LOCLIST_HEADER_SIZE32 12
153#define LOCLIST_HEADER_SIZE64 20
156#define RNGLIST_HEADER_SIZE32 12
159#define RNGLIST_HEADER_SIZE64 20
242 return (
const char *) (this->constant_pool.data ()
247 {
return this->symbol_table.
size () / 2; }
323 {
".debug_info",
".zdebug_info" },
324 {
".debug_abbrev",
".zdebug_abbrev" },
325 {
".debug_line",
".zdebug_line" },
326 {
".debug_loc",
".zdebug_loc" },
327 {
".debug_loclists",
".zdebug_loclists" },
328 {
".debug_macinfo",
".zdebug_macinfo" },
329 {
".debug_macro",
".zdebug_macro" },
330 {
".debug_str",
".zdebug_str" },
331 {
".debug_str_offsets",
".zdebug_str_offsets" },
332 {
".debug_line_str",
".zdebug_line_str" },
333 {
".debug_ranges",
".zdebug_ranges" },
334 {
".debug_rnglists",
".zdebug_rnglists" },
335 {
".debug_types",
".zdebug_types" },
336 {
".debug_addr",
".zdebug_addr" },
337 {
".debug_frame",
".zdebug_frame" },
338 {
".eh_frame", NULL },
339 {
".gdb_index",
".zgdb_index" },
340 {
".debug_names",
".zdebug_names" },
341 {
".debug_aranges",
".zdebug_aranges" },
365 {
".debug_abbrev.dwo",
".zdebug_abbrev.dwo" },
366 {
".debug_info.dwo",
".zdebug_info.dwo" },
367 {
".debug_line.dwo",
".zdebug_line.dwo" },
368 {
".debug_loc.dwo",
".zdebug_loc.dwo" },
369 {
".debug_loclists.dwo",
".zdebug_loclists.dwo" },
370 {
".debug_macinfo.dwo",
".zdebug_macinfo.dwo" },
371 {
".debug_macro.dwo",
".zdebug_macro.dwo" },
372 {
".debug_rnglists.dwo",
".zdebug_rnglists.dwo" },
373 {
".debug_str.dwo",
".zdebug_str.dwo" },
374 {
".debug_str_offsets.dwo",
".zdebug_str_offsets.dwo" },
375 {
".debug_types.dwo",
".zdebug_types.dwo" },
376 {
".debug_cu_index",
".zdebug_cu_index" },
377 {
".debug_tu_index",
".zdebug_tu_index" },
444 std::vector<dwarf2_section_info>
types;
623#define MAX_NR_V2_DWO_SECTIONS \
638#define MAX_NR_V5_DWO_SECTIONS \
648 const gdb_byte *
sizes;
883 gdb_printf (file, _(
"The upper bound on the age of cached "
884 "DWARF compilation units is %s.\n"),
953 const char *comp_dir);
957 CORE_ADDR,
int decode_mapping);
973 const gdb_byte **
bytes,
1002 const char *suffix,
int physname,
1043 CORE_ADDR *, CORE_ADDR *,
1049 CORE_ADDR *, CORE_ADDR *,
1102 const gdb_byte *info_ptr,
1103 const gdb_byte **new_info_ptr,
1107 struct die_info **,
const gdb_byte *,
1111 struct die_info **,
const gdb_byte *);
1189 const gdb_byte *info_ptr,
1191 bool do_skip_children =
true);
1194 (sect_offset
sect_off,
unsigned int offset_in_dwz,
1277 if (data->is_debug_types)
1290 std::string &name_holder);
1298 const char *comp_dir, ULONGEST
signature,
int is_debug_types);
1303 (
dwarf2_cu *cu,
const char *dwo_name,
const char *comp_dir,
1307 (
dwarf2_cu *cu,
const char *dwo_name,
const char *comp_dir);
1324 complaint (_(
".debug_line section has line data without a file"));
1330 complaint (_(
".debug_line section has line "
1331 "program sequence without an end"));
1337 complaint (_(
"location expression too complex"));
1344 complaint (_(
"const value length mismatch for '%s', got %d, expected %d"),
1351 complaint (_(
"invalid attribute class or form for '%s' in '%s'"),
1459 can_copy (can_copy_)
1464 for (asection *sec =
obfd->sections; sec != NULL; sec = sec->next)
1472 per_cu->imported_symtabs_free ();
1473 per_cu->free_cached_file_names ();
1484 gdb_assert (!
queue.has_value ());
1518 if (per_cu->
index < this->m_symtabs.size ())
1528 if (per_cu->
index < this->m_symtabs.size ())
1539 if (per_cu->
index >= this->m_symtabs.size ())
1562 if (per_objfile == NULL)
1578 if (per_bfd ==
nullptr)
1608 flagword aflag = bfd_section_flags (sectp);
1610 if ((aflag & SEC_HAS_CONTENTS) == 0)
1613 else if (elf_section_data (sectp)->this_hdr.sh_size
1614 > bfd_get_file_size (abfd))
1616 bfd_size_type
size = elf_section_data (sectp)->this_hdr.sh_size;
1617 warning (_(
"Discarding section %s which has a section size (%s"
1618 ") larger than the file size [in module %s]"),
1619 bfd_section_name (sectp), phex_nz (
size,
sizeof (
size)),
1620 bfd_get_filename (abfd));
1625 this->
info.
size = bfd_section_size (sectp);
1630 this->
abbrev.
size = bfd_section_size (sectp);
1634 this->line.s.section = sectp;
1635 this->line.size = bfd_section_size (sectp);
1640 this->
loc.
size = bfd_section_size (sectp);
1655 this->
macro.
size = bfd_section_size (sectp);
1659 this->str.s.section = sectp;
1660 this->str.size = bfd_section_size (sectp);
1675 this->
addr.
size = bfd_section_size (sectp);
1680 this->
frame.
size = bfd_section_size (sectp);
1690 this->
ranges.
size = bfd_section_size (sectp);
1701 memset (&type_section, 0,
sizeof (type_section));
1703 type_section.
size = bfd_section_size (sectp);
1705 this->
types.push_back (type_section);
1715 this->
debug_names.size = bfd_section_size (sectp);
1723 if ((bfd_section_flags (sectp) & (SEC_LOAD | SEC_ALLOC))
1724 && bfd_section_vma (sectp) == 0)
1734 asection **sectp,
const gdb_byte **bufp,
1735 bfd_size_type *sizep)
1742 if (per_objfile == NULL)
1758 gdb_assert_not_reached (
"unexpected section");
1763 *sectp = info->get_bfd_section ();
1764 *bufp = info->buffer;
1765 *sizep = info->size;
1783 for (
auto §ion :
types)
1829 bool *symbol_found_p)
override
1831 *symbol_found_p =
false;
1842 CORE_ADDR adjusted_pc);
1846 CORE_ADDR pc,
struct obj_section *section,
int warn_if_readin)
1856 gdb::function_view<symbol_filename_ftype> fun,
1857 bool need_fullname)
override;
1882 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
1884 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
1885 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
1886 block_search_flags search_flags,
1907 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
1909 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
1910 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
1911 block_search_flags search_flags,
1929 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
1931 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
1932 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
1933 block_search_flags search_flags,
2005 return htab_up (htab_create_alloc (nr_initial_entries,
2098 result->per_bfd =
this;
2109 result->per_bfd =
this;
2111 result->is_debug_types =
true;
2123 sect_offset sect_off, ULONGEST length)
2126 the_cu->sect_off = sect_off;
2127 the_cu->set_length (length);
2128 the_cu->section = section;
2129 the_cu->is_dwz = is_dwz;
2146 sect_offset sect_off
2154 per_bfd->
all_units.push_back (std::move (per_cu));
2163 const gdb_byte *cu_list,
offset_type cu_list_elements,
2164 const gdb_byte *dwz_list,
offset_type dwz_elements)
2166 gdb_assert (per_bfd->
all_units.empty ());
2167 per_bfd->
all_units.reserve ((cu_list_elements + dwz_elements) / 2);
2172 if (dwz_elements == 0)
2194 cu_offset type_offset_in_tu;
2197 sect_offset sect_off
2206 sig_type->type_offset_in_tu = type_offset_in_tu;
2207 sig_type->section = section;
2208 sig_type->sect_off = sect_off;
2210 slot = htab_find_slot (sig_types_hash.get (), sig_type.get (), INSERT);
2211 *slot = sig_type.get ();
2213 per_bfd->
all_units.emplace_back (sig_type.release ());
2235 for (uint32_t i = 0; i < map.
tu_count; ++i)
2240 sect_offset sect_off
2249 section->
buffer + to_underlying (sect_off),
2255 sig_type->section = section;
2256 sig_type->sect_off = sect_off;
2258 slot = htab_find_slot (sig_types_hash.get (), sig_type.get (), INSERT);
2259 *slot = sig_type.get ();
2277 const gdb_byte *iter, *end;
2289 ULONGEST hi, lo, cu_index;
2299 complaint (_(
".gdb_index address table has invalid range (%s - %s)"),
2300 hex_string (lo), hex_string (hi));
2304 if (cu_index >= per_bfd->
all_units.size ())
2306 complaint (_(
".gdb_index address table has invalid CU number %u"),
2307 (
unsigned) cu_index);
2335 std::unordered_map<sect_offset,
2337 gdb::hash_enum<sect_offset>>
2338 debug_info_offset_to_per_cu;
2339 for (
const auto &per_cu : per_bfd->
all_units)
2345 if (per_cu->is_debug_types || per_cu->is_dwz)
2348 const auto insertpair
2349 = debug_info_offset_to_per_cu.emplace (per_cu->sect_off,
2353 gdb_assert (insertpair.second);
2356 std::set<sect_offset> debug_info_offset_seen;
2362 const gdb_byte *addr = section->
buffer;
2364 while (addr < section->buffer + section->
size)
2366 const gdb_byte *
const entry_addr = addr;
2367 unsigned int bytes_read;
2373 const gdb_byte *
const entry_end = addr + entry_length;
2374 const bool dwarf5_is_dwarf64 = bytes_read != 4;
2375 const uint8_t offset_size = dwarf5_is_dwarf64 ? 8 : 4;
2376 if (addr + entry_length > section->
buffer + section->
size)
2378 warning (_(
"Section .debug_aranges in %s entry at offset %s "
2379 "length %s exceeds section length %s, "
2380 "ignoring .debug_aranges."),
2382 plongest (entry_addr - section->
buffer),
2383 plongest (bytes_read + entry_length),
2384 pulongest (section->
size));
2393 warning (_(
"Section .debug_aranges in %s entry at offset %s "
2394 "has unsupported version %d, ignoring .debug_aranges."),
2400 const uint64_t debug_info_offset
2402 addr += offset_size;
2403 const auto per_cu_it
2404 = debug_info_offset_to_per_cu.find (sect_offset (debug_info_offset));
2405 if (per_cu_it == debug_info_offset_to_per_cu.cend ())
2407 warning (_(
"Section .debug_aranges in %s entry at offset %s "
2408 "debug_info_offset %s does not exists, "
2409 "ignoring .debug_aranges."),
2411 plongest (entry_addr - section->
buffer),
2412 pulongest (debug_info_offset));
2415 const auto insertpair
2416 = debug_info_offset_seen.insert (sect_offset (debug_info_offset));
2417 if (!insertpair.second)
2419 warning (_(
"Section .debug_aranges in %s has duplicate "
2420 "debug_info_offset %s, ignoring .debug_aranges."),
2427 const uint8_t address_size = *addr++;
2428 if (address_size < 1 || address_size > 8)
2430 warning (_(
"Section .debug_aranges in %s entry at offset %s "
2431 "address_size %u is invalid, ignoring .debug_aranges."),
2433 plongest (entry_addr - section->
buffer), address_size);
2437 const uint8_t segment_selector_size = *addr++;
2438 if (segment_selector_size != 0)
2440 warning (_(
"Section .debug_aranges in %s entry at offset %s "
2441 "segment_selector_size %u is not supported, "
2442 "ignoring .debug_aranges."),
2444 plongest (entry_addr - section->
buffer),
2445 segment_selector_size);
2456 addr += (entry_end - addr) % (2 * address_size);
2458 while (addr < entry_end)
2460 if (addr + 2 * address_size > entry_end)
2462 warning (_(
"Section .debug_aranges in %s entry at offset %s "
2463 "address list is not properly terminated, "
2464 "ignoring .debug_aranges."),
2466 plongest (entry_addr - section->
buffer));
2471 addr += address_size;
2474 addr += address_size;
2475 if (start == 0 && length == 0)
2489 ULONGEST end = start + length;
2494 mutable_map->
set_empty (start, end - 1, per_cu);
2534 gdb::array_view<const gdb_byte> buffer,
2536 const gdb_byte **cu_list,
2538 const gdb_byte **types_list,
2541 const gdb_byte *addr = &buffer[0];
2552 static int warning_printed = 0;
2553 if (!warning_printed)
2555 warning (_(
"Skipping obsolete .gdb_index section in %s."),
2557 warning_printed = 1;
2569 if (
version < 6 && !deprecated_ok)
2571 static int warning_printed = 0;
2572 if (!warning_printed)
2575Skipping deprecated .gdb_index section in %s.\n\
2576Do \"set use-deprecated-index-sections on\" before the file is read\n\
2577to use the section anyway."),
2579 warning_printed = 1;
2599 *cu_list = addr + metadata[i];
2600 *cu_list_elements = (metadata[i + 1] - metadata[i]) / 8;
2603 *types_list = addr + metadata[i];
2604 *types_list_elements = (metadata[i + 1] - metadata[i]) / 8;
2607 const gdb_byte *address_table = addr + metadata[i];
2608 const gdb_byte *address_table_end = addr + metadata[i + 1];
2610 = gdb::array_view<const gdb_byte> (address_table, address_table_end);
2613 const gdb_byte *symbol_table = addr + metadata[i];
2614 const gdb_byte *symbol_table_end = addr + metadata[i + 1];
2616 =
offset_view (gdb::array_view<const gdb_byte> (symbol_table,
2627 =
offset_view (gdb::array_view<const gdb_byte> (symbol_table,
2638typedef gdb::function_view
2641typedef gdb::function_view
2654 const gdb_byte *cu_list, *types_list, *dwz_list = NULL;
2655 offset_type cu_list_elements, types_list_elements, dwz_list_elements = 0;
2660 gdb::array_view<const gdb_byte> main_index_contents
2663 if (main_index_contents.empty ())
2666 std::unique_ptr<struct mapped_index> map (
new struct mapped_index);
2669 main_index_contents, map.get (), &cu_list,
2670 &cu_list_elements, &types_list,
2671 &types_list_elements))
2675 if (map->symbol_table.empty ())
2684 const gdb_byte *dwz_types_ignore;
2687 gdb::array_view<const gdb_byte> dwz_index_content
2688 = get_gdb_index_contents_dwz (
objfile, dwz);
2690 if (dwz_index_content.empty ())
2694 1, dwz_index_content, &dwz_map,
2695 &dwz_list, &dwz_list_elements,
2697 &dwz_types_elements_ignore))
2699 warning (_(
"could not read '.gdb_index' section from %s; skipping"),
2700 bfd_get_filename (dwz->
dwz_bfd.get ()));
2708 if (types_list_elements)
2712 if (per_bfd->
types.size () > 1)
2719 = (per_bfd->
types.size () == 1
2720 ? &per_bfd->
types[0]
2724 types_list_elements);
2757 if (comp_unit_die->
tag == DW_TAG_partial_unit)
2768 attr =
dwarf2_attr (comp_unit_die, DW_AT_stmt_list, cu);
2793 else if (lh ==
nullptr)
2800 if (slot !=
nullptr)
2803 std::vector<const char *> include_names;
2806 for (
const auto &entry : lh->file_names ())
2808 std::string name_holder;
2809 const char *include_name =
2811 if (include_name !=
nullptr)
2814 include_names.push_back (include_name);
2827 if (!include_names.empty ())
2828 memcpy (&qfn->
file_names[offset], include_names.data (),
2829 include_names.size () * sizeof (
const char *));
2869 const char *dirname =
nullptr;
2871 if (!IS_ABSOLUTE_PATH (qfn->
file_names[index]))
2874 gdb::unique_xmalloc_ptr<char> fullname;
2877 qfn->
real_names[index] = fullname.release ();
2903 fnd->forget_fullname ();
2909 if (file_data !=
nullptr && file_data->
real_names !=
nullptr)
2926 per_cu->free_cached_file_names ();
2959 gdb::optional<block_enum> block_index,
2989 offset_type cu_index = GDB_INDEX_CU_VALUE (cu_index_and_attrs);
2990 gdb_index_symbol_kind symbol_kind =
2991 GDB_INDEX_SYMBOL_KIND_VALUE (cu_index_and_attrs);
2996 int attrs_valid = (
index.version >= 7
2997 && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
3002 complaint (_(
".gdb_index entry has bad CU index"
3016 bool is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (cu_index_and_attrs);
3022 if (is_static != want_static)
3028 && symbol_kind == GDB_INDEX_SYMBOL_KIND_TYPE)
3043 if (symbol_kind != GDB_INDEX_SYMBOL_KIND_VARIABLE
3044 && symbol_kind != GDB_INDEX_SYMBOL_KIND_FUNCTION
3046 && symbol_kind != GDB_INDEX_SYMBOL_KIND_TYPE)
3050 if (symbol_kind != GDB_INDEX_SYMBOL_KIND_TYPE)
3054 if (symbol_kind != GDB_INDEX_SYMBOL_KIND_OTHER)
3058 if (symbol_kind != GDB_INDEX_SYMBOL_KIND_OTHER)
3084 for (
int i = 0; i < total; ++i)
3091 gdb_printf (_(
" Number of read CUs: %d\n"), total - count);
3092 gdb_printf (_(
" Number of unread CUs: %d\n"), count);
3105 mapped_index *index = (gdb::checked_static_cast<mapped_index *>
3117 for (
int i = 0; i < total_units; ++i)
3134 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
3135 gdb::function_view<
bool (
offset_type)> match_callback,
3142 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
3143 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify);
3158 = *(gdb::checked_static_cast<mapped_index *>
3161 const char *match_name =
name.ada ().lookup_name ().c_str ();
3162 auto matcher = [&] (
const char *symname)
3164 if (ordered_compare ==
nullptr)
3166 return ordered_compare (symname, match_name) == 0;
3249 std::string after = search_name;
3250 while (!after.empty () && (
unsigned char) after.back () == 0xff)
3252 if (!after.empty ())
3253 after.back () = (
unsigned char) after.back () + 1;
3259std::pair<std::vector<name_component>::const_iterator,
3260 std::vector<name_component>::const_iterator>
3268 const char *lang_name
3277 const char *elem_name = elem_qualified + elem.
name_offset;
3278 return name_cmp (elem_name,
name) < 0;
3283 auto lookup_compare_upper = [&] (
const char *
name,
3287 const char *elem_name = elem_qualified + elem.
name_offset;
3288 return name_cmp (
name, elem_name) < 0;
3297 if (lookup_name_without_params.
completion_mode () && lang_name[0] ==
'\0')
3300 return std::lower_bound (begin, end, lang_name, lookup_compare_lower);
3322 return std::lower_bound (lower, end, after.c_str (),
3323 lookup_compare_lower);
3326 return std::upper_bound (lower, end, lang_name, lookup_compare_upper);
3329 return {lower, upper};
3356 unsigned int previous_len = 0;
3358 if (strstr (
name,
"::") !=
nullptr)
3361 name[current_len] !=
'\0';
3364 gdb_assert (
name[current_len] ==
':');
3368 previous_len = current_len;
3374 for (
const char *iter = strstr (
name,
"__");
3376 iter = strstr (iter,
"__"))
3380 previous_len = iter -
name;
3391 const char *left_qualified
3393 const char *right_qualified
3396 const char *left_name = left_qualified + left.
name_offset;
3397 const char *right_name = right_qualified + right.name_offset;
3399 return name_cmp (left_name, right_name) < 0;
3403 this->name_components.end (),
3418 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
3419 gdb::function_view<
bool (
offset_type)> match_callback,
3427 index.build_name_components (per_objfile);
3436 std::vector<offset_type> matches;
3438 struct name_and_matcher
3443 bool operator== (
const name_and_matcher &other)
const
3445 return matcher == other.matcher && strcmp (
name, other.name) == 0;
3451 std::vector<name_and_matcher> matchers;
3461 name_and_matcher key {
3470 if (std::find (matchers.begin (), matchers.end (), key)
3473 matchers.push_back (std::move (key));
3477 lang_e, per_objfile);
3482 for (; bounds.first != bounds.second; ++bounds.first)
3484 const char *qualified
3487 if (!name_matcher (qualified, lookup_name_without_params, NULL)
3488 || (symbol_matcher != NULL && !symbol_matcher (qualified)))
3491 matches.push_back (bounds.first->idx);
3495 std::sort (matches.begin (), matches.end ());
3504 if (!match_callback (idx))
3515 static_assert (
sizeof (prev) >
sizeof (
offset_type),
"");
3522namespace selftests {
namespace dw2_expand_symtabs_matching {
3531 mock_mapped_index (gdb::array_view<const char *> symbols)
3532 : m_symbol_table (symbols)
3535 DISABLE_COPY_AND_ASSIGN (mock_mapped_index);
3538 size_t symbol_name_count ()
const override
3540 return m_symbol_table.size ();
3544 const char *symbol_name_at
3547 return m_symbol_table[idx];
3556 gdb::array_view<const char *> m_symbol_table;
3563string_or_null (
const char *str)
3565 return str != NULL ? str :
"<null>";
3576check_match (
const char *file,
int line,
3577 mock_mapped_index &mock_index,
3579 bool completion_mode,
3580 std::initializer_list<const char *> expected_list,
3585 bool matched =
true;
3587 auto mismatch = [&] (
const char *expected_str,
3590 warning (_(
"%s:%d: match_type=%s, looking-for=\"%s\", "
3591 "expected=\"%s\", got=\"%s\"\n"),
3595 name, string_or_null (expected_str), string_or_null (got));
3599 auto expected_it = expected_list.begin ();
3600 auto expected_end = expected_list.end ();
3606 const char *matched_name = mock_index.symbol_name_at (idx, per_objfile);
3607 const char *expected_str
3608 = expected_it == expected_end ? NULL : *expected_it++;
3610 if (expected_str == NULL || strcmp (expected_str, matched_name) != 0)
3611 mismatch (expected_str, matched_name);
3615 const char *expected_str
3616 = expected_it == expected_end ? NULL : *expected_it++;
3617 if (expected_str != NULL)
3618 mismatch (expected_str, NULL);
3625static const char *test_symbols[] = {
3634 "ns2::tmpl<int>::foo2",
3635 "(anonymous namespace)::A::B::C",
3667 "z::std::tuple<(anonymous namespace)::ui*, std::bar<(anonymous namespace)::ui> >" \
3668 "::tuple<(anonymous namespace)::ui*, " \
3669 "std::default_delete<(anonymous namespace)::ui>, void>"
3680 const char *search_name,
3681 gdb::array_view<const char *> expected_syms,
3691 size_t distance = std::distance (bounds.first, bounds.second);
3692 if (distance != expected_syms.size ())
3695 for (
size_t exp_elem = 0; exp_elem < distance; exp_elem++)
3697 auto nc_elem = bounds.first + exp_elem;
3698 const char *qualified = index.
symbol_name_at (nc_elem->idx, per_objfile);
3699 if (strcmp (qualified, expected_syms[exp_elem]) != 0)
3710test_mapped_index_find_name_component_bounds ()
3712 mock_mapped_index mock_index (test_symbols);
3714 mock_index.build_name_components (NULL );
3719 static const char *expected_syms[] = {
3724 SELF_CHECK (check_find_bounds_finds
3725 (mock_index,
"t1_func", expected_syms,
3733 static const char *expected_syms1[] = {
3737 SELF_CHECK (check_find_bounds_finds
3738 (mock_index,
"\377", expected_syms1, NULL ));
3740 static const char *expected_syms2[] = {
3743 SELF_CHECK (check_find_bounds_finds
3744 (mock_index,
"\377\377", expected_syms2,
3752test_dw2_expand_symtabs_matching_symbol ()
3754 mock_mapped_index mock_index (test_symbols);
3758 bool any_mismatch =
false;
3763#define EXPECT(...) { __VA_ARGS__ }
3767#define CHECK_MATCH(NAME, MATCH_TYPE, COMPLETION_MODE, EXPECTED_LIST) \
3768 any_mismatch |= !check_match (__FILE__, __LINE__, \
3770 NAME, MATCH_TYPE, COMPLETION_MODE, \
3771 EXPECTED_LIST, NULL)
3774 for (
const char *sym : test_symbols)
3782 std::string with_params = std::string (sym) +
"(int)";
3788 with_params = std::string (sym) +
" ( int ) const";
3794 with_params = std::string (sym) +
" ( int ) &&";
3803 static const char str[] =
"\377";
3805 EXPECT (
"\377",
"\377\377123"));
3811 static const char str[] =
"t1_func";
3813 EXPECT (
"t1_func",
"t1_func1"));
3819 static const char str[] =
"function(int)";
3820 size_t len = strlen (str);
3823 for (
size_t i = 1; i < len; i++)
3825 lookup.assign (str, i);
3827 EXPECT (
"function"));
3842 static const char str[] = Z_SYM_NAME;
3843 size_t len = strlen (str);
3846 for (
size_t i = 1; i < len; i++)
3848 lookup.assign (str, i);
3850 EXPECT (Z_SYM_NAME));
3864 EXPECT (
"std::zfunction",
"std::zfunction2"));
3866 EXPECT (
"std::zfunction",
"std::zfunction2"));
3868 EXPECT (
"std::zfunction",
"std::zfunction2"));
3874 static const char expected[] =
"ns::foo<int>";
3884 static const char expected[] =
"ns::foo<char*>";
3886 static const bool completion_mode[2] = {
false,
true};
3887 for (
size_t i = 0; i < 2; i++)
3890 completion_mode[i], EXPECT (expected));
3892 completion_mode[i], EXPECT (expected));
3895 completion_mode[i], EXPECT (expected));
3897 completion_mode[i], EXPECT (expected));
3903 static const char expected[] =
"ns::foo<char*>";
3904 CHECK_MATCH (
"ns :: foo < char * > ( int ) const",
3906 CHECK_MATCH (
"ns :: foo < char * > ( int ) &&",
3908 CHECK_MATCH (
"foo < char * > ( int ) const",
3910 CHECK_MATCH (
"foo < char * > ( int ) &&",
3926 static const char *syms[] = {
3930 "A :: B :: C ( int )",
3935 for (
const char *s : syms)
3938 EXPECT (
"(anonymous namespace)::A::B::C"));
3943 static const char expected[] =
"ns2::tmpl<int>::foo2";
3950 SELF_CHECK (!any_mismatch);
3959 test_mapped_index_find_name_component_bounds ();
3960 test_dw2_expand_symtabs_matching_symbol ();
3976 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
3977 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify)
3979 if (file_matcher == NULL || per_cu->
mark)
3981 bool symtab_was_null = !per_objfile->
symtab_set_p (per_cu);
3985 gdb_assert (
symtab !=
nullptr);
3987 if (expansion_notify != NULL && symtab_was_null)
3988 return expansion_notify (
symtab);
4000 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
4001 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
4002 block_search_flags search_flags,
4006 bool global_seen =
false;
4008 = *(gdb::checked_static_cast<mapped_index *>
4013 for (vec_idx = 0; vec_idx < vec_len; ++vec_idx)
4015 offset_type cu_index_and_attrs = vec[vec_idx + 1];
4017 int is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (cu_index_and_attrs);
4018 gdb_index_symbol_kind symbol_kind =
4019 GDB_INDEX_SYMBOL_KIND_VALUE (cu_index_and_attrs);
4020 int cu_index = GDB_INDEX_CU_VALUE (cu_index_and_attrs);
4027 && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
4032 && symbol_kind == GDB_INDEX_SYMBOL_KIND_TYPE)
4057 if (symbol_kind != GDB_INDEX_SYMBOL_KIND_VARIABLE)
4061 if (symbol_kind != GDB_INDEX_SYMBOL_KIND_FUNCTION)
4065 if (symbol_kind != GDB_INDEX_SYMBOL_KIND_TYPE)
4069 if (symbol_kind != GDB_INDEX_SYMBOL_KIND_OTHER)
4080 complaint (_(
".gdb_index entry has bad CU index"
4101 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher)
4103 if (file_matcher == NULL)
4106 htab_up visited_found (htab_create_alloc (10, htab_hash_pointer,
4109 htab_up visited_not_found (htab_create_alloc (10, htab_hash_pointer,
4120 if (per_cu->is_debug_types)
4128 if (per_cu->fnd !=
nullptr)
4132 if (file_matcher (fnd->
get_name (),
false))
4141 || file_matcher (lbasename (fnd->
get_name ()),
true))
4151 if (file_data == NULL)
4154 if (htab_find (visited_not_found.get (), file_data) != NULL)
4156 else if (htab_find (visited_found.get (), file_data) != NULL)
4164 const char *this_real_name;
4166 if (file_matcher (file_data->
file_names[j],
false))
4175 && !file_matcher (lbasename (file_data->
file_names[j]),
4180 if (file_matcher (this_real_name,
false))
4187 void **slot = htab_find_slot (per_cu->mark
4188 ? visited_found.get ()
4189 : visited_not_found.get (),
4198 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
4200 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
4201 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
4202 block_search_flags search_flags,
4211 gdb_assert (lookup_name !=
nullptr || symbol_matcher ==
nullptr);
4212 if (lookup_name ==
nullptr)
4228 = *(gdb::checked_static_cast<mapped_index *>
4237 expansion_notify, search_flags, kind))
4261 for (i = 0; cust->
includes[i]; ++i)
4275 CORE_ADDR adjusted_pc)
4298 if (data ==
nullptr)
4301 if (warn_if_readin && per_objfile->
symtab_set_p (data))
4302 warning (_(
"(Internal error: pc %s in read in CU, but not in symtab.)"),
4308 if (warn_if_readin && result ==
nullptr)
4309 warning (_(
"(Error: pc %s in address map, but not in symtab.)"),
4318 gdb::function_view<symbol_filename_ftype> fun,
4325 std::unordered_set<quick_file_names *> qfn_cache;
4335 if (!per_cu->is_debug_types
4338 if (per_cu->file_names !=
nullptr)
4339 qfn_cache.insert (per_cu->file_names);
4347 if (per_cu->is_debug_types || per_objfile->
symtab_set_p (per_cu))
4350 if (per_cu->fnd !=
nullptr)
4354 const char *filename = fnd->
get_name ();
4355 const char *key = filename;
4356 const char *fullname =
nullptr;
4364 if (!filenames_cache.
seen (key))
4365 fun (filename, fullname);
4369 if (file_data ==
nullptr
4370 || qfn_cache.find (file_data) != qfn_cache.end ())
4375 const char *filename = file_data->
file_names[j];
4376 const char *key = filename;
4377 const char *fullname =
nullptr;
4385 if (!filenames_cache.
seen (key))
4386 fun (filename, fullname);
4430 const char *filename,
4450 unsigned int bytes_read;
4459 warning (_(
"Section .debug_names in %s length %s does not match "
4460 "section length %s, ignoring .debug_names."),
4461 filename, plongest (bytes_read +
length),
4471 warning (_(
"Section .debug_names in %s has unsupported version %d, "
4472 "ignoring .debug_names."),
4482 warning (_(
"Section .debug_names in %s has unsupported padding %d, "
4483 "ignoring .debug_names."),
4501 if (foreign_tu_count != 0)
4503 warning (_(
"Section .debug_names in %s has unsupported %lu foreign TUs, "
4504 "ignoring .debug_names."),
4505 filename,
static_cast<unsigned long> (foreign_tu_count));
4520 uint32_t abbrev_table_size =
read_4_bytes (abfd, addr);
4525 uint32_t augmentation_string_size =
read_4_bytes (abfd, addr);
4531 augmentation_string_size += (-augmentation_string_size) & 3;
4532 addr += augmentation_string_size;
4554 const gdb_byte *abbrev_table_start = addr;
4562 const auto insertpair
4564 if (!insertpair.second)
4566 warning (_(
"Section .debug_names in %s has duplicate index %s, "
4567 "ignoring .debug_names."),
4568 filename, pulongest (index_num));
4582 if (attr.
form == DW_FORM_implicit_const)
4590 indexval.
attr_vec.push_back (std::move (attr));
4593 if (addr != abbrev_table_start + abbrev_table_size)
4595 warning (_(
"Section .debug_names in %s has abbreviation_table "
4596 "of size %s vs. written as %u, ignoring .debug_names."),
4597 filename, plongest (addr - abbrev_table_start),
4617 for (uint32_t i = 0; i < map.
cu_count; ++i)
4637 sect_offset sect_off_prev;
4638 for (uint32_t i = 0; i <= map.
cu_count; ++i)
4640 sect_offset sect_off_next;
4653 if (sect_off_next == sect_off_prev)
4655 warning (_(
"Section .debug_names has duplicate entry in CU table,"
4656 " ignoring .debug_names."));
4659 if (sect_off_next < sect_off_prev)
4661 warning (_(
"Section .debug_names has non-ascending CU table,"
4662 " ignoring .debug_names."));
4667 const ULONGEST
length = 0;
4673 sect_off_prev = sect_off_next;
4718 if (map->name_count == 0)
4727 bfd_get_filename (dwz->
dwz_bfd.get ()),
4730 warning (_(
"could not read '.debug_names' section from %s; skipping"),
4731 bfd_get_filename (dwz->
dwz_bfd.get ()));
4742 if (map->tu_count != 0)
4746 if (
per_bfd->types.size () > 1)
4753 = (
per_bfd->types.size () == 1
4758 (per_objfile, *map, section, &
per_bfd->abbrev);
4765 per_bfd->index_table = std::move (map);
4766 per_bfd->quick_file_names_table =
4779 block_search_flags block_index,
4799 block_search_flags block_index,
domain_enum domain,
4839 const ULONGEST namei_string_offs
4856 int (*cmp) (
const char *,
const char *);
4858 gdb::unique_xmalloc_ptr<char> without_params;
4866 if (strchr (
name,
'(') != NULL)
4869 if (without_params != NULL)
4870 name = without_params.get ();
4887 complaint (_(
"Wrong .debug_names with name index %u but name_count=%u "
4896 const uint32_t namei_full_hash
4903 if (full_hash == namei_full_hash)
4905 const char *
const namei_string = map.
namei_to_name (namei, per_objfile);
4910 complaint (_(
"Wrong .debug_names hash for string at index %u "
4917 if (cmp (namei_string,
name) == 0)
4919 const ULONGEST namei_entry_offs
4939 complaint (_(
"Wrong .debug_names with name index %u but name_count=%u "
4946 const ULONGEST namei_entry_offs
4967 unsigned int bytes_read;
4976 complaint (_(
"Wrong .debug_names undefined abbrev code %s "
4982 enum class symbol_linkage {
4986 } symbol_linkage_ = symbol_linkage::unknown;
4993 case DW_FORM_implicit_const:
4994 ull = attr.implicit_const;
4996 case DW_FORM_flag_present:
5011 case DW_FORM_ref_sig8:
5016 complaint (_(
"Unsupported .debug_names form %s [in module %s]"),
5021 switch (attr.dw_idx)
5023 case DW_IDX_compile_unit:
5028 complaint (_(
".debug_names entry has bad CU index %s"
5035 per_cu = per_bfd->
get_cu (ull);
5037 case DW_IDX_type_unit:
5041 complaint (_(
".debug_names entry has bad TU index %s"
5049 per_cu = per_bfd->
get_cu (nr_cus + ull);
5052 case DW_IDX_die_offset:
5056 per_cu = per_bfd->
get_cu (0);
5058 case DW_IDX_GNU_internal:
5061 symbol_linkage_ = symbol_linkage::static_;
5063 case DW_IDX_GNU_external:
5066 symbol_linkage_ = symbol_linkage::extern_;
5072 if (per_cu ==
nullptr)
5080 if (symbol_linkage_ != symbol_linkage::unknown)
5082 if (symbol_linkage_ == symbol_linkage::static_)
5101 case DW_TAG_variable:
5102 case DW_TAG_subprogram:
5104 case DW_TAG_typedef:
5105 case DW_TAG_structure_type:
5114 case DW_TAG_typedef:
5115 case DW_TAG_structure_type:
5125 case DW_TAG_variable:
5151 case DW_TAG_variable:
5160 case DW_TAG_subprogram:
5169 case DW_TAG_typedef:
5170 case DW_TAG_structure_type:
5211 = *(gdb::checked_static_cast<mapped_debug_names *>
5213 const block_search_flags block_flags
5216 const char *match_name =
name.ada ().lookup_name ().c_str ();
5217 auto matcher = [&] (
const char *symname)
5219 if (ordered_compare ==
nullptr)
5221 return ordered_compare (symname, match_name) == 0;
5233 while ((per_cu = iter.
next ()) != NULL)
5243 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
5245 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
5246 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
5247 block_search_flags search_flags,
5256 gdb_assert (lookup_name !=
nullptr || symbol_matcher ==
nullptr);
5257 if (lookup_name ==
nullptr)
5273 = *(gdb::checked_static_cast<mapped_debug_names *>
5286 while ((per_cu = iter.
next ()) != NULL)
5300template <
typename T>
5301static gdb::array_view<const gdb_byte>
5328static gdb::array_view<const gdb_byte>
5332 if (build_id ==
nullptr)
5341static gdb::array_view<const gdb_byte>
5345 if (build_id ==
nullptr)
5397 get_gdb_index_contents_from_section<struct dwarf2_per_bfd>,
5398 get_gdb_index_contents_from_section<dwz_file>))
5439 catch (
const gdb_exception_error &except)
5459 if (attr !=
nullptr)
5464 if (attr !=
nullptr)
5481 abbrev = &per_bfd->
abbrev;
5491 sect_offset sect_off)
5493 bfd *abfd =
section->get_bfd_owner ();
5494 const gdb_byte *info_ptr;
5495 unsigned int initial_length_size, offset_size;
5499 info_ptr =
section->buffer + to_underlying (sect_off);
5501 offset_size = initial_length_size == 4 ? 4 : 8;
5502 info_ptr += initial_length_size;
5512 return (sect_offset)
read_offset (abfd, info_ptr, offset_size);
5539 return htab_up (htab_create_alloc (41,
5558 const gdb_byte *info_ptr, *end_ptr;
5569 if (info_ptr == NULL)
5574 abfd =
section->get_bfd_owner ();
5579 end_ptr = info_ptr +
section->size;
5580 while (info_ptr < end_ptr)
5585 const gdb_byte *ptr = info_ptr;
5599 abbrev_section, ptr, section_kind);
5604 if (ptr >= info_ptr +
length
5607 && header.
unit_type != DW_UT_split_type))
5613 if (types_htab == NULL)
5624 slot = htab_find_slot (types_htab.get (), dwo_tu, INSERT);
5625 gdb_assert (slot != NULL);
5627 complaint (_(
"debug type entry at offset %s is duplicate to"
5628 " the entry at offset %s, signature %s"),
5653 gdb::array_view<dwarf2_section_info> type_sections,
5654 htab_up &types_htab)
5677 (sig_type_holder.release ());
5684 gdb_assert (*slot == NULL);
5701 gdb_assert (! sig_entry->
queued);
5702 gdb_assert (per_objfile->
get_cu (sig_entry) == NULL);
5709 gdb_assert (sig_entry->
dwo_unit == NULL
5710 || sig_entry->
dwo_unit == dwo_entry);
5738 struct dwo_unit find_dwo_entry, *dwo_entry;
5756 &find_sig_entry, INSERT);
5768 if (sig_entry != NULL && sig_entry->
tu_read)
5781 if (dwo_entry == NULL)
5785 if (sig_entry == NULL)
5788 if (sig_entry->
dwo_unit ==
nullptr)
5817 &find_sig_entry, INSERT);
5823 if (sig_entry != NULL)
5830 if (dwo_entry == NULL)
5911 struct die_info *stub_comp_unit_die,
5912 const char *stub_comp_dir,
5914 const gdb_byte **result_info_ptr,
5915 struct die_info **result_comp_unit_die,
5922 const gdb_byte *begin_info_ptr, *info_ptr;
5923 struct attribute *comp_dir, *stmt_list, *low_pc, *high_pc, *ranges;
5924 int i,num_extra_attrs;
5929 gdb_assert ((stub_comp_unit_die != NULL) + (stub_comp_dir != NULL) <= 1);
5945 if (stub_comp_unit_die != NULL)
5950 stmt_list =
dwarf2_attr (stub_comp_unit_die, DW_AT_stmt_list, cu);
5951 low_pc =
dwarf2_attr (stub_comp_unit_die, DW_AT_low_pc, cu);
5952 high_pc =
dwarf2_attr (stub_comp_unit_die, DW_AT_high_pc, cu);
5953 ranges =
dwarf2_attr (stub_comp_unit_die, DW_AT_ranges, cu);
5954 comp_dir =
dwarf2_attr (stub_comp_unit_die, DW_AT_comp_dir, cu);
5970 else if (stub_comp_dir != NULL)
5974 comp_dir->
name = DW_AT_comp_dir;
5975 comp_dir->
form = DW_FORM_string;
5984 begin_info_ptr = info_ptr = (section->
buffer
5998 error (_(
"Dwarf Error: signature mismatch %s vs %s while reading"
5999 " TU at offset %s [in module %s]"),
6001 hex_string (cu->
header.signature),
6003 bfd_get_filename (abfd));
6028 *result_dwo_abbrev_table
6031 result_dwo_abbrev_table->get ());
6037 num_extra_attrs = ((stmt_list != NULL)
6041 + (comp_dir != NULL));
6042 info_ptr =
read_full_die_1 (result_reader, result_comp_unit_die, info_ptr,
6046 comp_unit_die = *result_comp_unit_die;
6048 if (stmt_list != NULL)
6049 comp_unit_die->
attrs[i++] = *stmt_list;
6051 comp_unit_die->
attrs[i++] = *low_pc;
6052 if (high_pc != NULL)
6053 comp_unit_die->
attrs[i++] = *high_pc;
6055 comp_unit_die->
attrs[i++] = *ranges;
6056 if (comp_dir != NULL)
6057 comp_unit_die->
attrs[i++] = *comp_dir;
6058 comp_unit_die->
num_attrs += num_extra_attrs;
6063 "Read die from %s@0x%x of %s:\n",
6066 bfd_get_filename (abfd));
6075 *result_info_ptr = info_ptr;
6082static gdb::optional<ULONGEST>
6085 if (cu->
header.version >= 5)
6086 return cu->
header.signature;
6088 attr =
dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_id, cu);
6090 return gdb::optional<ULONGEST> ();
6104 static std::mutex dwo_lock;
6106 std::lock_guard<std::mutex> guard (dwo_lock);
6111 const char *comp_dir;
6113 gdb_assert (cu != NULL);
6126 error (_(
"Dwarf Error: missing dwo_id for dwo_name %s"
6128 dwo_name, bfd_get_filename (per_cu->
per_bfd->
obfd));
6151 gdb_assert (sig_type->
dwo_unit != NULL);
6155 if (existing_cu !=
nullptr)
6166 gdb_assert (per_objfile->
get_cu (this_cu) ==
nullptr);
6209 const gdb_byte *begin_info_ptr;
6215 int rereading_dwo_cu = 0;
6242 if (existing_cu !=
nullptr)
6252 rereading_dwo_cu = 1;
6262 gdb_assert (cache !=
nullptr
6263 || per_objfile->
get_cu (this_cu) ==
nullptr);
6269 if (to_underlying (
cu->
header.first_die_cu_offset) != 0 && !rereading_dwo_cu)
6279 section, abbrev_section,
6287 ==
cu->
header.type_cu_offset_in_tu);
6303 section, abbrev_section,
6328 if (cache !=
nullptr)
6359 if (dwo_name !=
nullptr)
6362 struct die_info *dwo_comp_unit_die;
6366 complaint (_(
"compilation unit with DW_AT_GNU_dwo_name"
6367 " has children (offset %s) [in module %s]"),
6369 bfd_get_filename (
abfd));
6438 const gdb_byte *begin_info_ptr, *
info_ptr;
6445 gdb_assert (per_objfile->
get_cu (this_cu) ==
nullptr);
6463 if (parent_cu !=
nullptr)
6519 return htab_up (htab_create_alloc (3,
6522 htab_delete_entry<type_unit_group>,
6529#define NO_STMT_LIST_TYPE_UNIT_PSYMTAB (1 << 31)
6530#define NO_STMT_LIST_TYPE_UNIT_PSYMTAB_SIZE 10
6535static std::unique_ptr<type_unit_group>
6540 tu_group->hash.dwo_unit = cu->
dwo_unit;
6541 tu_group->hash.line_sect_off = line_offset_struct;
6582 type_unit_group_for_lookup.
hash.dwo_unit = cu->
dwo_unit;
6583 type_unit_group_for_lookup.
hash.line_sect_off = (sect_offset)
line_offset;
6585 &type_unit_group_for_lookup, INSERT);
6586 if (*slot ==
nullptr)
6588 sect_offset line_offset_struct = (sect_offset)
line_offset;
6589 std::unique_ptr<type_unit_group> grp
6591 *slot = grp.release ();
6596 gdb_assert (tu_group !=
nullptr);
6629 int index = per_cu->
index;
6639 int index = reader->cu->per_cu->index;
6640 void **slot = htab_find_slot_with_hash (
m_reader_hash.get (), &index,
6642 gdb_assert (*slot ==
nullptr);
6644 *slot = reader.release ();
6651 cooked_index_flag
flags,
6686 const int *rb = (
const int *) b;
6727 CORE_ADDR
value = to_underlying (offset);
6729 value |= ((CORE_ADDR) 1) << (8 *
sizeof (CORE_ADDR) - 1);
6743 sect_offset sect_off,
6754 const gdb_byte *info_ptr,
6762 const gdb_byte *watermark_ptr,
6763 const gdb_byte *info_ptr,
6766 const char **linkage_name,
6767 cooked_index_flag *
flags,
6768 sect_offset *sibling_offset,
6770 CORE_ADDR *maybe_defer,
6771 bool for_specification);
6777 const gdb_byte *info_ptr,
6783 const gdb_byte *info_ptr,
6830 cutu_reader reader (this_cu, per_objfile,
nullptr,
nullptr,
false,
6845 if (this_cu->
scanned.compare_exchange_strong (nope,
true))
6849 gdb_assert (storage !=
nullptr);
6873 gdb_assert (storage !=
nullptr);
6919 sect_offset abbrev_offset;
6950 std::vector<tu_abbrev_offset> sorted_by_abbrev;
6955 if (cu->is_debug_types)
6958 sorted_by_abbrev.emplace_back
6960 sig_type->sect_off));
6964 std::sort (sorted_by_abbrev.begin (), sorted_by_abbrev.end ());
6966 abbrev_offset = (sect_offset) ~(
unsigned) 0;
6972 || tu.abbrev_offset != abbrev_offset)
6974 abbrev_offset = tu.abbrev_offset;
7026 if (data->per_objfile->per_bfd->signatured_types == NULL)
7027 data->per_objfile->per_bfd->signatured_types
7031 slot = htab_find_slot (data->per_objfile->per_bfd->signatured_types.get (),
7046 cutu_reader reader (entry, data->per_objfile,
nullptr,
nullptr,
false);
7104 std::vector<std::unique_ptr<cooked_index>> indexes;
7106 per_bfd->quick_file_names_table
7108 if (!
per_bfd->debug_aranges.empty ())
7116 using iter_type =
decltype (
per_bfd->all_units.begin ());
7118 auto task_size_ = [] (iter_type iter)
7121 return (
size_t)per_cu->
length ();
7123 auto task_size = gdb::make_function_view (task_size_);
7130 using result_type = std::pair<std::unique_ptr<cooked_index>,
7131 std::vector<gdb_exception>>;
7132 std::vector<result_type> results
7133 = gdb::parallel_for_each (1,
per_bfd->all_units.begin (),
7135 [=] (iter_type iter, iter_type end)
7137 std::vector<gdb_exception> errors;
7138 cooked_index_storage thread_storage;
7139 for (; iter != end; ++iter)
7141 dwarf2_per_cu_data *per_cu = iter->get ();
7144 process_psymtab_comp_unit (per_cu, per_objfile,
7147 catch (gdb_exception &except)
7149 errors.push_back (std::move (except));
7152 return result_type (thread_storage.release (), std::move (errors));
7156 std::unordered_set<gdb_exception> seen_exceptions;
7157 for (
auto &one_result : results)
7159 indexes.push_back (std::move (one_result.first));
7160 for (
auto &one_exc : one_result.second)
7161 if (seen_exceptions.insert (one_exc).second)
7172 indexes.push_back (index_storage.release ());
7176 (std::remove_if (indexes.begin (),
7178 [] (
const std::unique_ptr<cooked_index> &entry)
7180 return entry == nullptr;
7183 indexes.shrink_to_fit ();
7186 per_bfd->index_table.reset (vec);
7189 if (main_entry !=
nullptr)
7210 unsigned int is_dwz,
7211 htab_up &types_htab,
7214 const gdb_byte *info_ptr;
7223 info_ptr = section->
buffer;
7225 while (info_ptr < section->buffer + section->
size)
7229 sect_offset sect_off = (sect_offset) (info_ptr - section->
buffer);
7233 abbrev_section, info_ptr,
7241 if (types_htab ==
nullptr)
7248 this_cu.reset (sig_type.release ());
7250 void **slot = htab_find_slot (types_htab.get (), sig_ptr, INSERT);
7251 gdb_assert (slot !=
nullptr);
7252 if (*slot !=
nullptr)
7253 complaint (_(
"debug type entry at offset %s is duplicate to"
7254 " the entry at offset %s, signature %s"),
7261 this_cu->set_length (cu_header.
get_length ());
7262 this_cu->is_dwz = is_dwz;
7263 this_cu->section = section;
7267 this_cu->set_version (cu_header.
version);
7269 info_ptr = info_ptr + this_cu->length ();
7279 size_t nr_tus =
per_bfd->tu_stats.nr_tus;
7280 size_t nr_cus =
per_bfd->all_units.size () - nr_tus;
7281 gdb::array_view<dwarf2_per_cu_data_up> tmp =
per_bfd->all_units;
7282 per_bfd->all_comp_units = tmp.slice (0, nr_cus);
7283 per_bfd->all_type_units = tmp.slice (nr_cus, nr_tus);
7308 catch (
const gdb_exception_error &)
7335 unsigned int bytes_read;
7349 const gdb_byte *info_ptr,
unsigned int *bytes_read)
7352 bfd *abfd = reader.
abfd;
7353 unsigned int abbrev_number
7356 if (abbrev_number == 0)
7363 error (_(
"Dwarf Error: Could not find abbrev number %d in %s"
7364 " at offset %s [in module %s]"),
7376static const gdb_byte *
7381 unsigned int bytes_read;
7386 return info_ptr + bytes_read;
7388 info_ptr =
skip_one_die (reader, info_ptr + bytes_read, abbrev);
7401static const gdb_byte *
7403 const struct abbrev_info *abbrev,
bool do_skip_children)
7405 unsigned int bytes_read;
7407 bfd *abfd = reader->
abfd;
7409 const gdb_byte *buffer = reader->
buffer;
7410 const gdb_byte *buffer_end = reader->
buffer_end;
7411 unsigned int form, i;
7413 if (do_skip_children && abbrev->
sibling_offset != (
unsigned short) -1)
7416 const gdb_byte *sibling_data = info_ptr + abbrev->
sibling_offset;
7417 unsigned int offset =
read_4_bytes (abfd, sibling_data);
7418 const gdb_byte *sibling_ptr
7419 = buffer + to_underlying (cu->
header.sect_off) + offset;
7420 if (sibling_ptr >= info_ptr && sibling_ptr < reader->buffer_end)
7435 if (do_skip_children && abbrev->
attrs[i].
name == DW_AT_sibling)
7438 if (attr.
form == DW_FORM_ref_addr)
7439 complaint (_(
"ignoring absolute DW_AT_sibling"));
7443 const gdb_byte *sibling_ptr = buffer + to_underlying (off);
7445 if (sibling_ptr < info_ptr)
7446 complaint (_(
"DW_AT_sibling points backwards"));
7459 case DW_FORM_ref_addr:
7462 if (cu->
header.version == 2)
7463 info_ptr += cu->
header.addr_size;
7465 info_ptr += cu->
header.offset_size;
7467 case DW_FORM_GNU_ref_alt:
7468 info_ptr += cu->
header.offset_size;
7471 info_ptr += cu->
header.addr_size;
7479 case DW_FORM_flag_present:
7480 case DW_FORM_implicit_const:
7497 case DW_FORM_ref_sig8:
7500 case DW_FORM_data16:
7503 case DW_FORM_string:
7505 info_ptr += bytes_read;
7507 case DW_FORM_sec_offset:
7509 case DW_FORM_GNU_strp_alt:
7510 info_ptr += cu->
header.offset_size;
7512 case DW_FORM_exprloc:
7515 info_ptr += bytes_read;
7517 case DW_FORM_block1:
7520 case DW_FORM_block2:
7523 case DW_FORM_block4:
7530 case DW_FORM_ref_udata:
7531 case DW_FORM_GNU_addr_index:
7532 case DW_FORM_GNU_str_index:
7533 case DW_FORM_rnglistx:
7534 case DW_FORM_loclistx:
7537 case DW_FORM_indirect:
7539 info_ptr += bytes_read;
7542 goto skip_attribute;
7545 error (_(
"Dwarf Error: Cannot handle %s "
7546 "in DWARF reader [in module %s]"),
7548 bfd_get_filename (abfd));
7606 if (dependent_cu != NULL)
7624 bool queued =
false;
7640 return queued && cu ==
nullptr;
7665 unsigned int debug_print_threshold;
7673 sprintf (buf,
"TU %s at offset %s",
7678 debug_print_threshold = 2;
7682 sprintf (buf,
"CU at offset %s",
7684 debug_print_threshold = 1;
7701 per_objfile->
queue->pop ();
7716 return to_underlying (die->
sect_off);
7723die_eq (
const void *item_lhs,
const void *item_rhs)
7747 cutu_reader reader (this_cu, per_objfile, NULL, existing_cu, skip_partial);
7752 const gdb_byte *info_ptr = reader.
info_ptr;
7756 htab_create_alloc_ex (cu->
header.length / 12,
7761 hashtab_obstack_allocate,
7762 dummy_obstack_deallocate);
7806 size_t mod_len =
sizeof (mod) - 1;
7807 if (len > mod_len && startswith (physname + (len - mod_len), mod))
7831 const char *physname;
7836 = physname ? physname :
"";
7841 if (physname != NULL)
7843 size_t len = strlen (physname);
7847 if (physname[len] ==
')')
7877 gdb::unique_xmalloc_ptr<char> package_name;
7885 for (i = 0; i < list->
nsyms; ++i)
7892 gdb::unique_xmalloc_ptr<char> this_package_name
7895 if (this_package_name == NULL)
7897 if (package_name == NULL)
7898 package_name = std::move (this_package_name);
7902 if (strcmp (package_name.get (), this_package_name.get ()) != 0)
7903 complaint (_(
"Symtab %s has objects from two different Go packages: %s and %s"),
7908 this_package_name.get (), package_name.get ());
7914 if (package_name != NULL)
7917 const char *saved_package_name =
objfile->
intern (package_name.get ());
7919 saved_package_name);
7941 return obconcat (
obstack, p1,
"::", p2, (
char *) NULL);
7958 int discriminant_index,
int default_index,
7959 gdb::array_view<discriminant_range> ranges)
7962 gdb_assert (discriminant_index == -1
7963 || (discriminant_index >= 0
7964 && discriminant_index < type->num_fields ()));
7965 gdb_assert (default_index == -1
7966 || (default_index >= 0 && default_index < type->num_fields ()));
7970 if (discriminant_index != -1)
7978 if (i == discriminant_index)
7982 variants[var_idx].last_field = i + 1;
7986 if (i != default_index)
7988 variants[var_idx].discriminants = ranges.slice (range_idx, 1);
7995 gdb_assert (range_idx == ranges.size ());
7996 gdb_assert (var_idx == n_variants);
8003 = (discriminant_index == -1
8008 void *storage = obstack_alloc (
obstack,
sizeof (gdb::array_view<variant_part>));
8009 gdb::array_view<variant_part> *prop_value
8010 =
new (storage) gdb::array_view<variant_part> (part, 1);
8041 gdb_assert (
type->
code () == TYPE_CODE_UNION);
8047#define RUST_ENUM_PREFIX "RUST$ENCODED$ENUM$"
8055 ULONGEST bit_offset = 0;
8057 while (
name[0] >=
'0' &&
name[0] <=
'9')
8060 unsigned long index = strtoul (
name, &tail, 10);
8067 complaint (_(
"Could not parse Rust enum encoding string \"%s\""
8076 field_type = field_type->
field (index).
type ();
8103 const char *dataless_name
8127 const char *variant_name
8138 struct type *disr_type =
nullptr;
8143 if (disr_type->
code () != TYPE_CODE_STRUCT)
8151 disr_type =
nullptr;
8153 else if (strcmp (disr_type->
field (0).
name (),
8154 "RUST$ENUM$DISR") != 0)
8168 if (disr_type ==
nullptr)
8176 struct field *disr_field = &disr_type->
field (0);
8179 * sizeof (
struct field)));
8192 struct type *enum_type = disr_field->
type ();
8193 std::unordered_map<std::string, ULONGEST> discriminant_map;
8194 for (
int i = 0; i < enum_type->
num_fields (); ++i)
8212 for (
int i = 1; i < n_fields; ++i)
8217 const char *variant_name
8220 auto iter = discriminant_map.find (variant_name);
8221 if (iter != discriminant_map.end ())
8223 ranges[i - 1].
low = iter->second;
8224 ranges[i - 1].
high = iter->second;
8246 gdb::array_view<discriminant_range> (ranges,
8270 return iter->second.get ();
8282 auto iter = this->
m_type_map.find (sig_type);
8286 return iter->second;
8292 gdb_assert (this->
m_type_map.find (sig_type) == this->m_type_map.end ());
8302 htab_t all_children, htab_t all_type_symtabs,
8307 void **slot = htab_find_slot (all_children, per_cu, INSERT);
8324 slot = htab_find_slot (all_type_symtabs, cust, INSERT);
8328 result->push_back (cust);
8329 if (cust->
user == NULL)
8330 cust->
user = immediate_parent;
8335 result->push_back (cust);
8336 if (cust->
user == NULL)
8337 cust->
user = immediate_parent;
8345 all_type_symtabs, ptr, per_objfile,
8362 std::vector<compunit_symtab *> result_symtabs;
8369 htab_up all_children (htab_create_alloc (1, htab_hash_pointer,
8372 htab_up all_type_symtabs (htab_create_alloc (1, htab_hash_pointer,
8379 all_type_symtabs.get (), ptr,
8384 len = result_symtabs.size ();
8388 memcpy (cust->
includes, result_symtabs.data (),
8402 if (! iter->is_debug_types)
8418 CORE_ADDR lowpc, highpc;
8421 struct block *static_block;
8435 case DW_TAG_compile_unit:
8436 case DW_TAG_partial_unit:
8437 case DW_TAG_type_unit:
8440 error (_(
"Dwarf Error: unexpected tag '%s' at offset %s [in module %s]"),
8506 if (gcc_4_minor >= 5)
8599 error (_(
"Dwarf Error: DW_TAG_imported_unit is not"
8600 " supported in type units [in module %s]"),
8619 && per_cu->
unit_type (
false) == DW_UT_compile
8627 false, cu->
lang ());
8674 case DW_TAG_padding:
8676 case DW_TAG_compile_unit:
8677 case DW_TAG_partial_unit:
8680 case DW_TAG_type_unit:
8683 case DW_TAG_subprogram:
8687 && die->
parent->
tag == DW_TAG_subprogram)
8690 case DW_TAG_inlined_subroutine:
8693 case DW_TAG_lexical_block:
8694 case DW_TAG_try_block:
8695 case DW_TAG_catch_block:
8698 case DW_TAG_call_site:
8699 case DW_TAG_GNU_call_site:
8702 case DW_TAG_class_type:
8703 case DW_TAG_interface_type:
8704 case DW_TAG_structure_type:
8705 case DW_TAG_union_type:
8706 case DW_TAG_namelist:
8709 case DW_TAG_enumeration_type:
8716 case DW_TAG_subroutine_type:
8717 case DW_TAG_set_type:
8718 case DW_TAG_pointer_type:
8719 case DW_TAG_ptr_to_member_type:
8720 case DW_TAG_reference_type:
8721 case DW_TAG_rvalue_reference_type:
8722 case DW_TAG_string_type:
8725 case DW_TAG_array_type:
8732 case DW_TAG_base_type:
8733 case DW_TAG_subrange_type:
8734 case DW_TAG_generic_subrange:
8735 case DW_TAG_typedef:
8740 case DW_TAG_common_block:
8743 case DW_TAG_common_inclusion:
8745 case DW_TAG_namespace:
8753 case DW_TAG_imported_declaration:
8760 case DW_TAG_imported_module:
8762 if (die->
child != NULL && (die->
tag == DW_TAG_imported_declaration
8764 complaint (_(
"Tag '%s' has unexpected children"),
8769 case DW_TAG_imported_unit:
8773 case DW_TAG_variable:
8796 case DW_TAG_namespace:
8797 case DW_TAG_typedef:
8798 case DW_TAG_class_type:
8799 case DW_TAG_interface_type:
8800 case DW_TAG_structure_type:
8801 case DW_TAG_union_type:
8802 case DW_TAG_enumeration_type:
8803 case DW_TAG_enumerator:
8804 case DW_TAG_subprogram:
8805 case DW_TAG_inlined_subroutine:
8807 case DW_TAG_imported_declaration:
8810 case DW_TAG_variable:
8811 case DW_TAG_constant:
8826 if (attr == NULL && die->
parent->
tag != DW_TAG_namespace
8832 if (die->
parent->
tag == DW_TAG_lexical_block
8834 || die->
parent->
tag == DW_TAG_catch_block
8835 || die->
parent->
tag == DW_TAG_subprogram)
8855 attr =
dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
8867 const char *linkage_name;
8870 if (linkage_name == NULL)
8876 && strchr (linkage_name,
'{') != NULL)
8877 linkage_name = NULL;
8879 return linkage_name;
8926 if (linkage_name != NULL)
8927 return linkage_name;
8945 gdb::unique_xmalloc_ptr<char> prefixed_name
8948 buf.
puts (prefixed_name.get ());
8986 const gdb_byte *bytes;
8990 if (child->
tag != DW_TAG_template_type_param
8991 && child->
tag != DW_TAG_template_value_param)
9005 complaint (_(
"template parameter missing DW_AT_type"));
9006 buf.
puts (
"UNKNOWN_TYPE");
9011 if (child->
tag == DW_TAG_template_type_param)
9018 attr =
dwarf2_attr (child, DW_AT_const_value, cu);
9021 complaint (_(
"template parameter missing "
9022 "DW_AT_const_value"));
9023 buf.
puts (
"UNKNOWN_VALUE");
9029 &
value, &bytes, &baton);
9045 else if (bytes != NULL)
9069 if (!buf.
empty () && buf.
string ().back () ==
'>')
9079 if (physname && die->
tag == DW_TAG_subprogram
9098 buf.
puts (
" const");
9102 const std::string &intermediate_name = buf.
string ();
9104 const char *canonical_name
9111 if (canonical_name == NULL || canonical_name == intermediate_name.c_str ())
9114 name = canonical_name;
9146 const char *retval, *mangled = NULL, *canon = NULL;
9159 gdb::unique_xmalloc_ptr<char> demangled;
9160 if (mangled != NULL)
9176 demangled =
gdb_demangle (mangled, (DMGL_PARAMS | DMGL_ANSI
9180 canon = demangled.get ();
9192 if (canon != NULL && strcmp (physname, canon) != 0)
9198 complaint (_(
"Computed physname <%s> does not match demangled <%s> "
9199 "(from linkage <%s>) - DIE at %s [in module %s]"),
9245#define MAX_NESTED_IMPORTED_DECLARATIONS 100
9253 if (d->
tag != DW_TAG_imported_declaration)
9259 complaint (_(
"DIE at %s has too many recursively imported "
9267 if (d->
tag == DW_TAG_variable)
9274 attr =
dwarf2_attr (d, DW_AT_location, imported_cu);
9276 if (attr !=
nullptr)
9285 if (
type !=
nullptr &&
type->
code () == TYPE_CODE_NAMESPACE)
9325 struct die_info *imported_die, *child_die;
9327 const char *imported_name;
9328 const char *imported_name_prefix;
9329 const char *canonical_name;
9330 const char *import_alias;
9331 const char *imported_declaration = NULL;
9332 const char *import_prefix;
9333 std::vector<const char *> excludes;
9335 import_attr =
dwarf2_attr (die, DW_AT_import, cu);
9336 if (import_attr == NULL)
9338 complaint (_(
"Tag '%s' has no DW_AT_import"),
9345 imported_name =
dwarf2_name (imported_die, imported_cu);
9346 if (imported_name == NULL)
9393 if (imported_die->
tag != DW_TAG_namespace
9394 && imported_die->
tag != DW_TAG_module)
9396 imported_declaration = imported_name;
9397 canonical_name = imported_name_prefix;
9399 else if (strlen (imported_name_prefix) > 0)
9401 imported_name_prefix,
9405 imported_name, (
char *) NULL);
9407 canonical_name = imported_name;
9409 if (die->
tag == DW_TAG_imported_module
9411 for (child_die = die->
child; child_die && child_die->
tag;
9412 child_die = child_die->
sibling)
9419 if (child_die->
tag != DW_TAG_imported_declaration)
9421 complaint (_(
"child DW_TAG_imported_declaration expected "
9422 "- DIE at %s [in module %s]"),
9428 import_attr =
dwarf2_attr (child_die, DW_AT_import, cu);
9429 if (import_attr == NULL)
9431 complaint (_(
"Tag '%s' has no DW_AT_import"),
9439 imported_name =
dwarf2_name (imported_die, imported_cu);
9440 if (imported_name == NULL)
9442 complaint (_(
"child DW_TAG_imported_declaration has unknown "
9443 "imported name - DIE at %s [in module %s]"),
9449 excludes.push_back (imported_name);
9458 imported_declaration,
9527 && IS_ABSOLUTE_PATH (res.
get_name ()))
9549 hashval_t line_header_local_hash;
9568 && die->
tag == DW_TAG_partial_unit)
9573 htab_delete_entry<line_header>,
9583 line_header_local_hash, NO_INSERT);
9588 if (die->
tag == DW_TAG_partial_unit && slot != NULL)
9590 gdb_assert (*slot != NULL);
9612 line_header_local_hash, INSERT);
9613 gdb_assert (slot != NULL);
9615 if (slot != NULL && *slot == NULL)
9629 gdb_assert (die->
tag != DW_TAG_partial_unit);
9631 decode_mapping = (die->
tag != DW_TAG_partial_unit);
9648 CORE_ADDR lowpc = ((CORE_ADDR) -1);
9649 CORE_ADDR highpc = ((CORE_ADDR) 0);
9661 if (lowpc == ((CORE_ADDR) -1))
9670 gdb_assert (per_objfile->
sym_cu ==
nullptr);
9671 scoped_restore restore_sym_cu
9672 = make_scoped_restore (&per_objfile->
sym_cu, cu);
9680 if (die->
child != NULL)
9682 child_die = die->
child;
9683 while (child_die && child_die->
tag)
9686 child_die = child_die->
sibling;
9689 per_objfile->
sym_cu =
nullptr;
9701 complaint (_(
"CU refers to both DW_AT_macros and DW_AT_macro_info"));
9759 gdb_assert (tug_unshare->
symtabs == NULL);
9789 for (i = 0; i < file_names.size (); ++i)
9796 if (sf->
symtab ==
nullptr)
9803 const char *
name = sf->
name.c_str ();
9804 const char *name_for_id = sf->
name_for_id.c_str ();
9824 for (i = 0; i < file_names.size (); ++i)
9855 if (die->
child != NULL)
9857 child_die = die->
child;
9858 while (child_die && child_die->
tag)
9861 child_die = child_die->
sibling;
9905 return htab_up (htab_create_alloc (41,
9908 htab_delete_entry<dwo_file>,
9963 return htab_up (htab_create_alloc (3,
9973 const gdb_byte *info_ptr,
9982 gdb::optional<ULONGEST> signature =
lookup_dwo_id (cu, comp_unit_die);
9983 if (!signature.has_value ())
9985 complaint (_(
"Dwarf Error: debug entry at offset %s is missing"
9986 " its dwo_id [in module %s]"),
10012 const gdb_byte *info_ptr, *end_ptr;
10015 info_ptr = section.
buffer;
10017 if (info_ptr == NULL)
10024 end_ptr = info_ptr + section.
size;
10025 while (info_ptr < end_ptr)
10042 info_ptr += per_cu.
length ();
10048 if (cus_htab == NULL)
10054 slot = htab_find_slot (cus_htab.get (),
dwo_unit, INSERT);
10055 gdb_assert (slot != NULL);
10059 sect_offset dup_sect_off = dup_cu->
sect_off;
10061 complaint (_(
"debug cu entry at offset %s is duplicate to"
10062 " the entry at offset %s, signature %s"),
10229 const gdb_byte *index_ptr, *index_end;
10231 uint32_t
version, nr_columns, nr_units, nr_slots;
10234 if (is_debug_types)
10239 if (index->
empty ())
10243 index_ptr = index->
buffer;
10244 index_end = index_ptr + index->
size;
10263 error (_(
"Dwarf Error: unsupported DWP file version (%s)"
10264 " [in module %s]"),
10269 error (_(
"Dwarf Error: number of slots in DWP hash table (%s)"
10270 " is not power of 2 [in module %s]"),
10292 complaint (_(
"Empty DWP but nr_slots,nr_units,nr_columns not"
10293 " all zero [in modules %s]"),
10312 int ids_seen[DW_SECT_MAX + 1];
10317 error (_(
"Dwarf Error: bad DWP hash table, too few columns"
10318 " in section table [in module %s]"),
10323 error (_(
"Dwarf Error: bad DWP hash table, too many columns"
10324 " in section table [in module %s]"),
10327 memset (ids, 255, sizeof_ids);
10328 memset (ids_seen, 255,
sizeof (ids_seen));
10331 int id =
read_4_bytes (dbfd, ids_ptr + i *
sizeof (uint32_t));
10333 if (id < DW_SECT_MIN || id > DW_SECT_MAX)
10335 error (_(
"Dwarf Error: bad DWP hash table, bad section id %d"
10336 " in section table [in module %s]"),
10339 if (ids_seen[
id] != -1)
10341 error (_(
"Dwarf Error: bad DWP hash table, duplicate section"
10342 " id %d in section table [in module %s]"),
10349 if (((ids_seen[DW_SECT_INFO] != -1)
10350 + (ids_seen[DW_SECT_TYPES] != -1))
10353 error (_(
"Dwarf Error: bad DWP hash table, missing/duplicate"
10354 " DWO info/types section [in module %s]"),
10358 if (ids_seen[DW_SECT_ABBREV] == -1)
10360 error (_(
"Dwarf Error: bad DWP hash table, missing DWO abbrev"
10361 " section [in module %s]"),
10372 error (_(
"Dwarf Error: DWP index section is corrupt (too small)"
10373 " [in module %s]"),
10383 int ids_seen[DW_SECT_MAX_V5 + 1];
10387 error (_(
"Dwarf Error: bad DWP hash table, too few columns"
10388 " in section table [in module %s]"),
10393 error (_(
"Dwarf Error: bad DWP hash table, too many columns"
10394 " in section table [in module %s]"),
10397 memset (ids, 255, sizeof_ids);
10398 memset (ids_seen, 255,
sizeof (ids_seen));
10401 int id =
read_4_bytes (dbfd, ids_ptr + i *
sizeof (uint32_t));
10403 if (id < DW_SECT_MIN || id > DW_SECT_MAX_V5)
10405 error (_(
"Dwarf Error: bad DWP hash table, bad section id %d"
10406 " in section table [in module %s]"),
10409 if (ids_seen[
id] != -1)
10411 error (_(
"Dwarf Error: bad DWP hash table, duplicate section"
10412 " id %d in section table [in module %s]"),
10419 if (ids_seen[DW_SECT_INFO_V5] == -1)
10421 error (_(
"Dwarf Error: bad DWP hash table, missing/duplicate"
10422 " DWO info/types section [in module %s]"),
10426 if (ids_seen[DW_SECT_ABBREV_V5] == -1)
10428 error (_(
"Dwarf Error: bad DWP hash table, missing DWO abbrev"
10429 " section [in module %s]"),
10440 error (_(
"Dwarf Error: DWP index section is corrupt (too small)"
10441 " [in module %s]"),
10469 sections->
abbrev.
size = bfd_section_size (sectp);
10486 sections->
line.
size = bfd_section_size (sectp);
10494 sections->
loc.
size = bfd_section_size (sectp);
10502 sections->
macinfo.
size = bfd_section_size (sectp);
10510 sections->
macro.
size = bfd_section_size (sectp);
10537 uint32_t unit_index,
10538 const char *comp_dir,
10539 ULONGEST
signature,
int is_debug_types)
10544 const char *kind = is_debug_types ?
"TU" :
"CU";
10548 void **dwo_file_slot;
10554 kind, pulongest (unit_index), hex_string (signature),
10561#define MAX_NR_V1_DWO_SECTIONS \
10570 memset (§ions, 0,
sizeof (sections));
10575 uint32_t section_nr =
10578 + (unit_index + i) * sizeof (uint32_t));
10580 if (section_nr == 0)
10584 error (_(
"Dwarf Error: bad DWP hash table, section number too large"
10585 " [in module %s]"),
10592 error (_(
"Dwarf Error: bad DWP hash table, invalid section found"
10593 " [in module %s]"),
10602 error (_(
"Dwarf Error: bad DWP hash table, missing DWO sections"
10603 " [in module %s]"),
10608 error (_(
"Dwarf Error: bad DWP hash table, too many DWO sections"
10609 " [in module %s]"),
10622 std::string virtual_dwo_name =
10623 string_printf (
"virtual-dwo/%d-%d-%d-%d",
10632 if (*dwo_file_slot == NULL)
10635 virtual_dwo_name.c_str ());
10660 virtual_dwo_name.c_str ());
10684 bfd_size_type offset, bfd_size_type
size)
10689 gdb_assert (
section != NULL);
10690 gdb_assert (!
section->is_virtual);
10692 memset (&result, 0,
sizeof (result));
10699 sectp =
section->get_bfd_section ();
10705 || offset +
size > bfd_section_size (sectp))
10707 error (_(
"Dwarf Error: Bad DWP V2 or V5 section info, doesn't fit"
10708 " in section %s [in module %s]"),
10709 sectp ? bfd_section_name (sectp) :
"<unknown>",
10726 uint32_t unit_index,
10727 const char *comp_dir,
10728 ULONGEST
signature,
int is_debug_types)
10733 const char *kind = is_debug_types ?
"TU" :
"CU";
10737 void **dwo_file_slot;
10743 kind, pulongest (unit_index), hex_string (signature),
10748 memset (§ions, 0,
sizeof (sections));
10756 * sizeof (uint32_t)));
10761 * sizeof (uint32_t)));
10766 case DW_SECT_TYPES:
10770 case DW_SECT_ABBREV:
10782 case DW_SECT_STR_OFFSETS:
10786 case DW_SECT_MACINFO:
10790 case DW_SECT_MACRO:
10806 std::string virtual_dwo_name =
10807 string_printf (
"virtual-dwo/%ld-%ld-%ld-%ld",
10817 if (*dwo_file_slot == NULL)
10820 virtual_dwo_name.c_str ());
10863 virtual_dwo_name.c_str ());
10893 uint32_t unit_index,
10894 const char *comp_dir,
10895 ULONGEST
signature,
int is_debug_types)
10900 const char *kind = is_debug_types ?
"TU" :
"CU";
10904 void **dwo_file_slot;
10909 kind, pulongest (unit_index), hex_string (signature),
10916 for (
int i = 0; i < dwp_htab->
nr_columns; ++i)
10920 + (((unit_index - 1)
10923 * sizeof (uint32_t)));
10928 * sizeof (uint32_t)));
10932 case DW_SECT_ABBREV_V5:
10936 case DW_SECT_INFO_V5:
10940 case DW_SECT_LINE_V5:
10944 case DW_SECT_LOCLISTS_V5:
10948 case DW_SECT_MACRO_V5:
10952 case DW_SECT_RNGLISTS_V5:
10956 case DW_SECT_STR_OFFSETS_V5:
10960 case DW_SECT_RESERVED_V5:
10975 std::string virtual_dwo_name =
10976 string_printf (
"virtual-dwo/%ld-%ld-%ld-%ld-%ld-%ld",
10986 virtual_dwo_name.c_str (),
10989 if (*dwo_file_slot == NULL)
10992 virtual_dwo_name.c_str ());
11040 virtual_dwo_name.c_str ());
11065 ULONGEST
signature,
int is_debug_types)
11070 uint32_t mask = dwp_htab->
nr_slots - 1;
11071 uint32_t hash = signature & mask;
11072 uint32_t hash2 = ((signature >> 32) & mask) | 1;
11077 memset (&find_dwo_cu, 0,
sizeof (find_dwo_cu));
11079 slot = htab_find_slot (is_debug_types
11082 &find_dwo_cu, INSERT);
11088 for (i = 0; i < dwp_htab->
nr_slots; ++i)
11090 ULONGEST signature_in_table;
11092 signature_in_table =
11096 uint32_t unit_index =
11098 dwp_htab->
unit_table + hash * sizeof (uint32_t));
11103 unit_index, comp_dir,
11109 unit_index, comp_dir,
11115 unit_index, comp_dir,
11120 if (signature_in_table == 0)
11122 hash = (hash + hash2) & mask;
11125 error (_(
"Dwarf Error: bad DWP hash table, lookup didn't terminate"
11126 " [in module %s]"),
11144 const char *file_name,
int is_dwp,
int search_cwd)
11150 const char *search_path;
11151 static const char dirname_separator_string[] = { DIRNAME_SEPARATOR,
'\0' };
11153 gdb::unique_xmalloc_ptr<char> search_path_holder;
11158 search_path_holder.reset (concat (
".", dirname_separator_string,
11161 search_path = search_path_holder.get ();
11171 search_path_holder.reset (concat (objfile_dir.c_str (),
11172 dirname_separator_string,
11173 search_path,
nullptr));
11174 search_path = search_path_holder.get ();
11180 gdb::unique_xmalloc_ptr<char> absolute_name;
11181 desc =
openp (search_path,
flags, file_name,
11182 O_RDONLY |
O_BINARY, &absolute_name);
11188 if (sym_bfd == NULL)
11190 bfd_set_cacheable (sym_bfd.get (), 1);
11192 if (!bfd_check_format (sym_bfd.get (), bfd_object))
11213 const char *file_name,
const char *comp_dir)
11215 if (IS_ABSOLUTE_PATH (file_name))
11221 if (comp_dir != NULL)
11223 std::string path_to_try = path_join (comp_dir, file_name);
11228 (per_objfile, path_to_try.c_str (), 0 , 1 ));
11279 memset (&type_section, 0,
sizeof (type_section));
11284 if (dw_sect !=
nullptr)
11287 dw_sect->
size = bfd_section_size (sectp);
11348 unsigned int elf_section_nr = elf_section_data (sectp)->this_idx;
11352 gdb_assert (elf_section_nr < dwp_file->num_sections);
11364 if (dw_sect !=
nullptr)
11367 dw_sect->
size = bfd_section_size (sectp);
11379 asection *sectp,
void *dwp_file_ptr)
11383 unsigned int elf_section_nr = elf_section_data (sectp)->this_idx;
11387 gdb_assert (elf_section_nr < dwp_file->num_sections);
11409 if (dw_sect !=
nullptr)
11412 dw_sect->
size = bfd_section_size (sectp);
11424 asection *sectp,
void *dwp_file_ptr)
11428 unsigned int elf_section_nr = elf_section_data (sectp)->this_idx;
11432 gdb_assert (elf_section_nr < dwp_file->num_sections);
11452 if (dw_sect !=
nullptr)
11455 dw_sect->
size = bfd_section_size (sectp);
11487 return htab_up (htab_create_alloc (3,
11533static std::unique_ptr<struct dwp_file>
11543 std::string dwp_name;
11547 const char *backlink_basename = lbasename (backlink->
original_name);
11554 dwp_name +=
".dwp";
11562 dwp_name +=
".dwp";
11570 return std::unique_ptr<dwp_file> ();
11573 const char *
name = bfd_get_filename (dbfd.get ());
11574 std::unique_ptr<struct dwp_file>
dwp_file
11597 error (_(
"Dwarf Error: DWP file CU version %s doesn't match"
11598 " TU version %s [in DWP file %s]"),
11662 ULONGEST
signature,
int is_debug_types)
11666 const char *kind = is_debug_types ?
"TU" :
"CU";
11667 void **dwo_file_slot;
11682 if (dwp_htab != NULL)
11688 if (dwo_cutu != NULL)
11692 host_address_to_string (dwo_cutu));
11703 if (*dwo_file_slot == NULL)
11719 memset (&find_dwo_cutu, 0,
sizeof (find_dwo_cutu));
11729 memset (&find_dwo_cutu, 0,
sizeof (find_dwo_cutu));
11735 if (dwo_cutu != NULL)
11738 kind, dwo_name, hex_string (
signature),
11739 host_address_to_string (dwo_cutu));
11751 kind, dwo_name, hex_string (
signature));
11758 std::string dwp_text;
11761 dwp_text = string_printf (
" [in DWP file %s]",
11764 warning (_(
"Could not find DWO %s %s(%s)%s referenced by %s at offset %s"
11765 " [in module %s]"),
11766 kind, dwo_name, hex_string (
signature), dwp_text.c_str (), kind,
11807 if (sig_type != NULL)
11832 gdb_assert (cu !=
nullptr);
11855 if (attr ==
nullptr)
11870 if (die->
tag != origin_die->
tag
11871 && !(die->
tag == DW_TAG_inlined_subroutine
11872 && origin_die->
tag == DW_TAG_subprogram))
11873 complaint (_(
"DIE %s and its abstract origin %s have different tags"),
11883 bool are_isomorphic =
true;
11886 while (concrete_child !=
nullptr || abstract_child !=
nullptr)
11888 if (concrete_child ==
nullptr
11889 || abstract_child ==
nullptr
11890 || concrete_child->
tag != abstract_child->
tag)
11892 are_isomorphic =
false;
11896 concrete_child = concrete_child->
sibling;
11897 abstract_child = abstract_child->
sibling;
11905 die_info *corresponding_abstract_child
11906 = are_isomorphic ? origin_die->
child :
nullptr;
11908 std::vector<sect_offset> offsets;
11911 child_die && child_die->tag;
11912 child_die = child_die->sibling)
11919 if (child_die->tag == DW_TAG_call_site
11920 || child_die->tag == DW_TAG_GNU_call_site)
11922 if (are_isomorphic)
11923 corresponding_abstract_child
11924 = corresponding_abstract_child->
sibling;
11933 die_info *child_origin_die = child_die;
11937 attr =
dwarf2_attr (child_origin_die, DW_AT_abstract_origin,
11939 if (attr ==
nullptr)
11948 if (child_origin_die == child_die
11949 &&
dwarf2_attr (child_die, DW_AT_abstract_origin, cu) ==
nullptr
11951 && child_die->tag == DW_TAG_lexical_block)
11952 child_origin_die = corresponding_abstract_child;
11956 if (child_origin_die != child_die)
11958 if (child_die->tag != child_origin_die->
tag
11959 && !(child_die->tag == DW_TAG_inlined_subroutine
11960 && child_origin_die->
tag == DW_TAG_subprogram))
11961 complaint (_(
"Child DIE %s and its abstract origin %s have "
11965 if (child_origin_die->
parent != origin_die)
11966 complaint (_(
"Child DIE %s and its abstract origin %s have "
11967 "different parents"),
11971 offsets.push_back (child_origin_die->
sect_off);
11974 if (are_isomorphic)
11975 corresponding_abstract_child = corresponding_abstract_child->
sibling;
11978 if (!offsets.empty ())
11980 std::sort (offsets.begin (), offsets.end ());
11982 for (
auto offsets_it = offsets.begin () + 1;
11983 offsets_it < offsets.end ();
11985 if (*(offsets_it - 1) == *offsets_it)
11986 complaint (_(
"Multiple children of DIE %s refer "
11987 "to DIE %s as their abstract origin"),
11992 auto offsets_it = offsets.begin ();
11994 while (origin_child_die !=
nullptr && origin_child_die->
tag != 0)
11997 while (offsets_it < offsets.end ()
11998 && *offsets_it < origin_child_die->
sect_off)
12001 if (offsets_it == offsets.end ()
12002 || *offsets_it > origin_child_die->
sect_off)
12012 origin_child_die = origin_child_die->
sibling;
12017 if (cu != origin_cu)
12030 struct attribute *attr, *call_line, *call_file;
12032 CORE_ADDR baseaddr;
12034 int inlined_func = (die->
tag == DW_TAG_inlined_subroutine);
12035 std::vector<struct symbol *> template_args;
12043 call_line =
dwarf2_attr (die, DW_AT_call_line, cu);
12044 call_file =
dwarf2_attr (die, DW_AT_call_file, cu);
12045 if (call_line == NULL || call_file == NULL)
12055 if (
name ==
nullptr)
12062 complaint (_(
"missing name for subprogram DIE at %s"),
12074 bool external_p = attr !=
nullptr && attr->
as_boolean ();
12082 bool decl_p = attr !=
nullptr && attr->
as_boolean ();
12083 if (!external_p && !inlined_p && !decl_p)
12084 complaint (_(
"cannot get low and high bounds "
12085 "for subprogram DIE at %s"),
12096 for (child_die = die->
child; child_die; child_die = child_die->
sibling)
12098 if (child_die->
tag == DW_TAG_template_type_param
12099 || child_die->
tag == DW_TAG_template_value_param)
12110 (
struct symbol *) templ_func);
12119 if (attr !=
nullptr)
12125 if (attr !=
nullptr)
12135 if (die->
child != NULL)
12137 child_die = die->
child;
12138 while (child_die && child_die->
tag)
12140 if (child_die->
tag == DW_TAG_template_type_param
12141 || child_die->
tag == DW_TAG_template_value_param)
12146 template_args.push_back (arg);
12150 child_die = child_die->
sibling;
12167 child_die = spec_die->
child;
12168 while (child_die && child_die->
tag)
12170 if (child_die->
tag == DW_TAG_imported_module)
12172 child_die = child_die->
sibling;
12201 if (!template_args.empty ())
12203 gdb_assert (templ_func != NULL);
12210 template_args.data (),
12217 for (
symbol *sym : template_args)
12218 sym->set_symtab (templ_func->
symtab ());
12242 CORE_ADDR lowpc, highpc;
12244 CORE_ADDR baseaddr;
12259 for (child_die = die->
child;
12260 child_die != NULL && child_die->
tag;
12261 child_die = child_die->
sibling)
12280 if (die->
child != NULL)
12282 child_die = die->
child;
12283 while (child_die && child_die->
tag)
12286 child_die = child_die->
sibling;
12318 std::vector<CORE_ADDR> &result);
12328 CORE_ADDR pc, baseaddr;
12345 complaint (_(
"missing DW_AT_call_return_pc for DW_TAG_call_site "
12346 "DIE %s [in module %s]"),
12358 hashtab_obstack_allocate, NULL);
12359 struct call_site call_site_local (
pc, nullptr, nullptr);
12360 slot = htab_find_slot (cu->
call_site_htab, &call_site_local, INSERT);
12363 complaint (_(
"Duplicate PC %s for DW_TAG_call_site "
12364 "DIE %s [in module %s]"),
12373 for (child_die = die->
child; child_die && child_die->
tag;
12374 child_die = child_die->
sibling)
12376 if (child_die->
tag != DW_TAG_call_site_parameter
12377 && child_die->
tag != DW_TAG_GNU_call_site_parameter)
12379 complaint (_(
"Tag %d is not DW_TAG_call_site_parameter in "
12380 "DW_TAG_call_site child DIE %s [in module %s]"),
12406 for (func_die = die->
parent;
12407 func_die && func_die->
tag != DW_TAG_subprogram
12408 && func_die->
tag != DW_TAG_subroutine_type;
12409 func_die = func_die->
parent);
12436 gdb_assert (
func_type->code () == TYPE_CODE_FUNC);
12443 complaint (_(
"Cannot find function owning DW_TAG_call_site "
12444 "DIE %s [in module %s]"),
12451 attr =
dwarf2_attr (die, DW_AT_GNU_call_site_target, cu);
12457 attr =
dwarf2_attr (die, DW_AT_abstract_origin, cu);
12485 =
dwarf2_attr (target_die, DW_AT_ranges, target_cu);
12489 const char *target_physname;
12493 if (target_physname == NULL)
12495 if (target_physname == NULL)
12496 complaint (_(
"DW_AT_call_target target DIE has invalid "
12497 "physname, for referencing DIE %s [in module %s]"),
12504 ULONGEST ranges_offset = (ranges_attr->
as_unsigned ()
12506 std::vector<CORE_ADDR> addresses;
12508 target_die->
tag, addresses);
12510 addresses.size ());
12511 std::copy (addresses.begin (), addresses.end (), saved);
12522 complaint (_(
"DW_AT_call_target target DIE has invalid "
12523 "low pc, for referencing DIE %s [in module %s]"),
12534 complaint (_(
"DW_TAG_call_site DW_AT_call_target is neither "
12535 "block nor reference, for DIE %s [in module %s]"),
12538 for (child_die = die->
child;
12539 child_die && child_die->
tag;
12540 child_die = child_die->
sibling)
12545 if (child_die->
tag != DW_TAG_call_site_parameter
12546 && child_die->
tag != DW_TAG_GNU_call_site_parameter)
12560 origin =
dwarf2_attr (child_die, DW_AT_call_parameter, cu);
12561 if (origin == NULL)
12565 origin =
dwarf2_attr (child_die, DW_AT_abstract_origin, cu);
12572 if (!cu->
header.offset_in_cu_p (sect_off))
12577 complaint (_(
"DW_AT_call_parameter offset is not in CU for "
12578 "DW_TAG_call_site child DIE %s [in module %s]"),
12584 = (cu_offset) (sect_off - cu->
header.sect_off);
12586 else if (
loc == NULL || origin != NULL || !
loc->form_is_block ())
12588 complaint (_(
"No DW_FORM_block* DW_AT_location for "
12589 "DW_TAG_call_site child DIE %s [in module %s]"),
12607 complaint (_(
"Only single DW_OP_reg or DW_OP_fbreg is supported "
12608 "for DW_FORM_block* DW_AT_location is supported for "
12609 "DW_TAG_call_site child DIE %s "
12617 attr =
dwarf2_attr (child_die, DW_AT_call_value, cu);
12619 attr =
dwarf2_attr (child_die, DW_AT_GNU_call_site_value, cu);
12622 complaint (_(
"No DW_FORM_block* DW_AT_call_value for "
12623 "DW_TAG_call_site child DIE %s [in module %s]"),
12638 attr =
dwarf2_attr (child_die, DW_AT_call_data_value, cu);
12640 attr =
dwarf2_attr (child_die, DW_AT_GNU_call_site_data_value, cu);
12641 if (attr !=
nullptr)
12644 complaint (_(
"No DW_FORM_block* DW_AT_call_data_value for "
12645 "DW_TAG_call_site child DIE %s [in module %s]"),
12662static struct type *
12675 if (type_die == NULL)
12678 if (
dwarf2_attr (type_die, DW_AT_containing_type, type_cu) == NULL)
12694 if (containing_type != NULL)
12708 if (res == NULL &&
loc && abstract_origin)
12730template <
typename Callback>
12733 dwarf_tag
tag, Callback &&callback)
12739 gdb::optional<CORE_ADDR> base;
12740 const gdb_byte *buffer;
12741 bool overflow =
false;
12742 ULONGEST addr_index;
12749 if (offset >= rnglists_section->
size)
12751 complaint (_(
"Offset %d out of bounds for DW_AT_ranges attribute"),
12760 CORE_ADDR range_beginning = 0, range_end = 0;
12761 const gdb_byte *buf_end = (rnglists_section->
buffer
12762 + rnglists_section->
size);
12763 unsigned int bytes_read;
12770 const auto rlet =
static_cast<enum dwarf_range_list_entry
>(*
buffer++);
12773 case DW_RLE_end_of_list:
12775 case DW_RLE_base_address:
12784 case DW_RLE_base_addressx:
12789 case DW_RLE_start_length:
12798 range_end = (range_beginning
12807 case DW_RLE_startx_length:
12816 range_end = (range_beginning
12820 case DW_RLE_offset_pair:
12836 case DW_RLE_start_end:
12848 case DW_RLE_startx_endx:
12862 complaint (_(
"Invalid .debug_rnglists data (no base address)"));
12865 if (rlet == DW_RLE_end_of_list || overflow)
12867 if (rlet == DW_RLE_base_address)
12870 if (range_beginning > range_end)
12873 complaint (_(
"Invalid .debug_rnglists data (inverted range)"));
12878 if (range_beginning == range_end)
12882 if (rlet == DW_RLE_offset_pair)
12884 if (!base.has_value ())
12887 complaint (_(
"Invalid .debug_rnglists data (no base address for "
12888 "DW_RLE_offset_pair)"));
12892 range_beginning += *base;
12893 range_end += *base;
12898 if (range_beginning == 0
12901 complaint (_(
".debug_rnglists entry has start address of zero"
12906 callback (range_beginning, range_end);
12911 complaint (_(
"Offset %d is not terminated "
12912 "for DW_AT_ranges attribute"),
12925template <
typename Callback>
12928 Callback &&callback)
12935 CORE_ADDR mask = ~(~(CORE_ADDR)1 << (
addr_size * 8 - 1));
12937 gdb::optional<CORE_ADDR> base;
12938 unsigned int dummy;
12939 const gdb_byte *buffer;
12949 complaint (_(
"Offset %d out of bounds for DW_AT_ranges attribute"),
12957 CORE_ADDR range_beginning, range_end;
12966 if (range_beginning == 0 && range_end == 0)
12973 if ((range_beginning & mask) == mask)
12981 if (!base.has_value ())
12985 complaint (_(
"Invalid .debug_ranges data (no base address)"));
12989 if (range_beginning > range_end)
12992 complaint (_(
"Invalid .debug_ranges data (inverted range)"));
12997 if (range_beginning == range_end)
13000 range_beginning += *base;
13001 range_end += *base;
13005 if (range_beginning == 0
13008 complaint (_(
".debug_ranges entry has start address of zero"
13013 callback (range_beginning, range_end);
13026 CORE_ADDR *high_return,
struct dwarf2_cu *cu,
13027 addrmap *map,
void *datum, dwarf_tag tag)
13034 CORE_ADDR high = 0;
13038 [&] (CORE_ADDR range_beginning, CORE_ADDR range_end)
13040 if (map !=
nullptr)
13046 range_beginning + baseaddr)
13049 range_end + baseaddr)
13051 map->
set_empty (lowpc, highpc - 1, datum);
13060 low = range_beginning;
13066 if (range_beginning < low)
13067 low = range_beginning;
13068 if (range_end > high)
13083 *high_return = high;
13092 std::vector<CORE_ADDR> &result)
13095 [&] (CORE_ADDR start, CORE_ADDR end)
13097 result.push_back (start);
13107 CORE_ADDR *highpc,
struct dwarf2_cu *cu,
13114 CORE_ADDR high = 0;
13117 attr_high =
dwarf2_attr (die, DW_AT_high_pc, cu);
13121 if (attr !=
nullptr)
13146 if (die->
tag != DW_TAG_compile_unit)
13152 map, datum, die->
tag))
13189 CORE_ADDR *lowpc, CORE_ADDR *highpc,
13192 CORE_ADDR low, high;
13198 *lowpc = std::min (*lowpc, low);
13199 *highpc = std::max (*highpc, high);
13213 if (
child->
tag == DW_TAG_subprogram
13214 ||
child->
tag == DW_TAG_lexical_block)
13226 CORE_ADDR *lowpc, CORE_ADDR *highpc,
13229 CORE_ADDR best_low = (CORE_ADDR) -1;
13230 CORE_ADDR best_high = (CORE_ADDR) 0;
13231 CORE_ADDR current_low, current_high;
13237 best_low = current_low;
13238 best_high = current_high;
13247 case DW_TAG_subprogram:
13250 case DW_TAG_namespace:
13251 case DW_TAG_module:
13262 if (current_low != ((CORE_ADDR) -1))
13264 best_low = std::min (best_low, current_low);
13265 best_high = std::max (best_high, current_high);
13278 *highpc = best_high;
13286 CORE_ADDR baseaddr,
struct dwarf2_cu *cu)
13293 attr_high =
dwarf2_attr (die, DW_AT_high_pc, cu);
13297 if (attr !=
nullptr)
13320 if (die->
tag != DW_TAG_compile_unit)
13323 std::vector<blockrange> blockvec;
13325 [&] (CORE_ADDR start, CORE_ADDR end)
13329 start = gdbarch_adjust_dwarf2_addr (gdbarch, start);
13330 end = gdbarch_adjust_dwarf2_addr (gdbarch, end);
13331 cu->get_builder ()->record_block_range (block, start, end - 1);
13332 blockvec.emplace_back (start, end);
13369 else if (startswith (cu->
producer,
"CodeWarrior S12/L-ISA"))
13412static enum dwarf_access_attribute
13416 if (attr !=
nullptr)
13419 if (
value == DW_ACCESS_public
13420 ||
value == DW_ACCESS_protected
13421 ||
value == DW_ACCESS_private)
13422 return (dwarf_access_attribute)
value;
13423 complaint (_(
"Unhandled DW_AT_accessibility value (%s)"),
13432 if (die->
tag != DW_TAG_inheritance)
13433 return DW_ACCESS_public;
13435 return DW_ACCESS_private;
13443 if (die->
parent->
tag == DW_TAG_class_type)
13444 return DW_ACCESS_private;
13446 return DW_ACCESS_public;
13461 attr =
dwarf2_attr (die, DW_AT_data_member_location, cu);
13483 attr =
dwarf2_attr (die, DW_AT_data_bit_offset, cu);
13484 if (attr !=
nullptr)
13503 attr =
dwarf2_attr (die, DW_AT_data_member_location, cu);
13518 complaint (_(
"DW_AT_data_member_location value of -1, assuming 0"));
13556 attr =
dwarf2_attr (die, DW_AT_data_bit_offset, cu);
13557 if (attr !=
nullptr)
13573 const char *fieldname =
"";
13575 if (die->
tag == DW_TAG_inheritance)
13582 fip->
fields.emplace_back ();
13583 new_field = &fip->
fields.back ();
13593 if (attr !=
nullptr)
13598 fp = &new_field->
field;
13600 if ((die->
tag == DW_TAG_member || die->
tag == DW_TAG_namelist_item)
13603 if (die->
tag == DW_TAG_namelist_item)
13608 struct die_info *item_die =
nullptr;
13612 if (item_die !=
nullptr)
13624 if (attr !=
nullptr)
13655 int anonymous_size;
13682 if (fieldname == NULL)
13698 else if (die->
tag == DW_TAG_member || die->
tag == DW_TAG_variable)
13707 const char *physname;
13711 if (fieldname == NULL)
13736 else if (die->
tag == DW_TAG_inheritance)
13745 gdb_assert_not_reached (
"missing case in dwarf2_add_field");
13755 case DW_TAG_typedef:
13756 case DW_TAG_class_type:
13757 case DW_TAG_structure_type:
13758 case DW_TAG_union_type:
13759 case DW_TAG_enumeration_type:
13774 memset (&fp, 0,
sizeof (fp));
13786 case DW_ACCESS_public:
13789 case DW_ACCESS_private:
13792 case DW_ACCESS_protected:
13797 if (die->
tag == DW_TAG_typedef)
13805typedef std::unordered_map<sect_offset, int, gdb::hash_enum<sect_offset>>
13813static const gdb::array_view<discriminant_range>
13817 std::vector<discriminant_range> ranges;
13822 if (
variant.discr_list_data ==
nullptr)
13826 ranges.push_back (r);
13830 gdb::array_view<const gdb_byte> data (
variant.discr_list_data->data,
13831 variant.discr_list_data->size);
13832 while (!data.empty ())
13834 if (data[0] != DW_DSC_range && data[0] != DW_DSC_label)
13836 complaint (_(
"invalid discriminant marker: %d"), data[0]);
13839 bool is_range = data[0] == DW_DSC_range;
13840 data = data.slice (1);
13842 ULONGEST low, high;
13843 unsigned int bytes_read;
13847 complaint (_(
"DW_AT_discr_list missing low value"));
13855 data = data.slice (bytes_read);
13861 complaint (_(
"DW_AT_discr_list missing high value"));
13870 data = data.slice (bytes_read);
13875 ranges.push_back ({ low, high });
13881 std::copy (ranges.begin (), ranges.end (), result);
13882 return gdb::array_view<discriminant_range> (result, ranges.size ());
13886 (
struct obstack *obstack,
13889 const std::vector<variant_part_builder> &variant_parts);
13906 field.variant_parts);
13918 struct obstack *obstack,
13924 if (iter == offset_map.end ())
13937 size_t n = builder.
variants.size ();
13939 for (
size_t i = 0; i < n; ++i)
13943 result.
variants = gdb::array_view<variant> (output, n);
13952static const gdb::array_view<variant_part>
13956 const std::vector<variant_part_builder> &variant_parts)
13958 if (variant_parts.empty ())
13961 size_t n = variant_parts.size ();
13963 for (
size_t i = 0; i < n; ++i)
13967 return gdb::array_view<variant_part> (result, n);
13981 for (
int i = 0; i < fip->
fields.size (); ++i)
13982 offset_map[fip->
fields[i].offset] = i;
13985 gdb::array_view<const variant_part> parts
14003 int nfields = fip->
nfields ();
14033 unsigned char *pointer;
14046 for (
int i = 0; i < nfields; ++i)
14053 switch (
field.accessibility)
14055 case DW_ACCESS_private:
14060 case DW_ACCESS_protected:
14065 case DW_ACCESS_public:
14071 complaint (_(
"unsupported accessibility %d"),
14072 field.accessibility);
14076 if (i < fip->baseclasses.size ())
14078 switch (
field.virtuality)
14080 case DW_VIRTUALITY_virtual:
14081 case DW_VIRTUALITY_pure_virtual:
14083 error (_(
"unexpected virtuality in component of Ada type"));
14097 const char *fieldname;
14098 const char *type_name;
14101 if (die->
parent == NULL)
14104 if (die->
parent->
tag != DW_TAG_structure_type
14105 && die->
parent->
tag != DW_TAG_union_type
14106 && die->
parent->
tag != DW_TAG_class_type)
14111 if (fieldname == NULL || type_name == NULL)
14114 len = strlen (fieldname);
14115 return (strncmp (fieldname, type_name, len) == 0
14116 && (type_name[len] ==
'\0' || type_name[len] ==
'<'));
14130 const char *fieldname;
14131 struct type *this_type;
14134 error (_(
"unexpected member function in Ada type"));
14138 if (fieldname == NULL)
14144 if (strcmp (fip->
fnfieldlists[i].name, fieldname) == 0)
14152 if (flp ==
nullptr)
14156 flp->
name = fieldname;
14172 fnp->
physname = physname ? physname :
"";
14177 if (this_type && this_type->
code () == TYPE_CODE_FUNC)
14199 complaint (_(
"member function type missing for '%s'"),
14203 if (
dwarf2_attr (die, DW_AT_containing_type, cu) != NULL)
14213 case DW_ACCESS_private:
14216 case DW_ACCESS_protected:
14228 if (attr !=
nullptr)
14244 attr =
dwarf2_attr (die, DW_AT_vtable_elem_location, cu);
14245 if (attr !=
nullptr)
14251 if (
block->data[0] == DW_OP_constu)
14256 else if (
block->data[0] == DW_OP_deref
14257 || (
block->size > 1
14258 &&
block->data[0] == DW_OP_deref_size
14279 complaint (_(
"cannot determine context for virtual member "
14280 "function \"%s\" (offset %s)"),
14302 if (attr !=
nullptr && attr->
as_virtuality () != DW_VIRTUALITY_none)
14305 complaint (_(
"Member function \"%s\" (offset %s) is virtual "
14306 "but the vtable offset is not specified"),
14321 error (_(
"unexpected member functions in Ada type"));
14338 for (
int k = 0; k < nf.
fnfields.size (); ++k)
14350 static const char vptr[] =
"_vptr";
14384 if (pfn_type == NULL
14385 || pfn_type->
code () != TYPE_CODE_PTR
14408static struct type *
14411 if (
type->
code () != TYPE_CODE_ARRAY)
14419 if (new_target ==
nullptr)
14434 nfields *
sizeof (
struct field)));
14435 memcpy (new_fields, copy->
fields (), nfields * sizeof (
struct field));
14437 if (new_target !=
nullptr)
14444 *bounds = *current_bounds;
14485 struct type *new_ary_type
14487 if (new_ary_type !=
nullptr)
14500 if (attr ==
nullptr)
14505 complaint (_(
"DW_AT_alignment must have constant form"
14506 " - DIE at %s [in module %s]"),
14515 complaint (_(
"DW_AT_alignment value must not be negative"
14516 " - DIE at %s [in module %s]"),
14521 ULONGEST align = val;
14525 complaint (_(
"DW_AT_alignment value must not be zero"
14526 " - DIE at %s [in module %s]"),
14531 if ((align & (align - 1)) != 0)
14533 complaint (_(
"DW_AT_alignment value must be a power of 2"
14534 " - DIE at %s [in module %s]"),
14551 complaint (_(
"DW_AT_alignment value too large"
14552 " - DIE at %s [in module %s]"),
14566 case DW_CC_pass_by_reference:
14567 case DW_CC_pass_by_value:
14571 complaint (_(
"unrecognized DW_AT_calling_convention value "
14572 "(%s) for a type"), pulongest (
value));
14587 case DW_CC_program:
14591 case DW_CC_GNU_renesas_sh:
14592 case DW_CC_GNU_borland_fastcall_i386:
14593 case DW_CC_GDB_IBM_OpenCL:
14597 complaint (_(
"unrecognized DW_AT_calling_convention value "
14598 "(%s) for a subroutine"), pulongest (
value));
14615static struct type *
14626 attr = die->
attr (DW_AT_signature);
14627 if (attr !=
nullptr)
14663 if (die->
tag == DW_TAG_structure_type)
14667 else if (die->
tag == DW_TAG_union_type)
14671 else if (die->
tag == DW_TAG_namelist)
14686 attr =
dwarf2_attr (die, DW_AT_calling_convention, cu);
14687 if (attr !=
nullptr
14696 if (attr !=
nullptr)
14725 else if (attr == NULL && die->
child == NULL
14746 std::vector<struct symbol *> *template_args,
14755 std::vector<struct symbol *> *template_args,
14766 complaint (_(
"nested DW_TAG_variant_part seen "
14767 "- DIE at %s [in module %s]"),
14781 scoped_restore save_current_variant_part
14798 complaint (_(
"DW_AT_discr does not have DIE reference form"
14799 " - DIE at %s [in module %s]"),
14806 child_die = child_die->sibling)
14816 std::vector<struct symbol *> *template_args,
14821 complaint (_(
"saw DW_TAG_variant outside DW_TAG_variant_part "
14822 "- DIE at %s [in module %s]"),
14829 complaint (_(
"nested DW_TAG_variant seen "
14830 "- DIE at %s [in module %s]"),
14836 scoped_restore save_processing_variant
14850 if (discr ==
nullptr || discr->
as_block ()->
size == 0)
14851 variant.default_branch =
true;
14859 variant_child != NULL;
14860 variant_child = variant_child->sibling)
14872 std::vector<struct symbol *> *template_args,
14875 if (child_die->
tag == DW_TAG_member
14876 || child_die->
tag == DW_TAG_variable
14877 || child_die->
tag == DW_TAG_namelist_item)
14886 else if (child_die->
tag == DW_TAG_subprogram)
14899 else if (child_die->
tag == DW_TAG_inheritance)
14906 else if (child_die->
tag == DW_TAG_template_type_param
14907 || child_die->
tag == DW_TAG_template_value_param)
14912 template_args->push_back (arg);
14914 else if (child_die->
tag == DW_TAG_variant_part)
14916 else if (child_die->
tag == DW_TAG_variant)
14936 bool has_template_parameters =
false;
14940 std::vector<struct symbol *> template_args;
14942 child_die = die->
child;
14944 while (child_die && child_die->
tag)
14947 child_die = child_die->
sibling;
14951 if (!template_args.empty ())
14953 has_template_parameters =
true;
14961 template_args.data (),
14963 *
sizeof (
struct symbol *)));
14978 if (
dwarf2_attr (die, DW_AT_containing_type, cu) != NULL)
14992 const char *fieldname = t->
field (i).
name ();
15003 complaint (_(
"virtual function table pointer "
15004 "not found when defining class '%s'"),
15013 && startswith (cu->
producer,
"IBM(R) XL C/C++ Advanced Edition"))
15083 child_die = die->
child;
15085 while (child_die != NULL && child_die->
tag)
15087 if (child_die->
tag == DW_TAG_member
15088 || child_die->
tag == DW_TAG_variable
15089 || child_die->
tag == DW_TAG_inheritance
15090 || child_die->
tag == DW_TAG_template_value_param
15091 || child_die->
tag == DW_TAG_template_type_param)
15098 child_die = child_die->
sibling;
15104 if (
dwarf2_attr (die, DW_AT_byte_size, cu) != NULL
15106 ||
dwarf2_attr (die, DW_AT_signature, cu) != NULL)
15110 if (has_template_parameters)
15113 if (sym !=
nullptr)
15124 complaint (_(
"could not find suitable "
15125 "symtab for template parameter"
15126 " - DIE at %s [in module %s]"),
15154 int unsigned_enum = 1;
15157 auto_obstack obstack;
15158 std::vector<struct field> fields;
15160 for (child_die = die->
child;
15161 child_die != NULL && child_die->
tag;
15162 child_die = child_die->
sibling)
15166 const gdb_byte *bytes;
15170 if (child_die->
tag != DW_TAG_enumerator)
15173 attr =
dwarf2_attr (child_die, DW_AT_const_value, cu);
15179 name =
"<anonymous enumerator>";
15182 &
value, &bytes, &baton);
15190 if (count_one_bits_ll (
value) >= 2)
15194 fields.emplace_back ();
15200 if (!fields.empty ())
15207 sizeof (
struct field) * fields.size ());
15220static struct type *
15231 attr = die->
attr (DW_AT_signature);
15232 if (attr !=
nullptr)
15257 if (attr !=
nullptr)
15316 struct type *this_type;
15319 if (this_type == NULL)
15322 if (die->
child != NULL)
15327 child_die = die->
child;
15328 while (child_die && child_die->
tag)
15330 if (child_die->
tag != DW_TAG_enumerator)
15341 child_die = child_die->
sibling;
15383 const gdb_byte *start =
block->data;
15384 const gdb_byte *end =
block->data +
block->size;
15407 if (end - start < 2)
15409 if (*start++ != DW_OP_push_object_address)
15411 if (*start++ != DW_OP_plus_uconst)
15414 uint64_t this_bound_off;
15416 if (start ==
nullptr || (
int) this_bound_off != this_bound_off)
15420 if (*bounds_offset == -1)
15421 *bounds_offset = this_bound_off;
15422 else if (*bounds_offset != this_bound_off)
15425 if (start == end || *start++ != DW_OP_deref)
15431 else if (*start == DW_OP_deref_size || *start == DW_OP_deref)
15435 else if (*start++ != DW_OP_plus_uconst)
15442 if (start ==
nullptr)
15444 if ((
int) val != val)
15453 if (*start == DW_OP_deref_size)
15456 if (start ==
nullptr)
15459 else if (*start == DW_OP_deref)
15500static struct type *
15515 || blk->
data[0] != DW_OP_push_object_address
15516 || blk->
data[1] != DW_OP_deref)
15519 int bounds_offset = -1;
15520 int max_align = -1;
15521 std::vector<struct field> range_fields;
15524 child_die = child_die->sibling)
15526 if (child_die->tag == DW_TAG_subrange_type)
15531 if (this_align > max_align)
15532 max_align = this_align;
15534 range_fields.emplace_back ();
15535 range_fields.emplace_back ();
15537 struct field &lower = range_fields[range_fields.size () - 2];
15538 struct field &upper = range_fields[range_fields.size () - 1];
15547 &bounds_offset, &lower, cu)
15549 &bounds_offset, &upper, cu))
15556 if (bounds_offset == -1)
15560 for (
int i = 0; i < range_fields.size (); i += 2)
15565 xsnprintf (
name,
sizeof (
name),
"LB%d", i / 2);
15567 xsnprintf (
name,
sizeof (
name),
"UB%d", i / 2);
15572 bounds->set_code (TYPE_CODE_STRUCT);
15574 bounds->set_num_fields (range_fields.size ());
15577 * sizeof (
struct field))));
15578 memcpy (
bounds->fields (), range_fields.data (),
15581 int last_fieldno = range_fields.size () - 1;
15582 int bounds_size = (
bounds->field (last_fieldno).loc_bitpos () / 8
15583 +
bounds->field (last_fieldno).type ()->length ());
15584 bounds->set_length (align_up (bounds_size, max_align));
15590 for (
int i = 0; i < range_fields.size (); i += 2)
15592 gdb_assert (iter->
code () == TYPE_CODE_ARRAY);
15600 result->
set_code (TYPE_CODE_STRUCT);
15605 * sizeof (
struct field))));
15628static struct type *
15638 unsigned int bit_stride = 0;
15640 element_type =
die_type (die, cu);
15659 complaint (_(
"unable to read array DW_AT_byte_stride "
15660 " - DIE at %s [in module %s]"),
15666 byte_stride_prop = NULL;
15676 if (die->
child == NULL)
15681 byte_stride_prop, bit_stride);
15685 std::vector<struct type *> range_types;
15686 child_die = die->
child;
15687 while (child_die && child_die->
tag)
15689 if (child_die->
tag == DW_TAG_subrange_type
15690 || child_die->
tag == DW_TAG_generic_subrange)
15694 if (child_type != NULL)
15698 range_types.push_back (child_type);
15701 child_die = child_die->
sibling;
15704 if (range_types.empty ())
15706 complaint (_(
"unable to find array range - DIE at %s [in module %s]"),
15715 type = element_type;
15721 while (i < range_types.size ())
15727 byte_stride_prop =
nullptr;
15732 size_t ndim = range_types.size ();
15739 byte_stride_prop =
nullptr;
15745 gdb_assert (
type != element_type);
15754 if (attr !=
nullptr)
15766 complaint (_(
"DW_AT_byte_size for array type smaller "
15767 "than the total size of elements"));
15776 struct type *replacement_type =
nullptr;
15780 if (replacement_type !=
nullptr)
15781 type = replacement_type;
15793static enum dwarf_array_dim_ordering
15800 if (attr !=
nullptr)
15803 if (val == DW_ORD_row_major || val == DW_ORD_col_major)
15804 return (
enum dwarf_array_dim_ordering) val;
15817 return DW_ORD_row_major;
15823 return DW_ORD_col_major;
15826 return DW_ORD_row_major;
15833static struct type *
15877 unsigned int cu_off;
15879 LONGEST offset = 0;
15881 gdb_assert (common_loc && member_loc);
15889 gdb_assert (baton->
per_cu);
15891 baton->
size = 5 + 1 ;
15904 *ptr++ = DW_OP_call4;
15911 *ptr++ = DW_OP_addr;
15913 ptr += cu->
header.addr_size;
15921 ptr +=
block->size;
15924 *ptr++ = DW_OP_plus;
15925 gdb_assert (ptr - baton->
data == baton->
size);
15943 if (attr !=
nullptr)
15958 "common block member");
15963 if (die->
child != NULL)
15967 size_t n_entries = 0,
size;
15971 for (child_die = die->
child;
15972 child_die && child_die->
tag;
15973 child_die = child_die->
sibling)
15984 for (child_die = die->
child;
15985 child_die && child_die->
tag;
15986 child_die = child_die->
sibling)
15997 member_loc =
dwarf2_attr (child_die, DW_AT_data_member_location,
16005 complaint (_(
"Variable in common block has "
16006 "DW_AT_data_member_location "
16007 "- DIE at %s [in module %s]"),
16016 if (attr !=
nullptr)
16033static struct type *
16037 const char *previous_prefix, *
name;
16042 if (
dwarf2_attr (die, DW_AT_extension, cu) != NULL)
16060 if (previous_prefix[0] !=
'\0')
16062 previous_prefix,
name, 0, cu);
16082 if (
dwarf2_attr (die, DW_AT_extension, cu) == NULL)
16094 std::vector<const char *> excludes;
16096 previous_prefix,
type->
name (), NULL,
16101 if (die->
child != NULL)
16105 while (child_die && child_die->
tag)
16108 child_die = child_die->
sibling;
16117static struct type *
16121 const char *module_name;
16141 while (child_die && child_die->
tag)
16144 child_die = child_die->
sibling;
16156 const char *
name = NULL;
16160 for (current_die = die;
16161 current_die != NULL;
16174 *is_anonymous = (
name == NULL);
16184static struct type *
16192 int byte_size, addr_class;
16204 attr_byte_size =
dwarf2_attr (die, DW_AT_byte_size, cu);
16205 if (attr_byte_size)
16210 attr_address_class =
dwarf2_attr (die, DW_AT_address_class, cu);
16211 if (attr_address_class)
16214 addr_class = DW_ADDR_none;
16224 || addr_class != DW_ADDR_none)
16228 type_instance_flags type_flags
16237 complaint (_(
"invalid pointer size %d"), byte_size);
16242 " - DIE at %s [in module %s]"),
16260static struct type *
16264 struct type *to_type;
16265 struct type *domain;
16295static struct type *
16303 gdb_assert (refcode == TYPE_CODE_REF || refcode == TYPE_CODE_RVALUE_REF);
16314 if (attr !=
nullptr)
16329static struct type *
16331 struct type *base_type,
int cnst,
int voltl)
16333 struct type *el_type, *inner_array;
16336 inner_array = base_type;
16352static struct type *
16355 struct type *base_type, *cv_type;
16366 if (base_type->
code () == TYPE_CODE_ARRAY)
16373static struct type *
16376 struct type *base_type, *cv_type;
16388 if (base_type->
code () == TYPE_CODE_ARRAY)
16397static struct type *
16400 struct type *base_type, *cv_type;
16415static struct type *
16418 struct type *base_type, *cv_type;
16436static struct type *
16444 bool length_is_constant =
true;
16454 if (
dwarf2_attr (die, DW_AT_bit_size, cu) !=
nullptr
16455 ||
dwarf2_attr (die, DW_AT_string_length_bit_size, cu) !=
nullptr)
16457 static bool warning_printed =
false;
16458 if (!warning_printed)
16460 warning (_(
"DW_AT_bit_size and DW_AT_string_length_bit_size not "
16461 "currently supported on DW_TAG_string_type."));
16462 warning_printed =
true;
16466 attr =
dwarf2_attr (die, DW_AT_string_length, cu);
16472 struct type *prop_type;
16474 =
dwarf2_attr (die, DW_AT_string_length_byte_size, cu);
16475 if (len ==
nullptr)
16495 length_is_constant =
false;
16497 else if (attr !=
nullptr)
16505 else if ((attr =
dwarf2_attr (die, DW_AT_byte_size, cu)) !=
nullptr)
16517 if (length_is_constant)
16574static struct type *
16579 struct type *ftype;
16597 attr =
dwarf2_attr (die, DW_AT_calling_convention, cu);
16598 if (attr !=
nullptr
16618 if (die->
child != NULL)
16622 int nparams, iparams;
16628 child_die = die->
child;
16629 while (child_die && child_die->
tag)
16631 if (child_die->
tag == DW_TAG_formal_parameter)
16633 else if (child_die->
tag == DW_TAG_unspecified_parameters)
16636 child_die = child_die->
sibling;
16646 for (iparams = 0; iparams < nparams; iparams++)
16650 child_die = die->
child;
16651 while (child_die && child_die->
tag)
16653 if (child_die->
tag == DW_TAG_formal_parameter)
16655 struct type *arg_type;
16666 attr =
dwarf2_attr (child_die, DW_AT_artificial, cu);
16667 if (attr !=
nullptr)
16671 arg_type =
die_type (child_die, cu);
16684 attr =
dwarf2_attr (die, DW_AT_object_pointer, cu);
16685 if (attr !=
nullptr)
16691 else if (
name && strcmp (
name,
"this") == 0)
16694 else if (
name == NULL && iparams == 0)
16708 child_die = child_die->
sibling;
16715static struct type *
16719 const char *
name = NULL;
16733 complaint (_(
"Self-referential DW_TAG_typedef "
16734 "- DIE at %s [in module %s]"),
16759 if (attr->
form == DW_FORM_exprloc)
16762 if (blk->
size > 0 && blk->
data[0] == DW_OP_implicit_value)
16768 if (ptr - blk->
data + len <= blk->
size)
16770 mpz_import (
value->val, len,
16787 1, 0, 0, blk->
data);
16804 struct attribute *num_attr, *denom_attr;
16806 num_attr =
dwarf2_attr (die, DW_AT_GNU_numerator, cu);
16807 if (num_attr ==
nullptr)
16808 complaint (_(
"DW_AT_GNU_numerator missing in %s DIE at %s"),
16811 denom_attr =
dwarf2_attr (die, DW_AT_GNU_denominator, cu);
16812 if (denom_attr ==
nullptr)
16813 complaint (_(
"DW_AT_GNU_denominator missing in %s DIE at %s"),
16816 if (num_attr ==
nullptr || denom_attr ==
nullptr)
16819 get_mpz (cu, numerator, num_attr);
16820 get_mpz (cu, denominator, denom_attr);
16839 if (mpz_sgn (num.
val) == -1 && mpz_sgn (denom.
val) == -1)
16841 mpz_neg (num.
val, num.
val);
16842 mpz_neg (denom.
val, denom.
val);
16844 else if (mpz_sgn (num.
val) == -1)
16846 complaint (_(
"unexpected negative value for DW_AT_GNU_numerator"
16851 else if (mpz_sgn (denom.
val) == -1)
16853 complaint (_(
"unexpected negative value for DW_AT_GNU_denominator"
16859 *numerator = std::move (num);
16860 *denominator = std::move (denom);
16876 if (encoding[k] !=
'_' || !isdigit (encoding[k + 1]))
16884 while (isdigit (encoding[k]))
16889 std::string copy (&encoding[start], k - start);
16890 if (mpz_set_str (result->
val, copy.c_str (), 10) == -1)
16920 gdb_assert (
type->
code () == TYPE_CODE_FIXED_POINT
16926 if (suffix ==
nullptr)
16928 attr =
dwarf2_attr (die, DW_AT_binary_scale, cu);
16929 if (attr ==
nullptr)
16930 attr =
dwarf2_attr (die, DW_AT_decimal_scale, cu);
16931 if (attr ==
nullptr)
16944 if (attr ==
nullptr)
16947 if (suffix !=
nullptr
16953 && (suffix[offset] !=
'_'
16966 complaint (_(
"no scale found for fixed-point type (DIE at %s)"),
16970 else if (attr->
name == DW_AT_binary_scale)
16973 gdb_mpz *num_or_denom = scale_exp > 0 ? &scale_num : &scale_denom;
16975 mpz_mul_2exp (num_or_denom->
val, num_or_denom->
val, std::abs (scale_exp));
16977 else if (attr->
name == DW_AT_decimal_scale)
16980 gdb_mpz *num_or_denom = scale_exp > 0 ? &scale_num : &scale_denom;
16982 mpz_ui_pow_ui (num_or_denom->
val, 10, std::abs (scale_exp));
16984 else if (attr->
name == DW_AT_small)
16990 if (scale_die->
tag == DW_TAG_constant)
16992 &scale_num, &scale_denom);
16994 complaint (_(
"%s DIE not supported as target of DW_AT_small attribute"
17000 complaint (_(
"unsupported scale attribute %s for fixed-point type"
17007 mpz_set (mpq_numref (scaling_factor.
val), scale_num.
val);
17008 mpz_set (mpq_denref (scaling_factor.
val), scale_denom.
val);
17009 mpq_canonicalize (scaling_factor.
val);
17014#define GNAT_FIXED_POINT_SUFFIX "___XF_"
17030static struct type *
17032 const char *name_hint,
enum bfd_endian byte_order)
17035 const struct floatformat **format;
17049static struct type *
17051 int bits,
int unsigned_p,
const char *
name)
17059 && strcmp (
name,
"void") == 0)
17078 if (attr ==
nullptr)
17085 if (scale_die->
tag != DW_TAG_constant)
17090 return mpz_sgn (num.val) == 0 && mpz_sgn (denom.
val) == 0;
17102static struct type *
17105 int bits,
const char *name_hint,
17106 enum bfd_endian byte_order)
17109 struct type *tt =
nullptr;
17114 switch (cu->
lang ())
17151 if (tt !=
nullptr && tt->
length () * TARGET_CHAR_BIT !=
bits)
17154 const char *
name = (tt ==
nullptr) ?
nullptr : tt->
name ();
17161static struct type *
17167 int encoding = 0,
bits = 0;
17175 if (attr !=
nullptr)
17179 complaint (_(
"DW_AT_name missing from DW_TAG_base_type"));
17192 byte_order = BFD_ENDIAN_BIG;
17194 case DW_END_little:
17195 byte_order = BFD_ENDIAN_LITTLE;
17198 complaint (_(
"DW_AT_endianity has unrecognized value %d"), endianity);
17203 if ((encoding == DW_ATE_signed_fixed || encoding == DW_ATE_unsigned_fixed)
17215 encoding = (encoding == DW_ATE_signed_fixed
17217 : DW_ATE_unsigned);
17224 const char *gnat_encoding_suffix =
nullptr;
17225 if ((encoding == DW_ATE_signed || encoding == DW_ATE_unsigned)
17227 &&
name !=
nullptr)
17230 if (gnat_encoding_suffix !=
nullptr)
17232 gdb_assert (startswith (gnat_encoding_suffix,
17235 name, gnat_encoding_suffix -
name);
17240 encoding = (encoding == DW_ATE_signed
17241 ? DW_ATE_signed_fixed
17242 : DW_ATE_unsigned_fixed);
17248 case DW_ATE_address:
17253 case DW_ATE_boolean:
17256 case DW_ATE_complex_float:
17259 if (
type->
code () == TYPE_CODE_ERROR)
17261 if (
name ==
nullptr)
17263 struct obstack *obstack
17273 case DW_ATE_decimal_float:
17279 case DW_ATE_signed:
17282 case DW_ATE_unsigned:
17285 && startswith (
name,
"character("))
17290 case DW_ATE_signed_char:
17299 case DW_ATE_unsigned_char:
17315 case DW_ATE_signed_fixed:
17319 case DW_ATE_unsigned_fixed:
17325 complaint (_(
"unsupported DW_AT_encoding: '%s'"),
17331 if (
type->
code () == TYPE_CODE_INT
17333 && strcmp (
name,
"char") == 0)
17346 attr =
dwarf2_attr (die, DW_AT_data_bit_offset, cu);
17348 if (attr ==
nullptr
17354 if (attr !=
nullptr)
17370 if (die->
tag != DW_TAG_variable)
17374 if (attr ==
nullptr || !attr->
as_boolean ())
17378 if (attr ==
nullptr)
17390 struct type *default_type)
17397 gdb_assert (default_type != NULL);
17399 if (attr == NULL || prop == NULL)
17410 if (attr->
form == DW_FORM_data16)
17412 size_t data_size = 16;
17414 block->size = (data_size
17416 gdb_byte *
data = XOBNEWVEC (obstack, gdb_byte,
block->size);
17417 data[0] = DW_OP_implicit_value;
17418 data[1] = data_size;
17427 switch (attr->
name)
17429 case DW_AT_string_length:
17438 gdb_assert (prop->
baton () != NULL);
17447 target_attr =
dwarf2_attr (target_die, DW_AT_location, target_cu);
17448 if (target_attr == NULL)
17449 target_attr =
dwarf2_attr (target_die, DW_AT_data_member_location,
17451 if (target_attr ==
nullptr)
17452 target_attr =
dwarf2_attr (target_die, DW_AT_data_bit_offset,
17454 if (target_attr == NULL)
17457 if (
name !=
nullptr)
17465 switch (target_attr->
name)
17467 case DW_AT_location:
17474 gdb_assert (prop->
baton () != NULL);
17487 gdb_assert (prop->
baton () != NULL);
17492 "dynamic property");
17496 case DW_AT_data_member_location:
17497 case DW_AT_data_bit_offset:
17518 switch (attr->
name)
17520 case DW_AT_string_length:
17525 gdb_assert (prop->
baton () != NULL);
17548static struct type *
17573static struct type *
17576 struct type *base_type, *orig_base_type;
17577 struct type *range_type;
17580 int low_default_is_valid;
17581 int high_bound_is_count = 0;
17583 ULONGEST negative_mask;
17602 switch (cu->
lang ())
17607 low_default_is_valid = 1;
17611 low_default_is_valid = 1;
17617 low_default_is_valid = (cu->
header.version >= 4);
17623 low_default_is_valid = (cu->
header.version >= 4);
17627 low_default_is_valid = 0;
17632 if (attr !=
nullptr)
17634 else if (!low_default_is_valid)
17635 complaint (_(
"Missing DW_AT_lower_bound "
17636 "- DIE at %s [in module %s]"),
17640 struct attribute *attr_ub, *attr_count;
17641 attr = attr_ub =
dwarf2_attr (die, DW_AT_upper_bound, cu);
17644 attr = attr_count =
dwarf2_attr (die, DW_AT_count, cu);
17651 high_bound_is_count = 1;
17655 if (attr_ub != NULL)
17656 complaint (_(
"Unresolved DW_AT_upper_bound "
17657 "- DIE at %s [in module %s]"),
17660 if (attr_count != NULL)
17662 "- DIE at %s [in module %s]"),
17681 -((ULONGEST) 1 << (base_type->
length () * TARGET_CHAR_BIT - 1));
17692 if (attr_byte_stride !=
nullptr)
17701 if (attr_bit_stride !=
nullptr)
17704 if (attr_byte_stride !=
nullptr)
17706 complaint (_(
"Found DW_AT_bit_stride and DW_AT_byte_stride "
17707 "- DIE at %s [in module %s]"),
17710 attr_bit_stride =
nullptr;
17720 if (attr_byte_stride !=
nullptr
17721 || attr_bit_stride !=
nullptr)
17723 bool byte_stride_p = (attr_byte_stride !=
nullptr);
17725 = byte_stride_p ? &byte_stride_prop : &bit_stride_prop;
17729 &high, bias, stride, byte_stride_p);
17734 if (high_bound_is_count)
17746 if (attr !=
nullptr)
17759static struct type *
17785 const gdb_byte *info_ptr,
17786 const gdb_byte **new_info_ptr,
17790 const gdb_byte *cur_ptr;
17795 *new_info_ptr = cur_ptr;
17805 *new_info_ptr = cur_ptr;
17819 const gdb_byte *info_ptr,
17820 const gdb_byte **new_info_ptr,
17823 struct die_info *first_die, *last_sibling;
17824 const gdb_byte *cur_ptr;
17826 cur_ptr = info_ptr;
17827 first_die = last_sibling = NULL;
17836 *new_info_ptr = cur_ptr;
17845 last_sibling = die;
17856 const gdb_byte *info_ptr,
17857 const gdb_byte **new_info_ptr,
17866 "Read die from %s@0x%x of %s:\n",
17869 bfd_get_filename (reader->
abfd));
17883static const gdb_byte *
17885 struct die_info **diep,
const gdb_byte *info_ptr,
17886 int num_extra_attrs)
17888 unsigned int abbrev_number, bytes_read, i;
17892 bfd *abfd = reader->
abfd;
17894 sect_offset sect_off = (sect_offset) (info_ptr - reader->
buffer);
17896 info_ptr += bytes_read;
17897 if (!abbrev_number)
17905 error (_(
"Dwarf Error: could not find abbrev number %d [in module %s]"),
17907 bfd_get_filename (abfd));
17912 die->
abbrev = abbrev_number;
17920 bool any_need_reprocess =
false;
17921 for (i = 0; i < abbrev->
num_attrs; ++i)
17926 any_need_reprocess =
true;
17929 struct attribute *attr = die->
attr (DW_AT_str_offsets_base);
17933 attr = die->
attr (DW_AT_loclists_base);
17934 if (attr !=
nullptr)
17937 auto maybe_addr_base = die->
addr_base ();
17938 if (maybe_addr_base.has_value ())
17941 attr = die->
attr (DW_AT_rnglists_base);
17942 if (attr !=
nullptr)
17945 if (any_need_reprocess)
17947 for (i = 0; i < abbrev->
num_attrs; ++i)
17961static const gdb_byte *
17963 struct die_info **diep,
const gdb_byte *info_ptr)
17965 const gdb_byte *result;
17972 "Read die from %s@0x%x of %s:\n",
17975 bfd_get_filename (reader->
abfd));
17991 CORE_ADDR best_lowpc = 0, best_highpc = 0;
18025 case DW_TAG_variable:
18026 case DW_TAG_subprogram:
18037 sect_offset sect_off,
bool is_dwz,
18043 && reader->
cu->
header.offset_in_cu_p (sect_off))
18055 if (!per_cu->
scanned.compare_exchange_strong (nope,
true))
18062 if (result ==
nullptr)
18064 cutu_reader new_reader (per_cu, per_objfile,
nullptr,
nullptr,
false,
18069 std::unique_ptr<cutu_reader> copy
18086 const gdb_byte *watermark_ptr,
18087 const gdb_byte *info_ptr,
18090 const char **linkage_name,
18091 cooked_index_flag *
flags,
18092 sect_offset *sibling_offset,
18094 CORE_ADDR *maybe_defer,
18095 bool for_specification)
18097 bool origin_is_dwz =
false;
18098 bool is_declaration =
false;
18099 sect_offset origin_offset {};
18101 gdb::optional<CORE_ADDR> low_pc;
18102 gdb::optional<CORE_ADDR> high_pc;
18103 bool high_pc_relative =
false;
18105 for (
int i = 0; i < abbrev->
num_attrs; ++i)
18117 switch (abbrev->
tag)
18119 case DW_TAG_compile_unit:
18120 case DW_TAG_partial_unit:
18121 case DW_TAG_type_unit:
18127 if (*
name ==
nullptr)
18133 case DW_AT_linkage_name:
18134 case DW_AT_MIPS_linkage_name:
18138 if (*linkage_name ==
nullptr)
18142 case DW_AT_main_subprogram:
18147 case DW_AT_declaration:
18151 case DW_AT_sibling:
18152 if (sibling_offset !=
nullptr)
18156 case DW_AT_specification:
18157 case DW_AT_abstract_origin:
18158 case DW_AT_extension:
18160 origin_is_dwz = attr.
form == DW_FORM_GNU_ref_alt;
18163 case DW_AT_external:
18165 *
flags &= ~IS_STATIC;
18168 case DW_AT_enum_class:
18177 case DW_AT_high_pc:
18180 high_pc_relative =
true;
18183 case DW_AT_location:
18195 high_pc = addr + 1;
18196 high_pc_relative =
false;
18212 CORE_ADDR lowpc, highpc;
18215 scanning_per_cu, abbrev->
tag);
18225 if (is_declaration && !for_specification
18230 if ((abbrev->
tag == DW_TAG_class_type
18231 || abbrev->
tag == DW_TAG_structure_type
18232 || abbrev->
tag == DW_TAG_union_type)
18237 *linkage_name =
nullptr;
18241 else if ((*
name ==
nullptr
18242 || (*linkage_name ==
nullptr
18245 && origin_offset != sect_offset (0))
18249 origin_is_dwz,
false);
18250 if (new_reader !=
nullptr)
18252 const gdb_byte *new_info_ptr = (new_reader->
buffer
18253 + to_underlying (origin_offset));
18255 if (new_reader->
cu == reader->
cu
18256 && new_info_ptr > watermark_ptr
18257 && *parent_entry ==
nullptr)
18258 *maybe_defer =
form_addr (origin_offset, origin_is_dwz);
18259 else if (*parent_entry ==
nullptr)
18261 CORE_ADDR lookup =
form_addr (origin_offset, origin_is_dwz);
18266 unsigned int bytes_read;
18270 new_info_ptr += bytes_read;
18271 scan_attributes (scanning_per_cu, new_reader, new_info_ptr, new_info_ptr,
18272 new_abbrev,
name, linkage_name,
flags,
nullptr,
18273 parent_entry, maybe_defer,
true);
18277 if (!for_specification)
18280 && *linkage_name ==
nullptr)
18281 *linkage_name = *
name;
18284 && low_pc.has_value ()
18287 && high_pc.has_value ())
18289 if (high_pc_relative)
18290 high_pc = *high_pc + *low_pc;
18292 if (*high_pc > *low_pc)
18308 if (abbrev->
tag == DW_TAG_module || abbrev->
tag == DW_TAG_namespace)
18309 *
flags &= ~IS_STATIC;
18311 if (abbrev->
tag == DW_TAG_namespace && *
name ==
nullptr)
18312 *
name =
"(anonymous namespace)";
18315 && (abbrev->
tag == DW_TAG_class_type
18316 || abbrev->
tag == DW_TAG_interface_type
18317 || abbrev->
tag == DW_TAG_structure_type
18318 || abbrev->
tag == DW_TAG_union_type
18319 || abbrev->
tag == DW_TAG_enumeration_type
18320 || abbrev->
tag == DW_TAG_enumerator))
18329 const gdb_byte *info_ptr,
18332 sect_offset sect_off {};
18333 bool is_dwz =
false;
18335 for (
int i = 0; i < abbrev->
num_attrs; ++i)
18341 if (attr.
name == DW_AT_import)
18344 is_dwz = (attr.
form == DW_FORM_GNU_ref_alt
18350 if (sect_off == sect_offset (0))
18356 if (new_reader !=
nullptr)
18368 const gdb_byte *info_ptr,
18372 info_ptr =
index_dies (reader, info_ptr, parent_entry, fully);
18374 if (parent_entry !=
nullptr)
18378 CORE_ADDR end =
form_addr (sect_offset (info_ptr - 1 - reader->
buffer),
18388 const gdb_byte *info_ptr,
18392 const gdb_byte *end_ptr = (reader->
buffer
18393 + to_underlying (reader->
cu->
header.sect_off)
18394 + reader->
cu->
header.get_length ());
18396 while (info_ptr < end_ptr)
18398 sect_offset this_die = (sect_offset) (info_ptr - reader->
buffer);
18399 unsigned int bytes_read;
18402 info_ptr += bytes_read;
18403 if (abbrev ==
nullptr)
18406 if (abbrev->
tag == DW_TAG_imported_unit)
18414 info_ptr =
skip_one_die (reader, info_ptr, abbrev, !fully);
18416 info_ptr =
index_dies (reader, info_ptr, parent_entry, fully);
18420 const char *
name =
nullptr;
18421 const char *linkage_name =
nullptr;
18422 CORE_ADDR defer = 0;
18424 sect_offset sibling {};
18427 info_ptr, abbrev, &
name, &linkage_name,
18428 &
flags, &sibling, &this_parent_entry,
18431 if (abbrev->
tag == DW_TAG_namespace
18433 && strcmp (
name,
"::") == 0)
18443 if (
name !=
nullptr)
18451 name, this_parent_entry,
18455 if (linkage_name !=
nullptr)
18459 if (
name !=
nullptr)
18463 if (
name !=
nullptr
18464 || (abbrev->
tag != DW_TAG_subprogram
18465 && abbrev->
tag != DW_TAG_inlined_subroutine
18466 && abbrev->
tag != DW_TAG_entry_point))
18474 switch (abbrev->
tag)
18476 case DW_TAG_class_type:
18477 case DW_TAG_interface_type:
18478 case DW_TAG_structure_type:
18479 case DW_TAG_union_type:
18482 info_ptr =
recurse (reader, info_ptr, this_entry, fully);
18487 case DW_TAG_enumeration_type:
18494 info_ptr =
recurse (reader, info_ptr,
18501 case DW_TAG_module:
18502 if (this_entry ==
nullptr)
18505 case DW_TAG_namespace:
18508 info_ptr =
recurse (reader, info_ptr, this_entry, fully);
18511 case DW_TAG_subprogram:
18514 && this_entry !=
nullptr)
18516 info_ptr =
recurse (reader, info_ptr, this_entry,
true);
18522 if (sibling != sect_offset (0))
18524 const gdb_byte *sibling_ptr
18525 = reader->
buffer + to_underlying (sibling);
18527 if (sibling_ptr < info_ptr)
18528 complaint (_(
"DW_AT_sibling points backwards"));
18532 info_ptr = sibling_ptr;
18567 CORE_ADDR adjusted_pc)
override;
18586 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
18588 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
18589 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
18590 block_search_flags search_flags,
18608 CORE_ADDR adjusted_pc)
18613 = (gdb::checked_static_cast<cooked_index_vector *>
18615 return table->
lookup (adjusted_pc);
18631 = (gdb::checked_static_cast<cooked_index_vector *>
18634 if (per_cu ==
nullptr)
18651 const block_search_flags search_flags = (global
18659 = (gdb::checked_static_cast<cooked_index_vector *>
18665 if (entry->parent_entry !=
nullptr)
18668 if (!entry->matches (search_flags)
18669 || !entry->matches (domain))
18672 if (name_match (entry->canonical, lookup_name,
nullptr))
18680 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
18682 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
18683 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
18684 block_search_flags search_flags,
18693 = (gdb::checked_static_cast<cooked_index_vector *>
18700 gdb_assert (lookup_name !=
nullptr || symbol_matcher ==
nullptr);
18701 if (lookup_name ==
nullptr)
18721 static const enum language unique_styles[] =
18732 for (
enum language lang : unique_styles)
18734 std::vector<gdb::string_view> name_vec
18735 = lookup_name_without_params.
split_name (lang);
18736 std::string last_name = gdb::to_string (name_vec.back ());
18749 if (file_matcher !=
nullptr && !entry->per_cu->mark)
18753 if (!entry->matches (search_flags)
18754 || !entry->matches (domain)
18755 || !entry->matches (kind))
18764 for (
int i = name_vec.size () - 1; i > 0; --i)
18768 if (parent ==
nullptr
18769 || strncmp (parent->
name, name_vec[i - 1].data (),
18770 name_vec[i - 1].length ()) != 0)
18784 if (symbol_matcher ==
nullptr)
18791 && parent !=
nullptr)
18796 auto_obstack temp_storage;
18797 const char *full_name = entry->full_name (&temp_storage);
18798 if (!symbol_matcher (full_name))
18835 sect_offset header_offset)
18837 unsigned int bytes_read;
18839 const gdb_byte *info_ptr = section->
buffer + to_underlying (header_offset);
18842 info_ptr += bytes_read;
18871 if (cu->
header.initial_length_size == 4)
18887 ULONGEST loclist_header_size =
18893 ULONGEST start_offset =
18894 loclist_base + loclist_index * cu->
header.offset_size;
18902 error (_(
"DW_FORM_loclistx used without .debug_loclists "
18907 if (loclist_base < loclist_header_size)
18908 error (_(
"DW_AT_loclists_base is smaller than header size [in module %s]"),
18914 (sect_offset) (loclist_base - loclist_header_size));
18918 error (_(
"DW_FORM_loclistx pointing outside of "
18919 ".debug_loclists offset array [in module %s]"),
18923 if (start_offset + cu->
header.offset_size > section->
size)
18924 error (_(
"Reading DW_FORM_loclistx index beyond end of"
18925 ".debug_loclists section [in module %s]"),
18928 const gdb_byte *info_ptr = section->
buffer + start_offset;
18930 if (cu->
header.offset_size == 4)
18931 return (sect_offset) (bfd_get_32 (abfd, info_ptr) + loclist_base);
18933 return (sect_offset) (bfd_get_64 (abfd, info_ptr) + loclist_base);
18946 ULONGEST rnglist_header_size =
18953 ULONGEST rnglist_base =
18957 ULONGEST start_offset =
18958 rnglist_base + rnglist_index * cu->
header.offset_size;
18965 if (
section->buffer ==
nullptr)
18966 error (_(
"DW_FORM_rnglistx used without .debug_rnglists section "
18972 if (rnglist_base < rnglist_header_size)
18973 error (_(
"DW_AT_rnglists_base is smaller than header size [in module %s]"),
18979 (sect_offset) (rnglist_base - rnglist_header_size));
18983 error (_(
"DW_FORM_rnglistx index pointing outside of "
18984 ".debug_rnglists offset array [in module %s]"),
18988 if (start_offset + cu->
header.offset_size > section->
size)
18989 error (_(
"Reading DW_FORM_rnglistx index beyond end of"
18990 ".debug_rnglists section [in module %s]"),
18993 const gdb_byte *info_ptr = section->
buffer + start_offset;
18995 if (cu->
header.offset_size == 4)
18996 return (sect_offset) (
read_4_bytes (abfd, info_ptr) + rnglist_base);
18998 return (sect_offset) (
read_8_bytes (abfd, info_ptr) + rnglist_base);
19010 switch (attr->
form)
19012 case DW_FORM_addrx:
19013 case DW_FORM_GNU_addr_index:
19017 case DW_FORM_loclistx:
19019 sect_offset loclists_sect_off
19022 attr->
set_unsigned (to_underlying (loclists_sect_off));
19025 case DW_FORM_rnglistx:
19027 sect_offset rnglists_sect_off
19030 attr->
set_unsigned (to_underlying (rnglists_sect_off));
19034 case DW_FORM_strx1:
19035 case DW_FORM_strx2:
19036 case DW_FORM_strx3:
19037 case DW_FORM_strx4:
19038 case DW_FORM_GNU_str_index:
19051 gdb_assert_not_reached (
"Unexpected DWARF form.");
19057static const gdb_byte *
19060 LONGEST implicit_const,
const gdb_byte *info_ptr)
19065 bfd *abfd = reader->
abfd;
19067 unsigned int bytes_read;
19070 attr->
form = (
enum dwarf_form) form;
19073 case DW_FORM_ref_addr:
19080 info_ptr += bytes_read;
19082 case DW_FORM_GNU_ref_alt:
19085 info_ptr += bytes_read;
19090 CORE_ADDR addr = cu_header->
read_address (abfd, info_ptr, &bytes_read);
19093 info_ptr += bytes_read;
19096 case DW_FORM_block2:
19101 info_ptr += blk->
size;
19104 case DW_FORM_block4:
19109 info_ptr += blk->
size;
19112 case DW_FORM_data2:
19116 case DW_FORM_data4:
19120 case DW_FORM_data8:
19124 case DW_FORM_data16:
19131 case DW_FORM_sec_offset:
19134 info_ptr += bytes_read;
19136 case DW_FORM_loclistx:
19140 info_ptr += bytes_read;
19143 case DW_FORM_string:
19146 info_ptr += bytes_read;
19153 abfd, info_ptr, cu_header,
19155 info_ptr += bytes_read;
19159 case DW_FORM_line_strp:
19165 info_ptr += bytes_read;
19169 case DW_FORM_GNU_strp_alt:
19172 LONGEST str_offset = cu_header->
read_offset (abfd, info_ptr,
19177 info_ptr += bytes_read;
19180 case DW_FORM_exprloc:
19181 case DW_FORM_block:
19184 info_ptr += bytes_read;
19186 info_ptr += blk->
size;
19189 case DW_FORM_block1:
19194 info_ptr += blk->
size;
19197 case DW_FORM_data1:
19202 case DW_FORM_flag_present:
19205 case DW_FORM_sdata:
19207 info_ptr += bytes_read;
19209 case DW_FORM_rnglistx:
19213 info_ptr += bytes_read;
19216 case DW_FORM_udata:
19218 info_ptr += bytes_read;
19240 case DW_FORM_ref_sig8:
19244 case DW_FORM_ref_udata:
19248 info_ptr += bytes_read;
19250 case DW_FORM_indirect:
19252 info_ptr += bytes_read;
19253 if (form == DW_FORM_implicit_const)
19256 info_ptr += bytes_read;
19261 case DW_FORM_implicit_const:
19264 case DW_FORM_addrx:
19265 case DW_FORM_GNU_addr_index:
19268 info_ptr += bytes_read;
19271 case DW_FORM_strx1:
19272 case DW_FORM_strx2:
19273 case DW_FORM_strx3:
19274 case DW_FORM_strx4:
19275 case DW_FORM_GNU_str_index:
19277 ULONGEST str_index;
19278 if (form == DW_FORM_strx1)
19283 else if (form == DW_FORM_strx2)
19288 else if (form == DW_FORM_strx3)
19293 else if (form == DW_FORM_strx4)
19301 info_ptr += bytes_read;
19307 error (_(
"Dwarf Error: Cannot handle %s in DWARF reader [in module %s]"),
19309 bfd_get_filename (abfd));
19314 attr->
form = DW_FORM_GNU_ref_alt;
19322 if (attr->
name == DW_AT_byte_size
19323 && form == DW_FORM_data4
19327 (_(
"Suspicious DW_AT_byte_size value treated as zero instead of %s"),
19337static const gdb_byte *
19340 const gdb_byte *info_ptr)
19353 LONGEST str_offset)
19356 str_offset,
"DW_FORM_strp");
19365 const gdb_byte *buf,
19367 unsigned int *bytes_read_ptr)
19369 LONGEST str_offset = cu_header->
read_offset (abfd, buf, bytes_read_ptr);
19378 unsigned int offset_size)
19381 ULONGEST str_offset =
read_offset (abfd, buf, offset_size);
19391 unsigned int *bytes_read_ptr)
19394 LONGEST str_offset = cu_header->
read_offset (abfd, buf, bytes_read_ptr);
19405 gdb::optional<ULONGEST> addr_base,
int addr_size)
19409 const gdb_byte *info_ptr;
19410 ULONGEST addr_base_or_zero = addr_base.has_value () ? *addr_base : 0;
19414 error (_(
"DW_FORM_addr_index used without .debug_addr section [in module %s]"),
19416 if (addr_base_or_zero + addr_index * addr_size
19418 error (_(
"DW_FORM_addr_index pointing outside of "
19419 ".debug_addr section [in module %s]"),
19422 + addr_index * addr_size);
19423 if (addr_size == 4)
19424 return bfd_get_32 (abfd, info_ptr);
19426 return bfd_get_64 (abfd, info_ptr);
19442 unsigned int *bytes_read)
19455 unsigned int addr_index)
19480 addr_size = cu->
header.addr_size;
19486 addr_size = reader.
cu->
header.addr_size;
19501 unsigned offset_size)
19507 const gdb_byte *info_ptr;
19508 ULONGEST str_offset;
19509 static const char form_name[] =
"DW_FORM_GNU_str_index or DW_FORM_strx";
19513 if (str_section->
buffer == NULL)
19514 error (_(
"%s used without %s section"
19515 " in CU at offset %s [in module %s]"),
19516 form_name, str_section->
get_name (),
19518 if (str_offsets_section->
buffer == NULL)
19519 error (_(
"%s used without %s section"
19520 " in CU at offset %s [in module %s]"),
19521 form_name, str_section->
get_name (),
19523 info_ptr = (str_offsets_section->
buffer
19525 + str_index * offset_size);
19526 if (offset_size == 4)
19527 str_offset = bfd_get_32 (abfd, info_ptr);
19529 str_offset = bfd_get_64 (abfd, info_ptr);
19530 if (str_offset >= str_section->
size)
19531 error (_(
"Offset from %s pointing outside of"
19532 " .debug_str.dwo section in CU at offset %s [in module %s]"),
19534 return (
const char *) (str_section->
buffer + str_offset);
19542 unsigned offset_size;
19543 ULONGEST str_offsets_base;
19544 if (reader->
cu->
header.version >= 5)
19549 unsigned int bytes_read = 0;
19557 const bool dwarf5_is_dwarf64 = bytes_read != 4;
19558 offset_size = dwarf5_is_dwarf64 ? 8 : 4;
19570 complaint (_(
"Section .debug_str_offsets in %s has unsupported"
19571 " version %d, use empty string."),
19579 str_offsets_base = bytes_read;
19586 str_offsets_base = 0;
19589 offset_size = reader->
cu->
header.offset_size;
19595 str_offsets_base, str_index, offset_size);
19605 static const char form_name[] =
"DW_FORM_GNU_str_index";
19606 static const char str_offsets_attr_name[] =
"DW_AT_str_offsets";
19609 error (_(
"%s used in Fission stub without %s"
19610 " in CU at offset 0x%lx [in module %s]"),
19611 form_name, str_offsets_attr_name,
19612 (
long) cu->
header.offset_size, objf_name);
19618 cu->
header.offset_size);
19626 const gdb_byte *begin = buf;
19632 if ((
byte & 128) == 0)
19633 return buf - begin;
19652 case DW_LANG_C_plus_plus:
19653 case DW_LANG_C_plus_plus_11:
19654 case DW_LANG_C_plus_plus_14:
19660 case DW_LANG_Fortran77:
19661 case DW_LANG_Fortran90:
19662 case DW_LANG_Fortran95:
19663 case DW_LANG_Fortran03:
19664 case DW_LANG_Fortran08:
19670 case DW_LANG_Mips_Assembler:
19673 case DW_LANG_Ada83:
19674 case DW_LANG_Ada95:
19677 case DW_LANG_Modula2:
19680 case DW_LANG_Pascal83:
19687 case DW_LANG_Rust_old:
19690 case DW_LANG_OpenCL:
19693 case DW_LANG_Cobol74:
19694 case DW_LANG_Cobol85:
19716 return &die->
attrs[i];
19717 if (die->
attrs[i].
name == DW_AT_specification
19718 || die->
attrs[i].
name == DW_AT_abstract_origin)
19719 spec = &die->
attrs[i];
19738 const char *
str = NULL;
19745 if (
str ==
nullptr)
19746 complaint (_(
"string type expected for attribute %s for "
19747 "DIE at %s in module %s"),
19761 if (dwo_name ==
nullptr)
19775 return attr !=
nullptr && attr->
as_boolean ();
19789 &&
dwarf2_attr (die, DW_AT_specification, cu) == NULL);
19804 if (spec_attr == NULL)
19805 spec_attr =
dwarf2_attr (die, DW_AT_abstract_origin, *spec_cu);
19807 if (spec_attr == NULL)
19849 const char *comp_dir)
19859 complaint (_(
"missing .debug_line.dwo section"));
19861 complaint (_(
"missing .debug_line section"));
19880 std::string &name_holder)
19882 const char *include_name = fe.
name;
19883 const char *include_name_to_compare = include_name;
19887 std::string hold_compare;
19888 if (!IS_ABSOLUTE_PATH (include_name)
19889 && (dir_name !=
nullptr || cu_info.
get_comp_dir () !=
nullptr))
19912 if (dir_name != NULL)
19914 name_holder = path_join (dir_name, include_name);
19915 include_name = name_holder.c_str ();
19916 include_name_to_compare = include_name;
19918 if (!IS_ABSOLUTE_PATH (include_name)
19921 hold_compare = path_join (cu_info.
get_comp_dir (), include_name);
19922 include_name_to_compare = hold_compare.c_str ();
19926 std::string copied_name;
19927 const char *cu_filename = cu_info.
get_name ();
19928 if (!IS_ABSOLUTE_PATH (cu_filename) && cu_info.
get_comp_dir () !=
nullptr)
19930 copied_name = path_join (cu_info.
get_comp_dir (), cu_filename);
19931 cu_filename = copied_name.c_str ();
19934 if (FILENAME_CMP (include_name_to_compare, cu_filename) == 0)
19936 return include_name;
19962 const gdb_byte *line_ptr,
19963 CORE_ADDR unrelocated_lowpc, CORE_ADDR address);
19975 address += baseaddr;
20015 m_flags &= ~LEF_PROLOGUE_END;
20036 if (line_delta != 0)
20091 CORE_ADDR addr_adj = (((
m_op_index + adjust)
20105 CORE_ADDR addr_adj = (((
m_op_index + adj_opcode_d)
20116 m_flags &= ~LEF_PROLOGUE_END;
20183 unsigned int line,
unsigned int last_line,
20184 int line_has_non_zero_discriminator,
20185 struct subfile *last_subfile)
20189 if (line != last_line)
20194 if (!line_has_non_zero_discriminator)
20204 unsigned int line, CORE_ADDR address,
20205 linetable_entry_flags
flags,
20213 "Recording line %u, file %s, address %s\n",
20229 CORE_ADDR address,
struct dwarf2_cu *cu)
20237 "Finishing current line, file %s, address %s\n",
20251 "Processing actual line %u: file %u,"
20252 " address %s, is_stmt %u, prologue_end %u, discrim %u%s\n",
20258 (end_sequence ?
"\t(end sequence)" :
""));
20287 bool ignore_this_line
20291 || (!end_sequence &&
m_line == 0));
20293 if ((file_changed && !ignore_this_line) || end_sequence)
20299 if (!end_sequence && !ignore_this_line)
20301 linetable_entry_flags lte_flags =
m_flags;
20355 const gdb_byte *line_ptr,
20356 CORE_ADDR unrelocated_lowpc, CORE_ADDR address)
20363 if ((address == 0 && address < unrelocated_lowpc)
20364 || address == (CORE_ADDR) -1)
20372 complaint (_(
".debug_line address at offset 0x%lx is 0 [in module %s]"),
20387 const gdb_byte *line_ptr, *extended_end;
20388 const gdb_byte *line_end;
20389 unsigned int bytes_read, extended_len;
20390 unsigned char op_code, extended_op;
20391 CORE_ADDR baseaddr;
20402 while (line_ptr < line_end)
20407 bool end_sequence =
false;
20417 while (line_ptr < line_end && !end_sequence)
20427 else switch (op_code)
20429 case DW_LNS_extended_op:
20432 line_ptr += bytes_read;
20433 extended_end = line_ptr + extended_len;
20436 if (DW_LNE_lo_user <= extended_op
20437 && extended_op <= DW_LNE_hi_user)
20440 line_ptr = extended_end;
20443 switch (extended_op)
20445 case DW_LNE_end_sequence:
20447 end_sequence =
true;
20449 case DW_LNE_set_address:
20452 = cu->
header.read_address (abfd, line_ptr, &bytes_read);
20453 line_ptr += bytes_read;
20456 lowpc - baseaddr, address);
20460 case DW_LNE_define_file:
20462 const char *cur_file;
20463 unsigned int mod_time, length;
20468 line_ptr += bytes_read;
20471 line_ptr += bytes_read;
20474 line_ptr += bytes_read;
20477 line_ptr += bytes_read;
20481 case DW_LNE_set_discriminator:
20491 line_ptr += bytes_read;
20497 complaint (_(
"mangled .debug_line section"));
20503 if (line_ptr != extended_end)
20505 complaint (_(
"mangled .debug_line section"));
20512 case DW_LNS_advance_pc:
20516 line_ptr += bytes_read;
20521 case DW_LNS_advance_line:
20525 line_ptr += bytes_read;
20530 case DW_LNS_set_file:
20535 line_ptr += bytes_read;
20540 case DW_LNS_set_column:
20542 line_ptr += bytes_read;
20544 case DW_LNS_negate_stmt:
20547 case DW_LNS_set_basic_block:
20554 case DW_LNS_const_add_pc:
20557 case DW_LNS_fixed_advance_pc:
20565 case DW_LNS_set_prologue_end:
20576 line_ptr += bytes_read;
20613 CORE_ADDR lowpc,
int decode_mapping)
20615 if (decode_mapping)
20629 if (sf->
symtab ==
nullptr)
20664 std::string filename_holder;
20665 const char *filename = fe.
name;
20675 if (!IS_ABSOLUTE_PATH (filename) &&
dirname != NULL)
20677 filename_holder = path_join (
dirname, filename);
20678 filename = filename_holder.c_str ();
20719 if ((
block->data[0] == DW_OP_addr
20721 || ((
block->data[0] == DW_OP_GNU_addr_index
20722 ||
block->data[0] == DW_OP_addrx)
20726 unsigned int dummy;
20728 if (
block->data[0] == DW_OP_addr)
20772 struct symbol *sym = NULL;
20776 CORE_ADDR baseaddr;
20777 struct pending **list_to_add = NULL;
20779 int inlined_func = (die->
tag == DW_TAG_inlined_subroutine);
20784 if (
name ==
nullptr && (die->
tag == DW_TAG_subprogram
20785 || die->
tag == DW_TAG_inlined_subroutine
20786 || die->
tag == DW_TAG_entry_point))
20791 int suppress_add = 0;
20803 const char *physname
20819 if (attr !=
nullptr)
20831 inlined_func ? DW_AT_call_line : DW_AT_decl_line,
20833 if (attr !=
nullptr)
20837 inlined_func ? DW_AT_call_file : DW_AT_decl_file,
20851 complaint (_(
"file index out of range"));
20860 if (attr !=
nullptr)
20875 case DW_TAG_subprogram:
20880 if ((attr2 !=
nullptr && attr2->
as_boolean ())
20897 case DW_TAG_inlined_subroutine:
20904 case DW_TAG_template_value_param:
20907 case DW_TAG_constant:
20908 case DW_TAG_variable:
20909 case DW_TAG_member:
20913 if (sym->
type ()->
code () == TYPE_CODE_VOID)
20919 if (die->
tag == DW_TAG_member)
20926 if (attr !=
nullptr)
20932 if (attr2 !=
nullptr && attr2->
as_boolean ())
20940 if (attr !=
nullptr)
20948 && die->
parent->
tag == DW_TAG_common_block)
20960 else if (attr2 !=
nullptr && attr2->
as_boolean ())
20974 if (found.
minsym !=
nullptr)
21002 && die->
parent->
tag == DW_TAG_common_block)
21009 else if (attr2 !=
nullptr && attr2->
as_boolean ()
21031 case DW_TAG_formal_parameter:
21040 if (curr !=
nullptr && curr->
name !=
nullptr)
21043 if (attr !=
nullptr)
21048 if (attr !=
nullptr)
21056 case DW_TAG_unspecified_parameters:
21061 case DW_TAG_template_type_param:
21064 case DW_TAG_class_type:
21065 case DW_TAG_interface_type:
21066 case DW_TAG_structure_type:
21067 case DW_TAG_union_type:
21068 case DW_TAG_set_type:
21069 case DW_TAG_enumeration_type:
21070 case DW_TAG_namelist:
21071 if (die->
tag == DW_TAG_namelist)
21115 case DW_TAG_typedef:
21120 case DW_TAG_array_type:
21121 case DW_TAG_base_type:
21122 case DW_TAG_subrange_type:
21123 case DW_TAG_generic_subrange:
21124 case DW_TAG_unspecified_type:
21129 case DW_TAG_enumerator:
21131 if (attr !=
nullptr)
21146 case DW_TAG_imported_declaration:
21147 case DW_TAG_namespace:
21151 case DW_TAG_module:
21156 case DW_TAG_common_block:
21175 list_to_add = NULL;
21178 if (list_to_add != NULL)
21203 enum bfd_endian byte_order = bfd_big_endian (
objfile->
obfd.get ()) ?
21204 BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
21209 l &= ((LONGEST) 1 <<
bits) - 1;
21216 gdb_byte *bytes = (gdb_byte *) obstack_alloc (obstack,
bits / 8);
21232 const char *
name,
struct obstack *obstack,
21234 LONGEST *
value,
const gdb_byte **bytes,
21241 enum bfd_endian byte_order = (bfd_big_endian (
objfile->
obfd.get ()) ?
21242 BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE);
21248 switch (attr->
form)
21251 case DW_FORM_addrx:
21252 case DW_FORM_GNU_addr_index:
21264 (*baton)->per_objfile = per_objfile;
21265 (*baton)->per_cu = cu->
per_cu;
21266 gdb_assert ((*baton)->per_cu);
21268 (*baton)->size = 2 + cu_header->
addr_size;
21269 data = (gdb_byte *) obstack_alloc (obstack, (*baton)->size);
21270 (*baton)->data =
data;
21272 data[0] = DW_OP_addr;
21278 case DW_FORM_string:
21281 case DW_FORM_GNU_str_index:
21282 case DW_FORM_GNU_strp_alt:
21285 *bytes = (
const gdb_byte *) attr->
as_string ();
21287 case DW_FORM_block1:
21288 case DW_FORM_block2:
21289 case DW_FORM_block4:
21290 case DW_FORM_block:
21291 case DW_FORM_exprloc:
21292 case DW_FORM_data16:
21297 *bytes = blk->
data;
21305 case DW_FORM_data1:
21308 case DW_FORM_data2:
21311 case DW_FORM_data4:
21314 case DW_FORM_data8:
21318 case DW_FORM_sdata:
21319 case DW_FORM_implicit_const:
21323 case DW_FORM_udata:
21328 complaint (_(
"unsupported const value attribute form: '%s'"),
21344 const gdb_byte *bytes;
21350 &
value, &bytes, &baton);
21357 else if (bytes != NULL)
21371static struct type *
21403static struct type *
21408 type_attr =
dwarf2_attr (die, DW_AT_GNAT_descriptive_type, cu);
21424 if (descriptive_type)
21434static struct type *
21440 type_attr =
dwarf2_attr (die, DW_AT_containing_type, cu);
21442 error (_(
"Dwarf Error: Problem turning containing type into gdb type "
21450static struct type *
21457 std::string message
21458 = string_printf (_(
"<unknown type in %s, CU %s, DIE %s>"),
21472static struct type *
21478 struct type *this_type;
21480 gdb_assert (attr->
name == DW_AT_type
21481 || attr->
name == DW_AT_GNAT_descriptive_type
21482 || attr->
name == DW_AT_containing_type);
21486 if (attr->
form == DW_FORM_GNU_ref_alt)
21501 else if (attr->
form == DW_FORM_ref_sig8)
21509 complaint (_(
"Dwarf Error: Bad type attribute %s in DIE"
21510 " at %s [in module %s]"),
21518 if (this_type == NULL)
21525 if (type_die == NULL)
21535 if (this_type == NULL)
21549static struct type *
21552 struct type *this_type;
21564static struct type *
21567 struct type *this_type = NULL;
21571 case DW_TAG_class_type:
21572 case DW_TAG_interface_type:
21573 case DW_TAG_structure_type:
21574 case DW_TAG_union_type:
21577 case DW_TAG_enumeration_type:
21580 case DW_TAG_subprogram:
21581 case DW_TAG_subroutine_type:
21582 case DW_TAG_inlined_subroutine:
21585 case DW_TAG_array_type:
21588 case DW_TAG_set_type:
21591 case DW_TAG_pointer_type:
21594 case DW_TAG_ptr_to_member_type:
21597 case DW_TAG_reference_type:
21600 case DW_TAG_rvalue_reference_type:
21603 case DW_TAG_const_type:
21606 case DW_TAG_volatile_type:
21609 case DW_TAG_restrict_type:
21612 case DW_TAG_string_type:
21615 case DW_TAG_typedef:
21618 case DW_TAG_generic_subrange:
21619 case DW_TAG_subrange_type:
21622 case DW_TAG_base_type:
21625 case DW_TAG_unspecified_type:
21628 case DW_TAG_namespace:
21631 case DW_TAG_module:
21634 case DW_TAG_atomic_type:
21638 complaint (_(
"unexpected tag in read_type_die: '%s'"),
21664 if (spec_die != NULL)
21670 for (child = die->
child;
21674 if (child->
tag == DW_TAG_subprogram)
21678 if (linkage_name != NULL)
21680 gdb::unique_xmalloc_ptr<char> actual_name
21682 const char *
name = NULL;
21684 if (actual_name != NULL)
21688 if (die_name != NULL
21689 && strcmp (die_name, actual_name.get ()) != 0)
21693 int die_name_len = strlen (die_name);
21694 int actual_name_len = strlen (actual_name.get ());
21695 const char *ptr = actual_name.get ();
21698 if (actual_name_len > die_name_len + 2
21699 && ptr[actual_name_len - die_name_len - 1] ==
':')
21700 name = obstack_strndup (
21702 ptr, actual_name_len - die_name_len - 2);
21723 if (die->
tag != DW_TAG_class_type && die->
tag != DW_TAG_interface_type
21724 && die->
tag != DW_TAG_structure_type && die->
tag != DW_TAG_union_type)
21731 const char *attr_name = attr->
as_string ();
21732 if (attr == NULL || attr_name == NULL)
21739 base = strrchr (attr_name,
':');
21740 if (base == NULL || base == attr_name || base[-1] !=
':')
21746 &base[-1] - attr_name);
21770 struct type *parent_type;
21771 const char *retval;
21805 if (spec_die == NULL)
21809 parent = spec_die->
parent;
21813 if (parent == NULL)
21818 const char *parent_name;
21851 complaint (_(
"template param type '%s' defined within parent '%s'"),
21853 parent_name ? parent_name :
"<unknown>");
21857 switch (parent->
tag)
21859 case DW_TAG_namespace:
21865 && strcmp (parent_type->
name (),
"::") == 0)
21868 return parent_type->
name ();
21869 case DW_TAG_class_type:
21870 case DW_TAG_interface_type:
21871 case DW_TAG_structure_type:
21872 case DW_TAG_union_type:
21873 case DW_TAG_module:
21875 if (parent_type->
name () != NULL)
21876 return parent_type->
name ();
21882 case DW_TAG_compile_unit:
21883 case DW_TAG_partial_unit:
21887 && die->
child != NULL
21888 && (die->
tag == DW_TAG_class_type
21889 || die->
tag == DW_TAG_structure_type
21890 || die->
tag == DW_TAG_union_type))
21897 case DW_TAG_subprogram:
21902 if ((die->
tag == DW_TAG_subprogram)
21907 case DW_TAG_enumeration_type:
21911 if (parent_type->
name () != NULL)
21912 return parent_type->
name ();
21927#define MAX_SEP_LEN 7
21933 const char *lead =
"";
21936 if (suffix == NULL || suffix[0] ==
'\0'
21943 if (strcmp (suffix,
"D main") == 0)
21964 if (suffix == NULL)
21973 strcpy (retval, lead);
21974 strcat (retval,
prefix);
21975 strcat (retval, sep);
21976 strcat (retval, suffix);
21982 return obconcat (obs, lead,
prefix, sep, suffix, (
char *) NULL);
21997 if (die->
parent ==
nullptr)
22002 size_t nth_unnamed = 0;
22005 while (child != die)
22007 gdb_assert (child !=
nullptr);
22008 if (child->
tag == DW_TAG_template_type_param
22009 || child->
tag == DW_TAG_template_value_param)
22011 if (
dwarf2_attr (child, DW_AT_name, cu) ==
nullptr)
22017 const std::string name_str =
"<unnamed" + std::to_string (nth_unnamed) +
">";
22027 if (
name ==
nullptr)
22032 gdb::unique_xmalloc_ptr<char> canon_name
22035 if (canon_name !=
nullptr)
22040 gdb::unique_xmalloc_ptr<char> canon_name
22043 if (canon_name !=
nullptr)
22060 const char *attr_name = attr ==
nullptr ? nullptr : attr->
as_string ();
22061 if (attr_name ==
nullptr
22062 && die->
tag != DW_TAG_namespace
22063 && die->
tag != DW_TAG_class_type
22064 && die->
tag != DW_TAG_interface_type
22065 && die->
tag != DW_TAG_structure_type
22066 && die->
tag != DW_TAG_namelist
22067 && die->
tag != DW_TAG_union_type
22068 && die->
tag != DW_TAG_template_type_param
22069 && die->
tag != DW_TAG_template_value_param)
22078 case DW_TAG_member:
22079 case DW_TAG_compile_unit:
22080 case DW_TAG_partial_unit:
22083 case DW_TAG_enumeration_type:
22084 case DW_TAG_enumerator:
22089 case DW_TAG_namespace:
22090 if (attr_name !=
nullptr)
22095 case DW_TAG_template_type_param:
22096 case DW_TAG_template_value_param:
22097 if (attr_name ==
nullptr)
22100 case DW_TAG_class_type:
22101 case DW_TAG_interface_type:
22102 case DW_TAG_structure_type:
22103 case DW_TAG_union_type:
22104 case DW_TAG_namelist:
22109 if (attr_name !=
nullptr
22110 && (startswith (attr_name,
"._")
22111 || startswith (attr_name,
"<anonymous")))
22116 if (!attr || attr_name == NULL)
22119 attr_name = attr ==
nullptr ? nullptr : attr->
as_string ();
22120 if (attr == NULL || attr_name == NULL)
22127 gdb::unique_xmalloc_ptr<char> demangled
22129 if (demangled ==
nullptr)
22139 const char *base = strrchr (attr_name,
':');
22140 if (base && base > attr_name && base[-1] ==
':')
22166 attr =
dwarf2_attr (die, DW_AT_extension, *ext_cu);
22178 gdb_printf (
f,
"%*sDie: %s (abbrev %d, offset %s)\n",
22183 if (die->
parent != NULL)
22204 case DW_FORM_addrx:
22205 case DW_FORM_GNU_addr_index:
22209 case DW_FORM_block2:
22210 case DW_FORM_block4:
22211 case DW_FORM_block:
22212 case DW_FORM_block1:
22216 case DW_FORM_exprloc:
22220 case DW_FORM_data16:
22223 case DW_FORM_ref_addr:
22227 case DW_FORM_GNU_ref_alt:
22235 case DW_FORM_ref_udata:
22239 case DW_FORM_data1:
22240 case DW_FORM_data2:
22241 case DW_FORM_data4:
22242 case DW_FORM_data8:
22243 case DW_FORM_udata:
22247 case DW_FORM_sec_offset:
22251 case DW_FORM_ref_sig8:
22255 case DW_FORM_string:
22257 case DW_FORM_line_strp:
22259 case DW_FORM_GNU_str_index:
22260 case DW_FORM_GNU_strp_alt:
22261 gdb_printf (
f,
"string: \"%s\" (%s canonicalized)",
22272 case DW_FORM_flag_present:
22275 case DW_FORM_indirect:
22279 "unexpected attribute form: DW_FORM_indirect");
22281 case DW_FORM_sdata:
22282 case DW_FORM_implicit_const:
22287 gdb_printf (
f,
"unsupported attribute form: %d.",
22304 int indent = level * 4;
22306 gdb_assert (die != NULL);
22308 if (level >= max_level)
22313 if (die->
child != NULL)
22316 if (level + 1 < max_level)
22324 " [not printed, max nesting level reached]\n");
22328 if (die->
sibling != NULL && level > 0)
22348 slot = htab_find_slot_with_hash (cu->
die_hash, die,
22367 else if (
attr->
form == DW_FORM_ref_sig8)
22372 error (_(
"Dwarf Error: Expected reference attribute [in module %s]"),
22389 struct dwarf2_cu *target_cu, *cu = *ref_cu;
22392 gdb_assert (cu->
per_cu != NULL);
22397 "source CU contains target offset: %d",
22400 cu->
header.offset_in_cu_p (sect_off));
22407 if (!cu->
header.offset_in_cu_p (sect_off))
22411 || !cu->
header.offset_in_cu_p (sect_off))
22419 "target CU DIEs loaded: %d",
22421 per_objfile->
get_cu (per_cu) !=
nullptr);
22429 || per_objfile->
get_cu (per_cu) ==
nullptr)
22431 false, cu->
lang ());
22433 target_cu = per_objfile->
get_cu (per_cu);
22434 gdb_assert (target_cu !=
nullptr);
22436 else if (cu->
dies == NULL)
22443 *ref_cu = target_cu;
22464 (
attr->
form == DW_FORM_GNU_ref_alt
22468 error (_(
"Dwarf Error: Cannot find DIE at %s referenced from DIE "
22469 "at %s [in module %s]"),
22483 bool resolve_abstract_p)
22490 dwarf2_cu *cu = per_objfile->get_cu (per_cu);
22492 cu =
load_cu (per_cu, per_objfile,
false);
22498 error (_(
"Dwarf Error: Dummy CU at %s referenced in module %s"),
22504 error (_(
"Dwarf Error: Cannot find DIE at %s referenced in module %s"),
22508 if (!attr && resolve_abstract_p
22509 && (per_objfile->per_bfd->abstract_to_concrete.find (die->
sect_off)
22510 != per_objfile->per_bfd->abstract_to_concrete.end ()))
22516 for (
const auto &cand_off
22517 : per_objfile->per_bfd->abstract_to_concrete[die->
sect_off])
22524 || cand->
parent->
tag != DW_TAG_subprogram)
22527 CORE_ADDR pc_low, pc_high;
22529 if (pc_low == ((CORE_ADDR) -1))
22533 if (!(pc_low <= pc && pc < pc_high))
22547 retval.
data = NULL;
22565 error (_(
"Dwarf Error: DIE at %s referenced in module %s "
22566 "is neither DW_FORM_block* nor DW_FORM_exprloc"),
22576 per_objfile->age_comp_units ();
22589 sect_offset sect_off =
per_cu->
sect_off + to_underlying (offset_in_cu);
22598static const gdb_byte *
22600 enum bfd_endian byte_order,
22608 result = (gdb_byte *) obstack_alloc (obstack, *len);
22625 const gdb_byte *result = NULL;
22628 enum bfd_endian byte_order;
22633 cu =
load_cu (per_cu, per_objfile,
false);
22639 error (_(
"Dwarf Error: Dummy CU at %s referenced in module %s"),
22645 error (_(
"Dwarf Error: Cannot find DIE at %s referenced in module %s"),
22652 byte_order = (bfd_big_endian (
objfile->
obfd.get ())
22653 ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE);
22655 switch (attr->
form)
22658 case DW_FORM_addrx:
22659 case DW_FORM_GNU_addr_index:
22663 *len = cu->
header.addr_size;
22664 tem = (gdb_byte *) obstack_alloc (obstack, *len);
22669 case DW_FORM_string:
22672 case DW_FORM_GNU_str_index:
22673 case DW_FORM_GNU_strp_alt:
22677 const char *attr_name = attr->
as_string ();
22678 result = (
const gdb_byte *) attr_name;
22679 *len = strlen (attr_name);
22682 case DW_FORM_block1:
22683 case DW_FORM_block2:
22684 case DW_FORM_block4:
22685 case DW_FORM_block:
22686 case DW_FORM_exprloc:
22687 case DW_FORM_data16:
22690 result =
block->data;
22691 *len =
block->size;
22700 case DW_FORM_data1:
22703 if (result == NULL)
22707 case DW_FORM_data2:
22710 if (result == NULL)
22714 case DW_FORM_data4:
22717 if (result == NULL)
22721 case DW_FORM_data8:
22724 if (result == NULL)
22729 case DW_FORM_sdata:
22730 case DW_FORM_implicit_const:
22736 case DW_FORM_udata:
22743 complaint (_(
"unsupported const value attribute form: '%s'"),
22757 const char **var_name)
22763 cu =
load_cu (per_cu, per_objfile,
false);
22772 if (var_name !=
nullptr)
22784 sect_offset die_offset_sect = per_cu->
sect_off + to_underlying (die_offset);
22814 || per_objfile->
get_cu (sig_type) ==
nullptr)
22817 sig_cu = per_objfile->
get_cu (sig_type);
22818 gdb_assert (sig_cu != NULL);
22821 die = (
struct die_info *) htab_find_with_hash (sig_cu->
die_hash, &temp_die,
22822 to_underlying (temp_die.
sect_off));
22830 (*ref_cu)->per_cu->imported_symtabs_push (sig_cu->
per_cu);
22854 gdb_assert (
attr->
form == DW_FORM_ref_sig8);
22859 if (sig_type == NULL)
22861 error (_(
"Dwarf Error: Cannot find signatured DIE %s referenced"
22862 " from DIE at %s [in module %s]"),
22871 error (_(
"Dwarf Error: Problem reading signatured DIE %s referenced"
22872 " from DIE at %s [in module %s]"),
22883static struct type *
22896 if (sig_type == NULL)
22898 complaint (_(
"Dwarf Error: Cannot find signatured DIE %s referenced"
22899 " from DIE at %s [in module %s]"),
22907 if (
type !=
nullptr)
22912 if (type_die != NULL)
22920 complaint (_(
"Dwarf Error: Cannot build signatured type %s"
22921 " referenced from DIE at %s [in module %s]"),
22929 complaint (_(
"Dwarf Error: Problem reading signatured DIE %s referenced"
22930 " from DIE at %s [in module %s]"),
22944static struct type *
22956 else if (
attr->
form == DW_FORM_ref_sig8)
22964 complaint (_(
"Dwarf Error: DW_AT_signature has bad form %s in DIE"
22965 " at %s [in module %s]"),
22985 gdb_assert (per_objfile->
get_cu (per_cu) ==
nullptr);
22989 gdb_assert (per_objfile->
get_cu (per_cu) !=
nullptr);
23001 gdb_assert (per_objfile->
get_cu (sig_type) ==
nullptr);
23003 cutu_reader reader (sig_type, per_objfile,
nullptr,
nullptr,
false);
23008 const gdb_byte *info_ptr = reader.
info_ptr;
23010 gdb_assert (cu->
die_hash == NULL);
23012 htab_create_alloc_ex (cu->
header.length / 12,
23017 hashtab_obstack_allocate,
23018 dummy_obstack_deallocate);
23054 const gdb_byte *data = blk->
data;
23055 CORE_ADDR stack[64];
23057 unsigned int bytes_read, unsnd;
23060 if (computed !=
nullptr)
23066 stack[++stacki] = 0;
23105 stack[++stacki] = op - DW_OP_lit0;
23140 stack[++stacki] = op - DW_OP_reg0;
23143 if (computed ==
nullptr)
23153 stack[++stacki] = unsnd;
23156 if (computed ==
nullptr)
23170 case DW_OP_const1u:
23175 case DW_OP_const1s:
23180 case DW_OP_const2u:
23185 case DW_OP_const2s:
23190 case DW_OP_const4u:
23195 case DW_OP_const4s:
23200 case DW_OP_const8u:
23217 stack[stacki + 1] = stack[stacki];
23222 stack[stacki - 1] += stack[stacki];
23226 case DW_OP_plus_uconst:
23233 stack[stacki - 1] -= stack[stacki];
23244 if (computed ==
nullptr)
23251 case DW_OP_GNU_push_tls_address:
23252 case DW_OP_form_tls_address:
23263 if (computed ==
nullptr)
23271 case DW_OP_GNU_uninit:
23272 if (computed !=
nullptr)
23277 case DW_OP_GNU_addr_index:
23278 case DW_OP_GNU_const_index:
23285 if (computed ==
nullptr)
23287 const char *
name = get_DW_OP_name (op);
23290 complaint (_(
"unsupported stack op: '%s'"),
23293 complaint (_(
"unsupported stack op: '%02x'"),
23297 return (stack[stacki]);
23302 if (stacki >= ARRAY_SIZE (stack) - 1)
23304 if (computed ==
nullptr)
23305 complaint (_(
"location description stack overflow"));
23311 if (computed ==
nullptr)
23312 complaint (_(
"location description stack underflow"));
23317 if (computed !=
nullptr)
23319 return (stack[stacki]);
23340 memset (die, 0,
sizeof (
struct die_info));
23353 int section_is_gnu)
23358 unsigned int offset_size = cu->
header.offset_size;
23360 const char *section_name;
23364 if (section_is_gnu)
23367 section_name =
".debug_macro.dwo";
23372 section_name =
".debug_macinfo.dwo";
23377 if (section_is_gnu)
23380 section_name =
".debug_macro";
23385 section_name =
".debug_macinfo";
23390 if (
section->buffer ==
nullptr)
23392 complaint (_(
"missing %s section"), section_name);
23400 gdb::optional<ULONGEST> str_offsets_base;
23407 str_offsets_base = cu->
header.addr_size;
23417 offset_size, offset, str_section, str_offsets_section,
23418 str_offsets_base, section_is_gnu, cu);
23443 if (cu->
header.version < 5)
23444 error (_(
".debug_rnglists section cannot be used in DWARF %d"),
23454 && tag != DW_TAG_compile_unit
23455 && tag != DW_TAG_skeleton_unit)
23462 error (_(
".debug_rnglists section is missing from .dwo file."));
23481 gdb_assert (baton->
per_cu);
23514 complaint (_(
"Location list used without "
23515 "specifying the CU base address."));
23529 gdb_assert (baton->
per_cu);
23563 const gdb_byte *info_ptr
23614 (sect_offset sect_off,
23615 unsigned int offset_in_dwz,
23616 const std::vector<dwarf2_per_cu_data_up> &all_units)
23621 high = all_units.size () - 1;
23625 int mid = low + (high - low) / 2;
23627 mid_cu = all_units[mid].get ();
23628 if (mid_cu->
is_dwz > offset_in_dwz
23629 || (mid_cu->
is_dwz == offset_in_dwz
23635 gdb_assert (low == high);
23644 unsigned int offset_in_dwz,
23653 if (low == 0 || this_cu->
is_dwz != offset_in_dwz)
23654 error (_(
"Dwarf Error: could not find partial DIE containing "
23655 "offset %s [in module %s]"),
23676namespace find_containing_comp_unit {
23691 two->sect_off = sect_offset (one->length ());
23692 two->set_length (7);
23694 three->set_length (5);
23696 four->sect_off = sect_offset (three->length ());
23697 four->set_length (7);
23700 std::vector<dwarf2_per_cu_data_up> units;
23701 units.push_back (std::move (one));
23702 units.push_back (std::move (two));
23703 units.push_back (std::move (three));
23704 units.push_back (std::move (four));
23709 SELF_CHECK (units[result].
get () == one_ptr);
23711 SELF_CHECK (units[result].
get () == one_ptr);
23713 SELF_CHECK (units[result].
get () == two_ptr);
23716 SELF_CHECK (units[result].
get () == three_ptr);
23718 SELF_CHECK (units[result].
get () == three_ptr);
23720 SELF_CHECK (units[result].
get () == four_ptr);
23739 attr =
dwarf2_attr (comp_unit_die, DW_AT_language, cu);
23742 && strstr (cu->
producer,
"IBM XL C for OpenCL") != NULL)
23751 && strstr (cu->
producer,
"GNU Go ") != NULL)
23756 else if (attr !=
nullptr)
23759 lang = pretend_language;
23763 switch (comp_unit_die->
tag)
23765 case DW_TAG_compile_unit:
23768 case DW_TAG_partial_unit:
23771 case DW_TAG_type_unit:
23775 error (_(
"Dwarf Error: unexpected tag '%s' at offset %s"),
23792 return it->second.get ();
23799 std::unique_ptr<dwarf2_cu> cu)
23801 gdb_assert (this->
get_cu (per_cu) ==
nullptr);
23818 gdb_assert (!
queue.has_value ());
23822 pair.second->clear_mark ();
23932static struct type *
23934 bool skip_data_location)
23950 &&
type->
code () != TYPE_CODE_FUNC
23952 &&
type->
code () != TYPE_CODE_METHODPTR
23953 &&
type->
code () != TYPE_CODE_MEMBERPTR
23954 &&
type->
code () != TYPE_CODE_METHOD
23955 &&
type->
code () != TYPE_CODE_FIXED_POINT
23987 if (!skip_data_location)
23989 attr =
dwarf2_attr (die, DW_AT_data_location, cu);
23996 = htab_up (htab_create_alloc (127,
24005 htab_find_slot (per_objfile->
die_type_hash.get (), &ofs, INSERT);
24007 complaint (_(
"A problem internal to GDB: DIE %s has type already set"),
24018static struct type *
24041static struct type *
24055 _(
"Whether to check \"physname\" is %s.\n"),
24065Set DWARF specific variables.\n\
24066Configure DWARF variables such as the cache size."),
24068Show DWARF specific variables.\n\
24069Show DWARF variables such as the cache size."),
24075Set the upper bound on the age of cached DWARF compilation units."), _(
"\
24076Show the upper bound on the age of cached DWARF compilation units."), _(
"\
24077A higher limit means that cached compilation units will be stored\n\
24078in memory longer, and more total memory will be used. Zero disables\n\
24079caching, which can slow down startup."),
24086Set debugging of the DWARF reader."), _(
"\
24087Show debugging of the DWARF reader."), _(
"\
24088When enabled (non-zero), debugging messages are printed during DWARF\n\
24089reading and symtab expansion. A value of 1 (one) provides basic\n\
24090information. A value greater than 1 provides more verbose information."),
24096Set debugging of the DWARF DIE reader."), _(
"\
24097Show debugging of the DWARF DIE reader."), _(
"\
24098When enabled (non-zero), DIEs are dumped after they are read in.\n\
24099The value is the maximum depth to print."),
24105Set debugging of the dwarf line reader."), _(
"\
24106Show debugging of the dwarf line reader."), _(
"\
24107When enabled (non-zero), line number entries are dumped as they are read in.\n\
24108A value of 1 (one) provides basic information.\n\
24109A value greater than 1 provides more verbose information."),
24115Set cross-checking of \"physname\" code against demangler."), _(
"\
24116Show cross-checking of \"physname\" code against demangler."), _(
"\
24117When enabled, GDB's internal \"physname\" code is checked against\n\
24124Set whether to use deprecated gdb_index sections."), _(
"\
24125Show whether to use deprecated gdb_index sections."), _(
"\
24126When enabled, deprecated .gdb_index sections are used anyway.\n\
24127Normally they are ignored either because of a missing feature or\n\
24128performance issue.\n\
24129Warning: This option must be enabled before gdb reads the file."),
24145 selftests::register_test (
"dw2_expand_symtabs_matching",
24146 selftests::dw2_expand_symtabs_matching::run_test);
24147 selftests::register_test (
"dwarf2_find_containing_comp_unit",
24148 selftests::find_containing_comp_unit::run_test);
constexpr string_view get()
#define bits(obj, st, fn)
bool operator==(const aarch64_features &lhs, const aarch64_features &rhs)
std::unique_ptr< struct abbrev_table > abbrev_table_up
static struct cache_entry ** find_entry(const char *name, domain_enum domain)
gdb_static_assert(sizeof(splay_tree_key) >=sizeof(CORE_ADDR *))
void * xcalloc(size_t number, size_t size)
struct blockranges * make_blockranges(struct objfile *objfile, const std::vector< blockrange > &rangevec)
void block_set_scope(struct block *block, const char *scope, struct obstack *obstack)
int blockvector_contains_pc(const struct blockvector *bv, CORE_ADDR pc)
const struct bfd_build_id * build_id_bfd_get(bfd *abfd)
void add_symbol_to_list(struct symbol *symbol, struct pending **listhead)
gdb::unique_xmalloc_ptr< char > c_canonicalize_name(const char *name)
void c_type_print_args(struct type *type, struct ui_file *stream, int linkage_name, enum language language, const struct type_print_options *flags)
abbrev_table * find(struct dwarf2_section_info *section, sect_offset offset)
void add(abbrev_table_up table)
bool operator==(const all_units_iterator &other) const
dwarf2_per_cu_data * operator*() const
all_units_iterator & operator++()
dwarf2_per_bfd * m_per_bfd
bool operator!=(const all_units_iterator &other) const
all_units_iterator(dwarf2_per_bfd *per_bfd, bool start)
dwarf2_per_bfd * m_per_bfd
all_units_iterator begin()
all_units_range(dwarf2_per_bfd *per_bfd)
cutu_reader * preserve(std::unique_ptr< cutu_reader > reader)
DISABLE_COPY_AND_ASSIGN(cooked_index_storage)
static int eq_cutu_reader(const void *a, const void *b)
const cooked_index_entry * add(sect_offset die_offset, enum dwarf_tag tag, cooked_index_flag flags, const char *name, const cooked_index_entry *parent_entry, dwarf2_per_cu_data *per_cu)
addrmap_mutable * get_addrmap()
addrmap_mutable m_addrmap
static hashval_t hash_cutu_reader(const void *a)
abbrev_cache * get_abbrev_cache()
std::unique_ptr< cooked_index > m_index
abbrev_cache m_abbrev_cache
std::unique_ptr< cooked_index > release()
cutu_reader * get_reader(dwarf2_per_cu_data *per_cu)
dwarf2_per_cu_data * lookup(CORE_ADDR addr)
const cooked_index_entry * get_main() const
quick_symbol_functions_up make_quick_functions() const override
range find(const std::string &name, bool completing)
void check_bounds(cutu_reader *reader)
addrmap_mutable m_die_range_map
cutu_reader * ensure_cu_exists(cutu_reader *reader, dwarf2_per_objfile *per_objfile, sect_offset sect_off, bool is_dwz, bool for_scanning)
cooked_indexer(cooked_index_storage *storage, dwarf2_per_cu_data *per_cu, enum language language)
const gdb_byte * scan_attributes(dwarf2_per_cu_data *scanning_per_cu, cutu_reader *reader, const gdb_byte *watermark_ptr, const gdb_byte *info_ptr, const abbrev_info *abbrev, const char **name, const char **linkage_name, cooked_index_flag *flags, sect_offset *sibling_offset, const cooked_index_entry **parent_entry, CORE_ADDR *maybe_defer, bool for_specification)
const gdb_byte * recurse(cutu_reader *reader, const gdb_byte *info_ptr, const cooked_index_entry *parent_entry, bool fully)
DISABLE_COPY_AND_ASSIGN(cooked_indexer)
dwarf2_per_cu_data * m_per_cu
const gdb_byte * index_imported_unit(cutu_reader *reader, const gdb_byte *info_ptr, const abbrev_info *abbrev)
std::vector< deferred_entry > m_deferred_entries
CORE_ADDR form_addr(sect_offset offset, bool is_dwz)
void make_index(cutu_reader *reader)
const gdb_byte * index_dies(cutu_reader *reader, const gdb_byte *info_ptr, const cooked_index_entry *parent_entry, bool fully)
cooked_index_storage * m_index_storage
std::unique_ptr< dwarf2_cu > m_new_cu
struct die_info * comp_unit_die
struct dwarf2_per_cu_data * m_this_cu
cutu_reader(dwarf2_per_cu_data *this_cu, dwarf2_per_objfile *per_objfile, struct abbrev_table *abbrev_table, dwarf2_cu *existing_cu, bool skip_partial, abbrev_cache *cache=nullptr)
abbrev_table_up m_abbrev_table_holder
DISABLE_COPY_AND_ASSIGN(cutu_reader)
void init_tu_and_read_dwo_dies(dwarf2_per_cu_data *this_cu, dwarf2_per_objfile *per_objfile, dwarf2_cu *existing_cu)
const gdb_byte * info_ptr
cutu_reader(cutu_reader &&)=default
abbrev_table_up m_dwo_abbrev_table
abbrev_table_up release_abbrev_table()
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)
dwarf2_queue_guard(dwarf2_per_objfile *per_objfile)
dwarf2_per_objfile * m_per_objfile
DISABLE_COPY_AND_ASSIGN(dwarf2_queue_guard)
bool seen(const char *file)
free_cached_comp_units(dwarf2_per_objfile *per_objfile)
DISABLE_COPY_AND_ASSIGN(free_cached_comp_units)
dwarf2_per_objfile * m_per_objfile
~free_cached_comp_units()
gdb::array_view< const gdb_byte > lookup_gdb_index(const bfd_build_id *build_id, std::unique_ptr< index_cache_resource > *resource)
void store(dwarf2_per_objfile *per_objfile)
void handle_set_address(CORE_ADDR baseaddr, CORE_ADDR address)
unsigned int m_discriminator
void handle_set_prologue_end()
void check_line_address(struct dwarf2_cu *cu, const gdb_byte *line_ptr, CORE_ADDR unrelocated_lowpc, CORE_ADDR address)
lnp_state_machine(struct dwarf2_cu *cu, gdbarch *arch, line_header *lh)
bool m_line_has_non_zero_discriminator
bool m_currently_recording_lines
void handle_advance_pc(CORE_ADDR adjust)
void handle_negate_stmt()
void record_line(bool end_sequence)
linetable_entry_flags m_flags
void handle_set_discriminator(unsigned int discriminator)
void advance_line(int line_delta)
void handle_fixed_advance_pc(CORE_ADDR addr_adj)
struct subfile * m_last_subfile
void handle_special_opcode(unsigned char op_code)
void handle_advance_line(int line_delta)
void handle_end_sequence()
line_header * m_line_header
void handle_set_file(file_name_index file)
file_entry * current_file()
void handle_const_add_pc()
std::vector< gdb::string_view > split_name(language lang) const
const char * language_lookup_name(language lang) const
symbol_name_match_type match_type() const
lookup_name_info make_ignore_params() const
bool completion_mode() const
offset_type operator[](size_t index) const
offset_view(gdb::array_view< const gdb_byte > bytes)
gdb::array_view< const gdb_byte > m_bytes
process_die_scope(die_info *die, dwarf2_cu *cu)
void set(unsigned key, void *datum)
const std::string & string()
virtual void puts(const char *str)
struct cmd_list_element * showlist
struct cmd_list_element * setlist
struct cmd_list_element * showdebuglist
struct cmd_list_element * setdebuglist
struct cmd_list_element * maintenance_show_cmdlist
struct cmd_list_element * maintenance_set_cmdlist
set_show_commands add_setshow_zinteger_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
set_show_commands add_setshow_prefix_cmd(const char *name, command_class theclass, const char *set_doc, const char *show_doc, cmd_list_element **set_subcommands_list, cmd_list_element **show_subcommands_list, cmd_list_element **set_list, cmd_list_element **show_list)
set_show_commands add_setshow_boolean_cmd(const char *name, enum command_class theclass, bool *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
set_show_commands add_setshow_zuinteger_cmd(const char *name, enum command_class theclass, unsigned int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
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)
const gdb_byte * read_comp_unit_head(struct comp_unit_head *cu_header, const gdb_byte *info_ptr, struct dwarf2_section_info *section, rcuh_kind section_kind)
#define complaint(FMT,...)
static bool have_complaint()
bool language_requires_canonicalization(enum language lang)
void cp_scan_for_anonymous_namespaces(struct buildsym_compunit *compunit, const struct symbol *const symbol, struct objfile *const objfile)
gdb::unique_xmalloc_ptr< char > gdb_demangle(const char *name, int options)
gdb::unique_xmalloc_ptr< char > cp_remove_params(const char *demangled_name)
unsigned int cp_find_first_component(const char *name)
gdb::unique_xmalloc_ptr< char > cp_canonicalize_string(const char *string)
#define CP_ANONYMOUS_NAMESPACE_STR
std::string debug_file_directory
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
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)
void exception_print(struct ui_file *file, const struct gdb_exception &e)
const gdb_byte * safe_skip_leb128(const gdb_byte *buf, const gdb_byte *buf_end)
int dwarf_block_to_sp_offset(struct gdbarch *gdbarch, const gdb_byte *buf, const gdb_byte *buf_end, CORE_ADDR *sp_offset_return)
const gdb_byte * safe_read_uleb128(const gdb_byte *buf, const gdb_byte *buf_end, uint64_t *r)
int dwarf_block_to_dwarf_reg(const gdb_byte *buf, const gdb_byte *buf_end)
static const gdb_byte * gdb_read_uleb128(const gdb_byte *buf, const gdb_byte *buf_end, uint64_t *r)
CORE_ADDR get_frame_pc(frame_info_ptr frame)
bool is_cplus_marker(int c)
int gdb_bfd_requires_relocations(bfd *abfd)
void gdb_bfd_record_inclusion(bfd *includer, bfd *includee)
gdb_bfd_ref_ptr gdb_bfd_open(const char *name, const char *target, int fd, bool warn_if_slow)
gdb::ref_ptr< struct bfd, gdb_bfd_ref_policy > gdb_bfd_ref_ptr
static gdb_bfd_section_range gdb_bfd_sections(bfd *abfd)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
bool gdbarch_address_class_type_flags_p(struct gdbarch *gdbarch)
const struct floatformat ** gdbarch_floatformat_for_type(struct gdbarch *gdbarch, const char *name, int length)
void gdbarch_make_symbol_special(struct gdbarch *gdbarch, struct symbol *sym, struct objfile *objfile)
CORE_ADDR gdbarch_adjust_dwarf2_line(struct gdbarch *gdbarch, CORE_ADDR addr, int rel)
CORE_ADDR gdbarch_adjust_dwarf2_addr(struct gdbarch *gdbarch, CORE_ADDR pc)
CORE_ADDR gdbarch_addr_bits_remove(struct gdbarch *gdbarch, CORE_ADDR addr)
type_instance_flags gdbarch_address_class_type_flags(struct gdbarch *gdbarch, int byte_size, int dwarf2_addr_class)
void set_type_vptr_basetype(struct type *type, struct type *basetype)
void set_type_vptr_fieldno(struct type *type, int fieldno)
struct type * create_string_type(struct type *result_type, struct type *string_char_type, struct type *range_type)
struct type * make_restrict_type(struct type *type)
struct type * lookup_pointer_type(struct type *type)
struct type * lookup_methodptr_type(struct type *to_type)
bool set_type_align(struct type *type, ULONGEST align)
struct type * init_decfloat_type(struct objfile *objfile, int bit, const char *name)
struct type * create_array_type_with_stride(struct type *result_type, struct type *element_type, struct type *range_type, struct dynamic_prop *byte_stride_prop, unsigned int bit_stride)
struct type * init_type(struct objfile *objfile, enum type_code code, int bit, const char *name)
struct type * init_fixed_point_type(struct objfile *objfile, int bit, int unsigned_p, const char *name)
struct type * make_cv_type(int cnst, int voltl, struct type *type, struct type **typeptr)
struct type * lookup_function_type(struct type *type)
struct type * make_type_with_address_space(struct type *type, type_instance_flags space_flag)
struct type * lookup_reference_type(struct type *type, enum type_code refcode)
void smash_to_method_type(struct type *type, struct type *self_type, struct type *to_type, struct field *args, int nargs, int varargs)
void smash_to_methodptr_type(struct type *type, struct type *to_type)
struct type * lookup_memberptr_type(struct type *type, struct type *domain)
struct type * init_pointer_type(struct objfile *objfile, int bit, const char *name, struct type *target_type)
unsigned type_align(struct type *type)
struct type * create_range_type_with_stride(struct type *result_type, struct type *index_type, const struct dynamic_prop *low_bound, const struct dynamic_prop *high_bound, LONGEST bias, const struct dynamic_prop *stride, bool byte_stride_p)
struct type * alloc_type(struct objfile *objfile)
struct type * init_complex_type(const char *name, struct type *target_type)
struct type * init_float_type(struct objfile *objfile, int bit, const char *name, const struct floatformat **floatformats, enum bfd_endian byte_order)
struct type * create_static_range_type(struct type *result_type, struct type *index_type, LONGEST low_bound, LONGEST high_bound)
struct type * init_character_type(struct objfile *objfile, int bit, int unsigned_p, const char *name)
struct type * create_set_type(struct type *result_type, struct type *domain_type)
struct type * init_boolean_type(struct objfile *objfile, int bit, int unsigned_p, const char *name)
struct type * make_atomic_type(struct type *type)
struct type * create_range_type(struct type *result_type, struct type *index_type, const struct dynamic_prop *low_bound, const struct dynamic_prop *high_bound, LONGEST bias)
struct type * init_integer_type(struct objfile *objfile, int bit, int unsigned_p, const char *name)
struct type * copy_type(const struct type *type)
struct type * check_typedef(struct type *type)
void make_vector_type(struct type *array_type)
@ TYPE_SPECIFIC_FIXED_POINT
#define TYPE_ZALLOC(t, size)
#define TYPE_FN_FIELD_PHYSNAME(thisfn, n)
#define TYPE_NFN_FIELDS(thistype)
#define TYPE_CPLUS_DYNAMIC(thistype)
#define TYPE_DESCRIPTIVE_TYPE(thistype)
#define TYPE_FN_FIELDLIST(thistype, n)
#define TYPE_TEMPLATE_ARGUMENTS(thistype)
#define TYPE_NESTED_TYPES_COUNT(thistype)
#define TYPE_FIELD_VIRTUAL_BITS(thistype)
#define ALLOCATE_CPLUS_STRUCT_TYPE(type)
#define TYPE_FIELD_PRIVATE_BITS(thistype)
#define SET_TYPE_FIELD_PROTECTED(thistype, n)
#define TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL
#define TYPE_MAIN_TYPE(thistype)
#define FIELD_ARTIFICIAL(thisfld)
#define TYPE_FN_FIELDLISTS(thistype)
#define TYPE_NESTED_TYPES_FIELD(thistype, n)
#define TYPE_FN_FIELD_VOLATILE(thisfn, n)
#define ALLOCATE_GNAT_AUX_TYPE(type)
#define TYPE_CALLING_CONVENTION(thistype)
static char * sect_offset_str(sect_offset offset)
#define TYPE_FN_FIELDLIST_LENGTH(thistype, n)
#define TYPE_N_TEMPLATE_ARGUMENTS(thistype)
#define TYPE_VPTR_FIELDNO(thistype)
#define TYPE_FIELD_ARTIFICIAL(thistype, n)
#define TYPE_TAIL_CALL_LIST(thistype)
#define TYPE_RAW_ALIGN(thistype)
#define TYPE_SPECIFIC_FIELD(thistype)
#define TYPE_NO_RETURN(thistype)
#define TYPE_TEMPLATE_ARGUMENT(thistype, n)
#define TYPE_TYPEDEF_FIELD(thistype, n)
#define INIT_GNAT_SPECIFIC(type)
@ CALL_SITE_PARAMETER_FB_OFFSET
@ CALL_SITE_PARAMETER_DWARF_REG
@ CALL_SITE_PARAMETER_PARAM_OFFSET
#define INIT_CPLUS_SPECIFIC(type)
#define TYPE_CPLUS_CALLING_CONVENTION(thistype)
#define TYPE_TYPEDEF_FIELD_COUNT(thistype)
#define TYPE_FN_FIELDLIST_NAME(thistype, n)
#define TYPE_NESTED_TYPES_ARRAY(thistype)
#define TYPE_FIELD_PROTECTED_BITS(thistype)
#define TYPE_ALLOC(t, size)
#define TYPE_TYPEDEF_FIELD_ARRAY(thistype)
#define SET_TYPE_FIELD_PRIVATE(thistype, n)
#define TYPE_N_BASECLASSES(thistype)
#define HAVE_GNAT_AUX_INFO(type)
#define TYPE_FN_FIELD_CONST(thisfn, n)
#define SET_TYPE_FIELD_VIRTUAL(thistype, n)
#define TYPE_FIELD_IGNORE_BITS(thistype)
#define FIELD_BITSIZE(thisfld)
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
char * go_symbol_package_name(const struct symbol *sym)
index_cache global_index_cache
uint32_t dwarf5_djb_hash(const char *str_)
const struct language_defn * language_def(enum language lang)
const struct language_defn * current_language
struct type * language_string_char_type(const struct language_defn *la, struct gdbarch *gdbarch)
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)
LONGEST read_offset(bfd *abfd, const gdb_byte *buf, unsigned int offset_size)
static unsigned int read_4_bytes(bfd *abfd, const gdb_byte *buf)
static const char * read_direct_string(bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read_ptr)
static int read_4_signed_bytes(bfd *abfd, const gdb_byte *buf)
static unsigned int read_1_byte(bfd *abfd, const gdb_byte *buf)
static unsigned int read_3_bytes(bfd *abfd, const gdb_byte *buf)
static int read_1_signed_byte(bfd *abfd, const gdb_byte *buf)
static unsigned int read_2_bytes(bfd *abfd, const gdb_byte *buf)
static int read_2_signed_bytes(bfd *abfd, const gdb_byte *buf)
static const gdb_byte * read_n_bytes(bfd *abfd, const gdb_byte *buf, unsigned int size)
static ULONGEST read_8_bytes(bfd *abfd, const gdb_byte *buf)
struct value * dwarf2_evaluate_loc_desc(struct type *type, frame_info_ptr frame, const gdb_byte *data, size_t size, dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, bool as_lval)
const gdb_byte * dwarf2_find_location_expression(struct dwarf2_loclist_baton *baton, size_t *locexpr_length, CORE_ADDR pc)
const struct symbol_computed_ops dwarf2_loclist_funcs
const struct symbol_computed_ops dwarf2_locexpr_funcs
const struct symbol_block_ops dwarf2_block_frame_base_locexpr_funcs
const struct symbol_block_ops dwarf2_block_frame_base_loclist_funcs
static struct type * new_type(char *)
bound_minimal_symbol lookup_minimal_symbol_linkage(const char *name, struct objfile *objf)
void add_using_directive(struct using_direct **using_directives, const char *dest, const char *src, const char *alias, const char *declaration, const std::vector< const char * > &excludes, int copy_names, struct obstack *obstack)
void set_objfile_main_name(struct objfile *objfile, const char *name, enum language lang)
struct type * objfile_int_type(struct objfile *of, int size_in_bytes, bool unsigned_p)
const char * objfile_name(const struct objfile *objfile)
#define SECT_OFF_TEXT(objfile)
#define OBJSTAT(objfile, expr)
#define prefix(a, b, R, do)
int producer_is_gcc(const char *producer, int *major, int *minor)
int producer_is_gcc_ge_4(const char *producer)
static void set_type(type_object *obj, struct type *type)
int() symbol_compare_ftype(const char *string1, const char *string2)
std::unique_ptr< quick_symbol_functions > quick_symbol_functions_up
static struct dwo_unit * lookup_dwo_unit(dwarf2_cu *cu, die_info *comp_unit_die, const char *dwo_name)
static int eq_dwo_unit(const void *item_lhs, const void *item_rhs)
static void dwarf2_attach_fn_fields_to_type(struct field_info *, struct type *, struct dwarf2_cu *)
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 const char * dwarf2_full_name(const char *name, struct die_info *die, struct dwarf2_cu *cu)
static struct dwp_hash_table * create_dwp_hash_table(dwarf2_per_objfile *per_objfile, struct dwp_file *dwp_file, int is_debug_types)
static void process_full_type_unit(dwarf2_cu *cu, enum language pretend_language)
static void queue_comp_unit(dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, enum language pretend_language)
static void dw2_get_file_names_reader(const struct die_reader_specs *reader, struct die_info *comp_unit_die)
static struct die_info * follow_die_ref(struct die_info *, const struct attribute *, struct dwarf2_cu **)
static int handle_member_location(struct die_info *die, struct dwarf2_cu *cu, LONGEST *offset)
static void dwarf2_build_psymtabs_hard(dwarf2_per_objfile *per_objfile)
static const registry< bfd >::key< dwarf2_per_bfd > dwarf2_per_bfd_bfd_data_key
static void dwarf2_symbol_mark_computed(const struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu, int is_block)
static void dwarf2_get_subprogram_pc_bounds(struct die_info *die, CORE_ADDR *lowpc, CORE_ADDR *highpc, struct dwarf2_cu *cu)
static int queue_and_load_dwo_tu(void **slot, void *info)
static void compute_delayed_physnames(struct dwarf2_cu *cu)
static int eq_file_name_entry(const void *a, const void *b)
gdb::function_view< gdb::array_view< const gdb_byte >(objfile *, dwarf2_per_bfd *)> get_gdb_index_contents_ftype
static struct using_direct ** using_directives(struct dwarf2_cu *cu)
static void process_structure_scope(struct die_info *, struct dwarf2_cu *)
CORE_ADDR dwarf2_read_addr_index(dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, unsigned int addr_index)
static ULONGEST lookup_loclist_base(struct dwarf2_cu *cu)
static void process_die(struct die_info *, struct dwarf2_cu *)
static void dwarf2_invalid_attrib_class_complaint(const char *arg1, const char *arg2)
static const gdb_byte * read_attribute_value(const struct die_reader_specs *reader, struct attribute *attr, unsigned form, LONGEST implicit_const, const gdb_byte *info_ptr)
static struct dwo_unit * lookup_dwo_unit_in_dwp(dwarf2_per_objfile *per_objfile, struct dwp_file *dwp_file, const char *comp_dir, ULONGEST signature, int is_debug_types)
static bool ada_get_gnat_encoded_ratio(const char *encoding, int &offset, gdb_mpz *num, gdb_mpz *denom)
static 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)
static void create_debug_types_hash_table(dwarf2_per_objfile *per_objfile, struct dwo_file *dwo_file, gdb::array_view< dwarf2_section_info > type_sections, htab_up &types_htab)
static const char * read_dwo_str_index(const struct die_reader_specs *reader, ULONGEST str_index)
static void rust_union_quirks(struct dwarf2_cu *cu)
gdb::function_view< gdb::array_view< const gdb_byte >(objfile *, dwz_file *)> get_gdb_index_contents_dwz_ftype
static void process_full_comp_unit(dwarf2_cu *cu, enum language pretend_language)
static hashval_t hash_dwo_file(const void *item)
static bool producer_is_gcc_lt_4_3(struct dwarf2_cu *cu)
static struct type * get_die_type_at_offset(sect_offset, dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile)
static bool producer_is_icc(struct dwarf2_cu *cu)
static struct die_info * follow_die_offset(sect_offset sect_off, int offset_in_dwz, struct dwarf2_cu **ref_cu)
static struct signatured_type * lookup_dwo_signatured_type(struct dwarf2_cu *cu, ULONGEST sig)
#define MAX_NR_V2_DWO_SECTIONS
static void read_lexical_block_scope(struct die_info *, struct dwarf2_cu *)
static struct type * read_tag_atomic_type(struct die_info *die, struct dwarf2_cu *cu)
static void dwarf2_add_member_fn(struct field_info *, struct die_info *, struct type *, struct dwarf2_cu *)
static struct dwo_unit * create_dwo_unit_in_dwp_v2(dwarf2_per_objfile *per_objfile, struct dwp_file *dwp_file, uint32_t unit_index, const char *comp_dir, ULONGEST signature, int is_debug_types)
static enum language dwarf_lang_to_enum_language(unsigned int lang)
static struct type * read_structure_type(struct die_info *die, struct dwarf2_cu *cu)
static gdb::array_view< const gdb_byte > get_gdb_index_contents_from_cache(objfile *obj, dwarf2_per_bfd *dwarf2_per_bfd)
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 type_can_define_types(const struct die_info *die)
static struct type * read_tag_reference_type(struct die_info *die, struct dwarf2_cu *cu, enum type_code refcode)
static struct compunit_symtab * dw2_instantiate_symtab(dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, bool skip_partial)
static void read_loclists_rnglists_header(struct loclists_rnglists_header *header, struct dwarf2_section_info *section, sect_offset header_offset)
static gdb_byte * dwarf2_const_value_data(const struct attribute *attr, struct obstack *obstack, struct dwarf2_cu *cu, LONGEST *value, int bits)
#define LOCLIST_HEADER_SIZE64
static void dwarf2_const_value_length_mismatch_complaint(const char *arg1, int arg2, int arg3)
static struct dwo_unit * lookup_dwo_type_unit(dwarf2_cu *cu, const char *dwo_name, const char *comp_dir)
static gdb_bfd_ref_ptr open_dwp_file(dwarf2_per_objfile *per_objfile, const char *file_name)
static struct compunit_symtab * recursively_find_pc_sect_compunit_symtab(struct compunit_symtab *cust, CORE_ADDR pc)
static const char * determine_prefix(struct die_info *die, struct dwarf2_cu *)
static void load_full_comp_unit(dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, dwarf2_cu *existing_cu, bool skip_partial, enum language pretend_language)
static struct type * set_die_type(struct die_info *, struct type *, struct dwarf2_cu *, bool=false)
static struct attribute * dw2_linkage_name_attr(struct die_info *die, struct dwarf2_cu *cu)
static void show_dwarf_max_cache_age(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static hashval_t die_hash(const void *item)
static dwarf2_cu * load_cu(dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, bool skip_partial)
static void maybe_set_alignment(struct dwarf2_cu *cu, struct die_info *die, struct type *type)
static const gdb_byte * write_constant_as_bytes(struct obstack *obstack, enum bfd_endian byte_order, struct type *type, ULONGEST value, LONGEST *len)
static const gdb_byte * skip_one_die(const struct die_reader_specs *reader, const gdb_byte *info_ptr, const struct abbrev_info *abbrev, bool do_skip_children=true)
static void read_comp_units_from_section(dwarf2_per_objfile *per_objfile, struct dwarf2_section_info *section, struct dwarf2_section_info *abbrev_section, unsigned int is_dwz, htab_up &types_htab, rcuh_kind section_kind)
static void dwarf2_add_field(struct field_info *, struct die_info *, struct dwarf2_cu *)
static hashval_t hash_dwp_loaded_cutus(const void *item)
static void dwarf2_locate_dwo_sections(struct objfile *objfile, bfd *abfd, asection *sectp, dwo_sections *dwo_sections)
static struct dwo_unit * create_dwo_unit_in_dwp_v1(dwarf2_per_objfile *per_objfile, struct dwp_file *dwp_file, uint32_t unit_index, const char *comp_dir, ULONGEST signature, int is_debug_types)
static sect_offset read_abbrev_offset(dwarf2_per_objfile *per_objfile, dwarf2_section_info *, sect_offset)
static struct type * die_containing_type(struct die_info *, struct dwarf2_cu *)
static struct type * read_module_type(struct die_info *die, struct dwarf2_cu *cu)
static void ** lookup_dwo_file_slot(dwarf2_per_objfile *per_objfile, const char *dwo_name, const char *comp_dir)
static struct type * get_die_type(struct die_info *die, struct dwarf2_cu *cu)
static void dwarf2_add_type_defn(struct field_info *fip, struct die_info *die, struct dwarf2_cu *cu)
static gdb_bfd_ref_ptr try_open_dwop_file(dwarf2_per_objfile *per_objfile, const char *file_name, int is_dwp, int search_cwd)
static struct dwarf2_per_cu_data * dw2_symtab_iter_next(struct dw2_symtab_iterator *iter, mapped_index &index)
static int line_header_eq_voidp(const void *item_lhs, const void *item_rhs)
static bool read_debug_names_from_section(struct objfile *objfile, const char *filename, struct dwarf2_section_info *section, mapped_debug_names &map)
static std::unique_ptr< type_unit_group > create_type_unit_group(struct dwarf2_cu *cu, sect_offset line_offset_struct)
static struct dwo_unit * lookup_dwo_cutu(dwarf2_cu *cu, const char *dwo_name, const char *comp_dir, ULONGEST signature, int is_debug_types)
static void show_check_physname(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void read_import_statement(struct die_info *die, struct dwarf2_cu *)
static std::string make_sort_after_prefix_name(const char *search_name)
static struct type * rust_containing_type(struct die_info *die, struct dwarf2_cu *cu)
static hashval_t hash_type_unit_group(const void *item)
static ULONGEST get_alignment(struct dwarf2_cu *cu, struct die_info *die)
static void dwarf2_ranges_read_low_addrs(unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag, std::vector< CORE_ADDR > &result)
static int leb128_size(const gdb_byte *buf)
static sect_offset read_rnglist_index(struct dwarf2_cu *cu, ULONGEST rnglist_index, dwarf_tag tag)
static int eq_type_unit_group(const void *item_lhs, const void *item_rhs)
const gdb_byte * dwarf2_fetch_constant_bytes(sect_offset sect_off, dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, obstack *obstack, LONGEST *len)
static void inherit_abstract_dies(struct die_info *die, struct dwarf2_cu *cu)
static void handle_DW_AT_stmt_list(struct die_info *die, struct dwarf2_cu *cu, const file_and_directory &fnd, CORE_ADDR lowpc, bool have_code)
static struct type * read_type_die(struct die_info *, struct dwarf2_cu *)
static struct type * read_subroutine_type(struct die_info *die, struct dwarf2_cu *cu)
static int dwarf2_loclist_index
static bool producer_is_codewarrior(struct dwarf2_cu *cu)
#define MAX_NESTED_IMPORTED_DECLARATIONS
static void read_type_unit_scope(struct die_info *, struct dwarf2_cu *)
static bool read_addrmap_from_aranges(dwarf2_per_objfile *per_objfile, struct dwarf2_section_info *section, addrmap *mutable_map)
static void check_producer(struct dwarf2_cu *cu)
static void fixup_go_packaging(struct dwarf2_cu *cu)
bool producer_is_clang(struct dwarf2_cu *cu)
static struct attribute * dwarf2_attr(struct die_info *, unsigned int, struct dwarf2_cu *)
static struct dwarf2_section_info create_dwp_v2_or_v5_section(dwarf2_per_objfile *per_objfile, struct dwarf2_section_info *section, bfd_size_type offset, bfd_size_type size)
static htab_up create_quick_file_names_table(unsigned int nr_initial_entries)
static struct type * read_enumeration_type(struct die_info *die, struct dwarf2_cu *cu)
static struct die_info * follow_die_ref_or_sig(struct die_info *, const struct attribute *, struct dwarf2_cu **)
static void process_skeletonless_type_units(dwarf2_per_objfile *per_objfile, cooked_index_storage *storage)
static bool create_cus_from_debug_names(dwarf2_per_bfd *per_bfd, const mapped_debug_names &map, const mapped_debug_names &dwz_map)
static struct type * read_tag_restrict_type(struct die_info *die, struct dwarf2_cu *cu)
static struct symbol * new_symbol(struct die_info *, struct type *, struct dwarf2_cu *, struct symbol *=NULL)
static struct type * dwarf2_init_integer_type(struct dwarf2_cu *cu, struct objfile *objfile, int bits, int unsigned_p, const char *name)
static int dwarf2_locexpr_block_index
static bool dw2_expand_marked_cus(dwarf2_per_objfile *per_objfile, offset_type idx, gdb::function_view< expand_symtabs_file_matcher_ftype > file_matcher, gdb::function_view< expand_symtabs_exp_notify_ftype > expansion_notify, block_search_flags search_flags, search_domain kind)
static const gdb_byte * read_attribute(const struct die_reader_specs *, struct attribute *, const struct attr_abbrev *, const gdb_byte *)
static void handle_struct_member_die(struct die_info *child_die, struct type *type, struct field_info *fi, std::vector< struct symbol * > *template_args, struct dwarf2_cu *cu)
static const char * dw2_get_real_path(dwarf2_per_objfile *per_objfile, struct quick_file_names *qfn, int index)
static void get_dwarf2_rational_constant(struct die_info *die, struct dwarf2_cu *cu, gdb_mpz *numerator, gdb_mpz *denominator)
static int dwarf2_locexpr_index
static struct dwo_unit * lookup_dwo_comp_unit(dwarf2_cu *cu, const char *dwo_name, const char *comp_dir, ULONGEST signature)
static bool check_modifier(const char *physname, size_t &len, const char(&mod)[N])
static struct dwarf2_section_info * get_debug_line_section(struct dwarf2_cu *cu)
#define RNGLIST_HEADER_SIZE64
static struct type * add_array_cv_type(struct die_info *die, struct dwarf2_cu *cu, struct type *base_type, int cnst, int voltl)
static struct type * read_tag_ptr_to_member_type(struct die_info *die, struct dwarf2_cu *cu)
static const char * anonymous_struct_prefix(struct die_info *die, struct dwarf2_cu *cu)
static void create_one_variant_part(variant_part &result, struct obstack *obstack, const offset_map_type &offset_map, struct field_info *fi, const variant_part_builder &builder)
static const char * dwarf2_dwo_name(struct die_info *die, struct dwarf2_cu *cu)
static void create_addrmap_from_aranges(dwarf2_per_objfile *per_objfile, struct dwarf2_section_info *section)
static int dwarf2_loclist_block_index
static struct type * die_type(struct die_info *, struct dwarf2_cu *)
static enum dwarf_access_attribute dwarf2_access_attribute(struct die_info *die, struct dwarf2_cu *cu)
static int eq_signatured_type(const void *item_lhs, const void *item_rhs)
static struct type_unit_group * get_type_unit_group(struct dwarf2_cu *cu, const struct attribute *stmt_list)
static CORE_ADDR read_addr_index_from_leb128(struct dwarf2_cu *, const gdb_byte *, unsigned int *)
static htab_up allocate_dwo_file_hash_table()
static unsigned int dwarf_die_debug
static void build_type_psymtabs_reader(cutu_reader *reader, cooked_index_storage *storage)
static const struct abbrev_info * peek_die_abbrev(const die_reader_specs &reader, const gdb_byte *info_ptr, unsigned int *bytes_read)
static bool recognize_bound_expression(struct die_info *die, enum dwarf_attribute name, int *bounds_offset, struct field *field, struct dwarf2_cu *cu)
static struct type * read_array_type(struct die_info *die, struct dwarf2_cu *cu)
#define LOCLIST_HEADER_SIZE32
static const char * dwarf2_string_attr(struct die_info *die, unsigned int name, struct dwarf2_cu *cu)
static void create_one_variant(variant &result, struct obstack *obstack, const offset_map_type &offset_map, struct field_info *fi, const variant_field &field)
static htab_up allocate_signatured_type_table()
static void create_signatured_type_table_from_index(dwarf2_per_bfd *per_bfd, struct dwarf2_section_info *section, const gdb_byte *bytes, offset_type elements)
static char * typename_concat(struct obstack *obs, const char *prefix, const char *suffix, int physname, struct dwarf2_cu *cu)
static void dw_expand_symtabs_matching_file_matcher(dwarf2_per_objfile *per_objfile, gdb::function_view< expand_symtabs_file_matcher_ftype > file_matcher)
static int eq_dwo_file(const void *item_lhs, const void *item_rhs)
static void dump_die_for_error(struct die_info *)
static enum pc_bounds_kind dwarf2_get_pc_bounds(struct die_info *, CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *, addrmap *, void *)
static int attr_to_dynamic_prop(const struct attribute *attr, struct die_info *die, struct dwarf2_cu *cu, struct dynamic_prop *prop, struct type *type)
static CORE_ADDR read_addr_index_1(dwarf2_per_objfile *per_objfile, unsigned int addr_index, gdb::optional< ULONGEST > addr_base, int addr_size)
static void store_in_ref_table(struct die_info *, struct dwarf2_cu *)
static struct type * get_signatured_type(struct die_info *, ULONGEST, struct dwarf2_cu *)
static unsigned int peek_abbrev_code(bfd *, const gdb_byte *)
static void read_call_site_scope(struct die_info *die, struct dwarf2_cu *cu)
static void get_dwarf2_unsigned_rational_constant(struct die_info *die, struct dwarf2_cu *cu, gdb_mpz *numerator, gdb_mpz *denominator)
static const gdb_byte * skip_children(const struct die_reader_specs *reader, const gdb_byte *info_ptr)
struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_sect_off(sect_offset sect_off, dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, gdb::function_view< CORE_ADDR()> get_frame_pc, bool resolve_abstract_p)
static struct dwarf2_per_cu_data * dwarf2_find_containing_comp_unit(sect_offset sect_off, unsigned int offset_in_dwz, dwarf2_per_bfd *per_bfd)
static hashval_t line_header_hash_voidp(const void *item)
static void process_psymtab_comp_unit(dwarf2_per_cu_data *this_cu, dwarf2_per_objfile *per_objfile, cooked_index_storage *storage)
static struct die_info * read_die_and_children(const struct die_reader_specs *reader, const gdb_byte *info_ptr, const gdb_byte **new_info_ptr, struct die_info *parent)
static struct die_info * read_die_and_siblings(const struct die_reader_specs *, const gdb_byte *info_ptr, const gdb_byte **new_info_ptr, struct die_info *parent)
static struct type * read_subrange_index_type(struct die_info *die, struct dwarf2_cu *cu)
static void prepare_one_comp_unit(struct dwarf2_cu *cu, struct die_info *comp_unit_die, enum language pretend_language)
static bool dwarf2_rnglists_process(unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag, Callback &&callback)
static const char * dw2_linkage_name(struct die_info *die, struct dwarf2_cu *cu)
static int eq_dwp_loaded_cutus(const void *a, const void *b)
static void dump_die_shallow(struct ui_file *, int indent, struct die_info *)
#define MAX_NR_V1_DWO_SECTIONS
static void mark_common_block_symbol_computed(struct symbol *sym, struct die_info *common_die, struct attribute *common_loc, struct attribute *member_loc, struct dwarf2_cu *cu)
static int dwarf2_ranges_read(unsigned offset, CORE_ADDR *low_return, CORE_ADDR *high_return, struct dwarf2_cu *cu, addrmap *map, void *datum, dwarf_tag tag)
static const char * compute_include_file_name(const struct line_header *lh, const file_entry &fe, const file_and_directory &cu_info, std::string &name_holder)
static const gdb::array_view< discriminant_range > convert_variant_range(struct obstack *obstack, const variant_field &variant, bool is_unsigned)
static void alloc_rust_variant(struct obstack *obstack, struct type *type, int discriminant_index, int default_index, gdb::array_view< discriminant_range > ranges)
static void process_cu_includes(dwarf2_per_objfile *per_objfile)
static const char * gnat_encoded_fixed_point_type_info(const char *name)
static htab_up allocate_type_unit_groups_table()
static struct die_info * dwarf2_extension(struct die_info *die, struct dwarf2_cu **)
static const char * read_str_index(struct dwarf2_cu *cu, struct dwarf2_section_info *str_section, struct dwarf2_section_info *str_offsets_section, ULONGEST str_offsets_base, ULONGEST str_index, unsigned offset_size)
#define GNAT_FIXED_POINT_SUFFIX
static void get_mpz(struct dwarf2_cu *cu, gdb_mpz *value, struct attribute *attr)
static void dwarf2_locate_v5_dwp_sections(struct objfile *objfile, bfd *abfd, asection *sectp, void *dwp_file_ptr)
#define dwarf_read_debug_printf_v(fmt,...)
static void dwarf2_build_psymtabs(struct objfile *objfile)
#define NO_STMT_LIST_TYPE_UNIT_PSYMTAB_SIZE
static void finish_fixed_point_type(struct type *type, const char *suffix, struct die_info *die, struct dwarf2_cu *cu)
static struct die_info * die_specification(struct die_info *die, struct dwarf2_cu **)
struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_cu_off(cu_offset offset_in_cu, dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, gdb::function_view< CORE_ADDR()> get_frame_pc)
static void dwarf2_const_value(const struct attribute *, struct symbol *, struct dwarf2_cu *)
static void dwarf2_start_subfile(dwarf2_cu *cu, const file_entry &fe, const line_header &lh)
static void read_func_scope(struct die_info *, struct dwarf2_cu *)
#define RNGLIST_HEADER_SIZE32
static void dwarf2_complex_location_expr_complaint(void)
static gdb::array_view< const gdb_byte > get_gdb_index_contents_from_cache_dwz(objfile *obj, dwz_file *dwz)
static bool ada_get_gnat_encoded_number(const char *encoding, int &k, gdb_mpz *result)
static const char * read_indirect_string_at_offset(dwarf2_per_objfile *per_objfile, LONGEST str_offset)
static quick_symbol_functions_up make_cooked_index_funcs()
static void quirk_ada_thick_pointer_struct(struct die_info *die, struct dwarf2_cu *cu, struct type *type)
static const gdb_byte * read_full_die(const struct die_reader_specs *, struct die_info **, const gdb_byte *)
void _initialize_dwarf2_read()
#define dwarf_read_debug_printf(fmt,...)
static void process_imported_unit_die(struct die_info *die, struct dwarf2_cu *cu)
static const registry< objfile >::key< dwarf2_per_bfd > dwarf2_per_bfd_objfile_data_key
static struct type * rewrite_array_type(struct type *type)
static void read_file_scope(struct die_info *, struct dwarf2_cu *)
static bool producer_is_gxx_lt_4_6(struct dwarf2_cu *cu)
static struct dwo_unit * create_dwo_unit_in_dwp_v5(dwarf2_per_objfile *per_objfile, struct dwp_file *dwp_file, uint32_t unit_index, const char *comp_dir, ULONGEST signature, int is_debug_types)
static unsigned int dwarf_read_debug
static const char * dwarf2_physname(const char *name, struct die_info *die, struct dwarf2_cu *cu)
static void create_addrmap_from_index(dwarf2_per_objfile *per_objfile, struct mapped_index *index)
static hashval_t hash_signatured_type(const void *item)
static bool producer_is_icc_lt_14(struct dwarf2_cu *cu)
static bool has_zero_over_zero_small_attribute(struct die_info *die, struct dwarf2_cu *cu)
static const char * dwarf2_compute_name(const char *name, struct die_info *die, struct dwarf2_cu *cu, int physname)
static struct type * read_tag_const_type(struct die_info *die, struct dwarf2_cu *cu)
static void print_tu_stats(dwarf2_per_objfile *per_objfile)
static struct die_info * read_die_and_siblings_1(const struct die_reader_specs *, const gdb_byte *, const gdb_byte **, struct die_info *)
static int eq_stmt_list_entry(const struct stmt_list_hash *lhs, const struct stmt_list_hash *rhs)
static void create_all_units(dwarf2_per_objfile *per_objfile)
static void dw2_symtab_iter_init(struct dw2_symtab_iterator *iter, dwarf2_per_objfile *per_objfile, gdb::optional< block_enum > block_index, domain_enum domain, offset_type namei, mapped_index &index)
static void dwarf2_debug_line_missing_file_complaint(void)
static struct type * read_tag_volatile_type(struct die_info *die, struct dwarf2_cu *cu)
static struct dwarf2_section_info * cu_debug_rnglists_section(struct dwarf2_cu *cu, dwarf_tag tag)
static void dwarf2_attach_fields_to_type(struct field_info *, struct type *, struct dwarf2_cu *)
static void queue_and_load_all_dwo_tus(dwarf2_cu *cu)
static void create_debug_type_hash_table(dwarf2_per_objfile *per_objfile, struct dwo_file *dwo_file, dwarf2_section_info *section, htab_up &types_htab, rcuh_kind section_kind)
static const char * unnamed_template_tag_name(die_info *die, dwarf2_cu *cu)
static void read_attribute_reprocess(const struct die_reader_specs *reader, struct attribute *attr, dwarf_tag tag)
static void dump_die_1(struct ui_file *, int level, int max_level, struct die_info *)
int dwarf2_has_info(struct objfile *objfile, const struct dwarf2_debug_sections *names, bool can_copy)
static struct dwp_file * get_dwp_file(dwarf2_per_objfile *per_objfile)
static void read_module(struct die_info *die, struct dwarf2_cu *cu)
static void compute_compunit_symtab_includes(dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile)
void dump_die(struct die_info *, int max_level)
static void quirk_rust_enum(struct type *type, struct objfile *objfile)
static void var_decode_location(struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu)
static CORE_ADDR decode_locdesc(struct dwarf_block *, struct dwarf2_cu *, bool *=nullptr)
static const char * namespace_name(struct die_info *die, int *is_anonymous, struct dwarf2_cu *)
static htab_up allocate_dwo_unit_table()
static struct quick_file_names * dw2_get_file_names(dwarf2_per_cu_data *this_cu, dwarf2_per_objfile *per_objfile)
static void init_cu_die_reader(struct die_reader_specs *reader, struct dwarf2_cu *cu, struct dwarf2_section_info *section, struct dwo_file *dwo_file, struct abbrev_table *abbrev_table)
static struct type * read_namespace_type(struct die_info *die, struct dwarf2_cu *cu)
static void dwarf_decode_lines_1(struct line_header *lh, struct dwarf2_cu *cu, CORE_ADDR lowpc)
static int maybe_queue_comp_unit(struct dwarf2_cu *dependent_cu, dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, enum language pretend_language)
static hashval_t hash_dwo_unit(const void *item)
static int need_gnat_info(struct dwarf2_cu *)
static hashval_t hash_file_name_entry(const void *e)
static int locate_v1_virtual_dwo_sections(asection *sectp, struct virtual_v1_dwo_sections *sections)
static void get_scope_pc_bounds(struct die_info *, CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *)
static hashval_t per_cu_offset_and_type_hash(const void *item)
static struct type * read_tag_string_type(struct die_info *die, struct dwarf2_cu *cu)
static int die_is_declaration(struct die_info *, struct dwarf2_cu *cu)
static const char * guess_full_die_structure_name(struct die_info *die, struct dwarf2_cu *cu)
static struct signatured_type * lookup_dwp_signatured_type(struct dwarf2_cu *cu, ULONGEST sig)
static gdb_bfd_ref_ptr open_dwo_file(dwarf2_per_objfile *per_objfile, const char *file_name, const char *comp_dir)
struct cmd_list_element * set_dwarf_cmdlist
static void dwarf2_debug_line_missing_end_sequence_complaint(void)
static const char * rust_fully_qualify(struct obstack *obstack, const char *p1, const char *p2)
static gdb::array_view< const gdb_byte > get_gdb_index_contents_from_section(objfile *obj, T *section_owner)
static int is_vtable_name(const char *name, struct dwarf2_cu *cu)
static bool read_alias(struct die_info *die, struct dwarf2_cu *cu)
static bool is_valid_DW_AT_calling_convention_for_subroutine(ULONGEST value)
static int die_eq(const void *item_lhs, const void *item_rhs)
static void dwarf2_locate_common_dwp_sections(struct objfile *objfile, bfd *abfd, asection *sectp, dwp_file *dwp_file)
static bool tag_can_have_linkage_name(enum dwarf_tag tag)
static void dwarf2_locate_v2_dwp_sections(struct objfile *objfile, bfd *abfd, asection *sectp, void *dwp_file_ptr)
static void recursively_compute_inclusions(std::vector< compunit_symtab * > *result, htab_t all_children, htab_t all_type_symtabs, dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, struct compunit_symtab *immediate_parent)
static void create_cus_hash_table(dwarf2_per_objfile *per_objfile, dwarf2_cu *cu, struct dwo_file &dwo_file, dwarf2_section_info §ion, htab_up &cus_htab)
static void update_enumeration_type_from_children(struct die_info *die, struct type *type, struct dwarf2_cu *cu)
static void build_type_psymtabs(dwarf2_per_objfile *per_objfile, cooked_index_storage *storage)
static void read_common_block(struct die_info *, struct dwarf2_cu *)
static void dwarf_decode_macros(struct dwarf2_cu *, unsigned int, int)
static file_and_directory & find_file_and_directory(struct die_info *die, struct dwarf2_cu *cu)
static struct dwarf2_section_info * get_abbrev_section_for_cu(struct dwarf2_per_cu_data *this_cu)
static struct type * read_tag_pointer_type(struct die_info *die, struct dwarf2_cu *cu)
static int dwarf_record_line_p(struct dwarf2_cu *cu, unsigned int line, unsigned int last_line, int line_has_non_zero_discriminator, struct subfile *last_subfile)
static gdb::optional< ULONGEST > lookup_dwo_id(struct dwarf2_cu *cu, struct die_info *comp_unit_die)
static struct dwo_file * open_and_init_dwo_file(dwarf2_cu *cu, const char *dwo_name, const char *comp_dir)
static struct type * read_subrange_type(struct die_info *die, struct dwarf2_cu *cu)
static void set_descriptive_type(struct type *, struct die_info *, struct dwarf2_cu *)
static struct type * read_set_type(struct die_info *die, struct dwarf2_cu *cu)
static int prototyped_function_p(struct die_info *die, struct dwarf2_cu *cu)
static struct type * read_typedef(struct die_info *die, struct dwarf2_cu *cu)
static struct dwarf2_section_info * cu_debug_loc_section(struct dwarf2_cu *cu)
static void handle_variant(struct die_info *die, struct type *type, struct field_info *fi, std::vector< struct symbol * > *template_args, struct dwarf2_cu *cu)
static int dwarf_max_cache_age
static const gdb_byte * read_full_die_1(const struct die_reader_specs *, struct die_info **, const gdb_byte *, int)
static const char * dwarf2_name(struct die_info *die, struct dwarf2_cu *)
struct cmd_list_element * show_dwarf_cmdlist
static struct signatured_type * add_type_unit(dwarf2_per_objfile *per_objfile, ULONGEST sig, void **slot)
static void add_variant_property(struct field_info *fip, struct type *type, struct dwarf2_cu *cu)
static bool is_valid_DW_AT_calling_convention_for_type(ULONGEST value)
static enum dwarf_array_dim_ordering read_array_order(struct die_info *, struct dwarf2_cu *)
static struct die_info * dwarf_alloc_die(struct dwarf2_cu *, int)
static const char * read_indirect_string(dwarf2_per_objfile *per_objfile, bfd *, const gdb_byte *, const struct comp_unit_head *, unsigned int *)
static struct type * build_error_marker_type(struct dwarf2_cu *cu, struct die_info *die)
static void fill_in_loclist_baton(struct dwarf2_cu *cu, struct dwarf2_loclist_baton *baton, const struct attribute *attr)
static struct type * get_DW_AT_signature_type(struct die_info *, const struct attribute *, struct dwarf2_cu *)
static int dwarf2_is_constructor(struct die_info *die, struct dwarf2_cu *cu)
struct type * dwarf2_get_die_type(cu_offset die_offset, dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile)
void dwarf2_get_section_info(struct objfile *objfile, enum dwarf2_section_enum sect, asection **sectp, const gdb_byte **bufp, bfd_size_type *sizep)
static void finalize_all_units(dwarf2_per_bfd *per_bfd)
static int dwarf2_ranges_process(unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag, Callback &&callback)
static void create_cus_from_index_list(dwarf2_per_bfd *per_bfd, const gdb_byte *cu_list, offset_type n_elements, struct dwarf2_section_info *section, int is_dwz)
static const gdb::array_view< variant_part > create_variant_parts(struct obstack *obstack, const offset_map_type &offset_map, struct field_info *fi, const std::vector< variant_part_builder > &variant_parts)
static void read_signatured_type(signatured_type *sig_type, dwarf2_per_objfile *per_objfile)
static line_header_up dwarf_decode_line_header(sect_offset sect_off, struct dwarf2_cu *cu, const char *comp_dir)
static struct dwarf_block * dwarf_alloc_block(struct dwarf2_cu *)
static int process_skeletonless_type_unit(void **slot, void *info)
static int process_dwo_file_for_skeletonless_type_units(void **slot, void *info)
static int die_needs_namespace(struct die_info *die, struct dwarf2_cu *cu)
static 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)
static int read_cutu_die_from_dwo(dwarf2_cu *cu, struct dwo_unit *dwo_unit, struct die_info *stub_comp_unit_die, const char *stub_comp_dir, struct die_reader_specs *result_reader, const gdb_byte **result_info_ptr, struct die_info **result_comp_unit_die, abbrev_table_up *result_dwo_abbrev_table)
static sect_offset read_loclist_index(struct dwarf2_cu *cu, ULONGEST loclist_index)
static bool check_physname
static struct die_info * follow_die_sig(struct die_info *, const struct attribute *, struct dwarf2_cu **)
static void dw2_do_instantiate_symtab(dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, bool skip_partial)
static struct type * read_base_type(struct die_info *die, struct dwarf2_cu *cu)
static CORE_ADDR read_addr_index(struct dwarf2_cu *cu, unsigned int addr_index)
static bool dwarf2_read_debug_names(dwarf2_per_objfile *per_objfile)
static struct type * dwarf2_init_float_type(struct objfile *objfile, int bits, const char *name, const char *name_hint, enum bfd_endian byte_order)
static const char * read_stub_str_index(struct dwarf2_cu *cu, ULONGEST str_index)
static void quirk_gcc_member_function_pointer(struct type *type, struct objfile *objfile)
#define NO_STMT_LIST_TYPE_UNIT_PSYMTAB
static void add_to_method_list(struct type *type, int fnfield_index, int index, const char *name, struct die_info *die, struct dwarf2_cu *cu)
static struct type * read_type_die_1(struct die_info *, struct dwarf2_cu *)
static void read_variable(struct die_info *die, struct dwarf2_cu *cu)
static htab_up allocate_dwp_loaded_cutus_table()
static void process_queue(dwarf2_per_objfile *per_objfile)
static hashval_t hash_stmt_list_entry(const struct stmt_list_hash *stmt_list_hash)
static 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)
static bool use_deprecated_index_sections
static void fill_in_sig_entry_from_dwo_entry(dwarf2_per_objfile *per_objfile, struct signatured_type *sig_entry, struct dwo_unit *dwo_entry)
void dwarf2_initialize_objfile(struct objfile *objfile)
dwarf2_per_objfile * get_dwarf2_per_objfile(struct objfile *objfile)
static struct die_info * follow_die_sig_1(struct die_info *src_die, struct signatured_type *sig_type, struct dwarf2_cu **ref_cu)
static bool read_gdb_index_from_buffer(const char *filename, bool deprecated_ok, gdb::array_view< const gdb_byte > buffer, struct mapped_index *map, const gdb_byte **cu_list, offset_type *cu_list_elements, const gdb_byte **types_list, offset_type *types_list_elements)
static struct type * quirk_ada_thick_pointer(struct die_info *die, struct dwarf2_cu *cu, struct type *type)
static int dwarf2_flag_true_p(struct die_info *die, unsigned name, struct dwarf2_cu *cu)
static const char * var_decl_name(struct die_info *die, struct dwarf2_cu *cu)
static struct type * dwarf2_init_complex_target_type(struct dwarf2_cu *cu, struct objfile *objfile, int bits, const char *name_hint, enum bfd_endian byte_order)
static void load_full_type_unit(dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile)
static int per_cu_offset_and_type_eq(const void *item_lhs, const void *item_rhs)
unsigned int dwarf_line_debug
static int dwarf2_read_gdb_index(dwarf2_per_objfile *per_objfile, get_gdb_index_contents_ftype get_gdb_index_contents, get_gdb_index_contents_dwz_ftype get_gdb_index_contents_dwz)
static void process_enumeration_scope(struct die_info *, struct dwarf2_cu *)
static struct signatured_type * lookup_signatured_type(struct dwarf2_cu *cu, ULONGEST sig)
static struct type * read_unspecified_type(struct die_info *die, struct dwarf2_cu *cu)
static const gdb_byte dwarf5_augmentation[]
struct type * dwarf2_fetch_die_type_sect_off(sect_offset sect_off, dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, const char **var_name)
static void dwarf_decode_lines(struct line_header *, struct dwarf2_cu *, CORE_ADDR, int decode_mapping)
static void dwarf_record_line_1(struct gdbarch *gdbarch, struct subfile *subfile, unsigned int line, CORE_ADDR address, linetable_entry_flags flags, struct dwarf2_cu *cu)
static void dwarf2_find_base_address(struct die_info *die, struct dwarf2_cu *cu)
static struct type * lookup_die_type(struct die_info *, const struct attribute *, struct dwarf2_cu *)
static hashval_t line_header_hash(const struct line_header *ofs)
const struct dwarf2_debug_sections dwarf2_elf_names
static void dwarf2_const_value_attr(const struct attribute *attr, struct type *type, const char *name, struct obstack *obstack, struct dwarf2_cu *cu, LONGEST *value, const gdb_byte **bytes, struct dwarf2_locexpr_baton **baton)
static const registry< objfile >::key< dwarf2_per_objfile > dwarf2_objfile_data_key
std::unordered_map< sect_offset, int, gdb::hash_enum< sect_offset > > offset_map_type
#define MAX_NR_V5_DWO_SECTIONS
static void handle_variant_part(struct die_info *die, struct type *type, struct field_info *fi, std::vector< struct symbol * > *template_args, struct dwarf2_cu *cu)
static void create_dwo_cu_reader(const struct die_reader_specs *reader, const gdb_byte *info_ptr, struct die_info *comp_unit_die, struct dwo_file *dwo_file, struct dwo_unit *dwo_unit)
static void dwarf2_record_block_ranges(struct die_info *, struct block *, CORE_ADDR, struct dwarf2_cu *)
static void create_cus_from_index(dwarf2_per_bfd *per_bfd, const gdb_byte *cu_list, offset_type cu_list_elements, const gdb_byte *dwz_list, offset_type dwz_elements)
static const char * dwarf2_canonicalize_name(const char *, struct dwarf2_cu *, struct objfile *)
static std::unique_ptr< struct dwp_file > open_and_init_dwp_file(dwarf2_per_objfile *per_objfile)
static void dwarf_finish_line(struct gdbarch *gdbarch, struct subfile *subfile, CORE_ADDR address, struct dwarf2_cu *cu)
std::unique_ptr< struct dwo_file > dwo_file_up
static void read_namespace(struct die_info *die, struct dwarf2_cu *)
static struct type * die_descriptive_type(struct die_info *, struct dwarf2_cu *)
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
static struct ppc_variant variants[]
const char * rust_last_path_segment(const char *path)
int openp(const char *path, openp_flags opts, const char *string, int mode, gdb::unique_xmalloc_ptr< char > *filename_opened)
const char * symtab_to_filename_for_display(struct symtab *symtab)
void forget_cached_source_info(void)
gdb::unique_xmalloc_ptr< char > find_source_or_rewrite(const char *filename, const char *dirname)
const char * dwarf_bool_name(unsigned mybool)
const char * dwarf_attr_name(unsigned attr)
const char * dwarf_tag_name(unsigned tag)
const char * dwarf_form_name(unsigned form)
const char * dwarf_type_encoding_name(unsigned enc)
__extension__ enum dwarf_tag tag
struct attr_abbrev attrs[1]
unsigned short sibling_offset
unsigned short size_if_constant
const sect_offset sect_off
static abbrev_table_up read(struct dwarf2_section_info *section, sect_offset sect_off)
const struct abbrev_info * lookup_abbrev(unsigned int abbrev_number) const
void * find(CORE_ADDR addr) const override
void set_empty(CORE_ADDR start, CORE_ADDR end_inclusive, void *obj) override
virtual void * find(CORE_ADDR addr) const =0
virtual void set_empty(CORE_ADDR start, CORE_ADDR end_inclusive, void *obj)=0
__extension__ enum dwarf_attribute name
__extension__ enum dwarf_form form
bool is_nonnegative() const
sect_offset get_ref_die_offset() const
void set_signature(ULONGEST signature)
ULONGEST as_unsigned() const
void set_unsigned(ULONGEST unsnd)
bool canonical_string_p() const
LONGEST constant_value(int default_value) const
CORE_ADDR as_address() const
bool form_is_constant() const
__extension__ enum dwarf_attribute name
void set_string_noncanonical(const char *str)
void set_address(CORE_ADDR addr)
ULONGEST as_nonnegative() const
const char * as_string() const
bool requires_reprocessing_p() const
void set_unsigned_reprocess(ULONGEST unsnd)
dwarf_defaulted_attribute defaulted() const
dwarf_block * as_block() const
bool form_is_block() const
void set_block(dwarf_block *blk)
void set_string_canonical(const char *str)
__extension__ enum dwarf_form form
bool form_is_unsigned() const
LONGEST as_signed() const
unsigned int string_is_canonical
ULONGEST as_unsigned_reprocess() const
void set_signed(LONGEST snd)
unsigned int requires_reprocessing
ULONGEST as_signature() const
dwarf_virtuality_attribute as_virtuality() const
bool form_is_section_offset() const
void set_ranges(blockranges *ranges)
struct minimal_symbol * minsym
struct compunit_symtab * get_compunit_symtab()
struct pending ** get_local_symbols()
void set_local_using_directives(struct using_direct *new_local)
struct using_direct ** get_local_using_directives()
void start_subfile(const char *name, const char *name_for_id)
struct context_stack * get_current_context_stack()
struct block * finish_block(struct symbol *symbol, struct pending_block *old_blocks, const struct dynamic_prop *static_link, CORE_ADDR start, CORE_ADDR end)
bool outermost_context_p() const
struct compunit_symtab * end_compunit_symtab_from_static_block(struct block *static_block, int section, int expandable)
struct block * end_compunit_symtab_get_static_block(CORE_ADDR end_addr, int expandable, int required)
void augment_type_symtab()
struct pending ** get_file_symbols()
void record_line(struct subfile *subfile, int line, CORE_ADDR pc, linetable_entry_flags flags)
struct context_stack pop_context()
struct pending ** get_global_symbols()
struct subfile * get_current_subfile()
struct compunit_symtab * end_expandable_symtab(CORE_ADDR end_addr, int section)
void record_block_range(struct block *block, CORE_ADDR start, CORE_ADDR end_inclusive)
struct context_stack * push_context(int desc, CORE_ADDR valu)
struct using_direct ** get_global_using_directives()
struct type * builtin_real
struct type * builtin_real_s8
struct type * builtin_real_s16
struct type * builtin_double
struct type * builtin_long_double
struct type * builtin_float
__extension__ enum call_site_parameter_kind kind
union call_site_parameter_u u
const gdb_byte * data_value
static hashval_t hash(const call_site *a)
struct call_site_parameter parameter[]
static int eq(const call_site *a, const call_site *b)
struct call_site * tail_call_next
dwarf2_per_objfile *const per_objfile
struct symbol * contents[1]
CORE_ADDR read_address(bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read) const
unsigned int get_length() const
cu_offset type_cu_offset_in_tu
enum dwarf_unit_type unit_type
LONGEST read_offset(bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read) const
void set_epilogue_unwind_valid(bool epilogue_unwind_valid)
symtab * primary_filetab() const
enum language language() const
struct blockvector * blockvector()
struct compunit_symtab * user
void set_locations_valid(bool locations_valid)
void set_call_site_htab(htab_t call_site_htab)
struct compunit_symtab ** includes
struct objfile * objfile() const
const char * dirname() const
struct dynamic_prop * static_link
struct using_direct * local_using_directives
struct pending_block * old_blocks
dwarf2_per_cu_data * per_cu
const char * full_name(struct obstack *storage, bool for_main=false) const
const cooked_index_entry * parent_entry
struct compunit_symtab * find_compunit_symtab_by_address(struct objfile *objfile, CORE_ADDR address) override
void dump(struct objfile *objfile) override
void read_partial_symbols(struct objfile *objfile) override
dwarf2_per_cu_data * find_per_cu(dwarf2_per_bfd *per_bfd, CORE_ADDR adjusted_pc) override
bool can_lazily_read_symbols() 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 expand_matching_symbols(struct objfile *, const lookup_name_info &lookup_name, domain_enum domain, int global, symbol_compare_ftype *ordered_compare) override
unsigned int is_protected
unsigned char building_fullname
struct attribute attrs[1]
struct attribute * attr(dwarf_attribute name)
ULONGEST gnu_ranges_base()
unsigned char has_children
__extension__ enum dwarf_tag tag
struct die_info * sibling
gdb::optional< ULONGEST > addr_base()
struct abbrev_table * abbrev_table
struct dwarf2_section_info * die_section
struct dwo_file * dwo_file
const gdb_byte * buffer_end
gdb::optional< block_enum > block_index
dwarf2_per_objfile * per_objfile
struct compunit_symtab * find_compunit_symtab_by_address(struct objfile *objfile, CORE_ADDR address) override
void print_stats(struct objfile *objfile, bool print_bcache) override
struct symtab * find_last_source_symtab(struct objfile *objfile) override
void expand_all_symtabs(struct objfile *objfile) override
void map_symbol_filenames(struct objfile *objfile, gdb::function_view< symbol_filename_ftype > fun, bool need_fullname) override
void forget_cached_source_info(struct objfile *objfile) override
bool has_unexpanded_symtabs(struct objfile *objfile) override
enum language lookup_global_symbol_language(struct objfile *objfile, const char *name, domain_enum domain, bool *symbol_found_p) override
bool has_symbols(struct objfile *objfile) override
struct compunit_symtab * find_pc_sect_compunit_symtab(struct objfile *objfile, struct bound_minimal_symbol msymbol, CORE_ADDR pc, struct obj_section *section, int warn_if_readin) override final
virtual dwarf2_per_cu_data * find_per_cu(dwarf2_per_bfd *per_bfd, CORE_ADDR adjusted_pc)
bool producer_is_gcc_lt_4_3
gdb::optional< ULONGEST > str_offsets_base
die_info * line_header_die_owner
bool processing_has_namespace_info
const struct language_defn * language_defn
void setup_type_unit_groups(struct die_info *die)
struct type * addr_type() const
bool producer_is_codewarrior
dwarf2_per_objfile * per_objfile
std::vector< struct type * > rust_unions
bool producer_is_icc_lt_14
gdb::optional< CORE_ADDR > base_address
gdb::optional< ULONGEST > addr_base
struct dwo_unit * dwo_unit
enum language lang() const
struct compunit_symtab * start_compunit_symtab(const char *name, const char *comp_dir, CORE_ADDR low_pc)
buildsym_compunit * get_builder()
struct pending ** list_in_scope
struct line_header * line_header
struct dwarf2_per_cu_data * per_cu
std::unique_ptr< buildsym_compunit > m_builder
auto_obstack comp_unit_obstack
struct type * addr_sized_int_type(bool unsigned_p) const
bool producer_is_gxx_lt_4_6
std::vector< delayed_method_info > method_list
void add_dependence(struct dwarf2_per_cu_data *ref_per_cu)
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
struct dwarf2_section_names line_str
struct dwarf2_section_names ranges
struct dwarf2_section_names rnglists
struct dwarf2_section_names frame
struct dwarf2_section_names loc
struct dwarf2_section_names types
struct dwarf2_section_names eh_frame
struct dwarf2_section_names str_offsets
struct dwarf2_section_names debug_aranges
struct dwarf2_section_names loclists
struct dwarf2_section_names gdb_index
struct dwarf2_section_names addr
struct dwarf2_section_names debug_names
struct dwarf2_section_names macro
struct dwarf2_section_names info
struct dwarf2_section_names str
struct dwarf2_section_names macinfo
struct dwarf2_section_names abbrev
struct dwarf2_section_names line
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 expand_matching_symbols(struct objfile *, const lookup_name_info &lookup_name, domain_enum domain, int global, symbol_compare_ftype *ordered_compare) override
void dump(struct objfile *objfile) override
struct dwarf2_per_cu_data * per_cu
dwarf2_per_objfile * per_objfile
struct dwarf2_per_cu_data * per_cu
dwarf2_per_objfile * per_objfile
dwarf2_section_info rnglists
dwarf2_section_info loclists
dwarf2_section_info macro
htab_up quick_file_names_table
struct addrmap * index_addrmap
dwarf2_per_cu_data_up allocate_per_cu()
dwarf2_section_info macinfo
gdb::array_view< dwarf2_per_cu_data_up > all_comp_units
dwarf2_per_cu_data * get_cu(int index) const
void map_info_sections(struct objfile *objfile)
void locate_sections(bfd *abfd, asection *sectp, const dwarf2_debug_sections &names)
dwarf2_section_info ranges
std::unique_ptr< dwarf_scanner_base > index_table
gdb::array_view< dwarf2_per_cu_data_up > all_type_units
dwarf2_section_info str_offsets
dwarf2_per_bfd(bfd *obfd, const dwarf2_debug_sections *names, bool can_copy)
std::vector< dwarf2_section_info > types
dwarf2_section_info line_str
dwarf2_section_info frame
signatured_type_up allocate_signatured_type(ULONGEST signature)
dwarf2_section_info eh_frame
dwarf2_section_info debug_aranges
std::unordered_map< sect_offset, std::vector< sect_offset >, gdb::hash_enum< sect_offset > > abstract_to_concrete
std::unique_ptr< struct dwp_file > dwp_file
dwarf2_section_info abbrev
dwarf2_section_info gdb_index
std::unique_ptr< index_cache_resource > index_cache_res
std::vector< dwarf2_per_cu_data_up > all_units
std::vector< dwarf2_per_cu_data * > just_read_cus
void operator()(dwarf2_per_cu_data *data)
std::atomic< bool > scanned
struct dwarf2_section_info * section
bool imported_symtabs_empty() const
unsigned int reading_dwo_directly
void set_version(short version)
void set_lang(enum language lang)
std::unique_ptr< file_and_directory > fnd
struct quick_file_names * file_names
const comp_unit_head * get_header() const
dwarf_unit_type unit_type(bool strict_p=true) const
void set_length(unsigned int length, bool strict_p=true)
std::vector< dwarf2_per_cu_data * > * imported_symtabs
void imported_symtabs_push(dwarf2_per_cu_data *p)
enum language lang(bool strict_p=true) const
packed< bool, 1 > addresses_seen
void free_cached_file_names()
unsigned int is_debug_types
int ref_addr_size() const
unsigned int length() const
void set_unit_type(dwarf_unit_type unit_type)
const struct dwarf2_per_cu_data * per_cu
std::unordered_map< type_unit_group *, type_unit_group_unshareable_up > m_type_units
std::unordered_map< signatured_type *, struct type * > m_type_map
compunit_symtab * get_symtab(const dwarf2_per_cu_data *per_cu) const
type_unit_group_unshareable * get_type_unit_group_unshareable(type_unit_group *tu_group)
void remove_cu(dwarf2_per_cu_data *per_cu)
const char * read_line_string(const gdb_byte *buf, const struct comp_unit_head *cu_header, unsigned int *bytes_read_ptr)
std::unique_ptr< type_unit_group_unshareable > type_unit_group_unshareable_up
void set_type_for_signatured_type(signatured_type *sig_type, struct type *type)
void set_cu(dwarf2_per_cu_data *per_cu, std::unique_ptr< dwarf2_cu > cu)
struct type * get_type_for_signatured_type(signatured_type *sig_type) const
gdb::optional< std::queue< dwarf2_queue_item > > queue
std::unordered_map< dwarf2_per_cu_data *, std::unique_ptr< dwarf2_cu > > m_dwarf2_cus
void set_symtab(const dwarf2_per_cu_data *per_cu, compunit_symtab *symtab)
struct dwarf2_per_bfd * per_bfd
bool symtab_set_p(const dwarf2_per_cu_data *per_cu) const
std::vector< compunit_symtab * > m_symtabs
dwarf2_cu * get_cu(dwarf2_per_cu_data *per_cu)
struct dwarf2_offset_baton offset_info
struct dwarf2_locexpr_baton locexpr
struct dwarf2_loclist_baton loclist
struct type * property_type
dwarf2_per_objfile * per_objfile
enum language pretend_language
dwarf2_per_cu_data * per_cu
void read(struct objfile *objfile)
union dwarf2_section_info::@50 s
bfd_size_type virtual_offset
const char * get_name() const
void overflow_complaint() const
const char * read_string(struct objfile *objfile, LONGEST str_offset, const char *form_name)
struct dwarf2_section_info * containing_section
const char * get_file_name() const
struct bfd * get_bfd_owner() const
bool matches(const char *name) const
DISABLE_COPY_AND_ASSIGN(dwo_file)
struct dwarf2_section_info rnglists
std::vector< dwarf2_section_info > types
struct dwarf2_section_info abbrev
struct dwarf2_section_info str_offsets
struct dwarf2_section_info loclists
struct dwarf2_section_info macro
struct dwarf2_section_info loc
struct dwarf2_section_info info
struct dwarf2_section_info macinfo
struct dwarf2_section_info str
struct dwarf2_section_info line
struct dwarf2_section_info * section
cu_offset type_offset_in_tu
struct dwo_file * dwo_file
struct dwarf2_section_names str_dwo
struct dwarf2_section_names types_dwo
struct dwarf2_section_names loclists_dwo
struct dwarf2_section_names str_offsets_dwo
struct dwarf2_section_names line_dwo
struct dwarf2_section_names cu_index
struct dwarf2_section_names tu_index
struct dwarf2_section_names macinfo_dwo
struct dwarf2_section_names rnglists_dwo
struct dwarf2_section_names info_dwo
struct dwarf2_section_names macro_dwo
struct dwarf2_section_names loc_dwo
struct dwarf2_section_names abbrev_dwo
unsigned int num_sections
const struct dwp_hash_table * tus
const struct dwp_hash_table * cus
dwp_file(const char *name_, gdb_bfd_ref_ptr &&abfd)
int section_ids[MAX_NR_V2_DWO_SECTIONS]
const gdb_byte * unit_table
union dwp_hash_table::@46 section_pool
const gdb_byte * hash_table
struct dwp_hash_table::@46::@49 v5
struct dwp_hash_table::@46::@47 v1
struct dwp_hash_table::@46::@48 v2
struct dwarf2_section_info loc
struct dwarf2_section_info cu_index
struct dwarf2_section_info rnglists
struct dwarf2_section_info str
struct dwarf2_section_info line
struct dwarf2_section_info info
struct dwarf2_section_info macro
struct dwarf2_section_info tu_index
struct dwarf2_section_info str_offsets
struct dwarf2_section_info types
struct dwarf2_section_info macinfo
struct dwarf2_section_info loclists
struct dwarf2_section_info abbrev
const char * read_string(struct objfile *objfile, LONGEST str_offset)
std::unique_ptr< index_cache_resource > index_cache_res
LONGEST const_val() const
dynamic_prop_kind kind() const
void set_loclist(void *baton)
void set_variable_name(const char *name)
void set_addr_offset(void *baton)
void set_locexpr(void *baton)
void set_variant_parts(gdb::array_view< variant_part > *variant_parts)
void set_const_val(LONGEST const_val)
std::vector< struct nextfield > fields
std::vector< struct fnfieldlist > fnfieldlists
std::vector< variant_part_builder > variant_parts
std::vector< struct decl_field > typedef_field_list
std::vector< struct decl_field > nested_types_list
variant_part_builder * current_variant_part
std::vector< struct nextfield > baseclasses
void set_type(struct type *type)
void set_loc_bitpos(LONGEST bitpos)
LONGEST loc_bitpos() const
void set_loc_dwarf_block(dwarf2_locexpr_baton *dwarf_block)
void set_loc_physname(const char *physname)
field_loc_kind loc_kind() const
LONGEST loc_enumval() const
void set_loc_enumval(LONGEST enumval)
void set_name(const char *name)
const char * name() const
struct type * type() const
const char * get_name() const
void set_name(gdb::unique_xmalloc_ptr< char > name)
const char * get_comp_dir() const
void set_comp_dir(std::string &&dir)
const char * get_fullname()
const char * intern_comp_dir(struct objfile *objfile)
const char * include_dir(const line_header *lh) const
unsigned int is_artificial
__extension__ enum dwarf_defaulted_attribute defaulted
unsigned int is_constructor
unsigned int is_protected
struct fn_field * fn_fields
std::vector< struct fn_field > fnfields
void set_demangled_name(const char *name, struct obstack *obstack)
const char * natural_name() const
const char * print_name() const
void compute_and_set_names(gdb::string_view linkage_name, bool copy_name, struct objfile_per_bfd_storage *per_bfd, gdb::optional< hashval_t > hash=gdb::optional< hashval_t >())
const char * search_name() const
enum language language() const
void set_language(enum language language, struct obstack *obstack)
short section_index() const
const char * linkage_name() const
void set_linkage_name(const char *linkage_name)
enum language la_language
virtual void print_type(struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags) const =0
symbol_name_matcher_ftype * get_symbol_name_matcher(const lookup_name_info &lookup_name) const
virtual char * class_name_from_physname(const char *physname) const
virtual bool store_sym_names_in_linkage_form_p() const
virtual void printchar(int ch, struct type *chtype, struct ui_file *stream) const
virtual enum array_ordering array_ordering() const
struct dynamic_prop_list * dyn_prop_list
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
virtual size_t symbol_name_count() const =0
enum case_sensitivity name_components_casing
std::pair< std::vector< name_component >::const_iterator, std::vector< name_component >::const_iterator > find_name_components_bounds(const lookup_name_info &ln_no_params, enum language lang, dwarf2_per_objfile *per_objfile) const
void build_name_components(dwarf2_per_objfile *per_objfile)
std::vector< name_component > name_components
virtual const char * symbol_name_at(offset_type idx, dwarf2_per_objfile *per_objfile) const =0
virtual bool symbol_name_slot_invalid(offset_type idx) const
offset_type symbol_name_index(offset_type idx) const
gdb::array_view< const gdb_byte > constant_pool
gdb::array_view< const gdb_byte > address_table
size_t symbol_name_count() const override
const char * symbol_name_at(offset_type idx, dwarf2_per_objfile *per_objfile) const override
bool symbol_name_slot_invalid(offset_type idx) const override
offset_type symbol_vec_index(offset_type idx) const
bool version_check() const override
quick_symbol_functions_up make_quick_functions() const override
auto_obstack storage_obstack
struct type * builtin_int
struct type * builtin_void
const char * original_name
struct objfile * separate_debug_objfile_backlink
struct gdbarch * arch() const
struct objfile_per_bfd_storage * per_bfd
CORE_ADDR text_section_offset() const
const char * intern(const char *str)
auto_obstack objfile_obstack
std::forward_list< quick_symbol_functions_up > qf
CORE_ADDR data_section_offset() const
struct symbol * template_symbols
::section_offsets section_offsets
struct symbol * symbol[PENDINGSIZE]
unsigned int num_file_names
struct stmt_list_hash hash
unsigned int flag_upper_bound_is_count
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 expand_matching_symbols(struct objfile *, const lookup_name_info &lookup_name, domain_enum domain, int global, symbol_compare_ftype *ordered_compare) override
void dump(struct objfile *objfile) override
struct type * concrete_type
struct dwo_unit * dwo_unit
sect_offset type_offset_in_section
struct type_unit_group * type_unit_group
cu_offset type_offset_in_tu
dwarf2_per_objfile * per_objfile
cooked_index_storage * storage
struct dwo_unit * dwo_unit
sect_offset line_sect_off
address_class aclass() const
struct type * type() const
void set_line(unsigned short line)
void set_aclass_index(unsigned int aclass_index)
void set_is_artificial(bool artificial)
__extension__ enum symbol_subclass_kind subclass
void set_type(struct type *type)
void set_is_argument(bool is_argument)
void set_value_address(CORE_ADDR address)
CORE_ADDR value_address() const
void set_value_bytes(const gdb_byte *bytes)
void set_is_inlined(bool is_inlined)
void set_value_longest(LONGEST value)
struct symbol * hash_next
void set_domain(domain_enum domain)
void set_symtab(struct symtab *symtab)
void set_value_common_block(const common_block *common_block)
enum language language() const
void set_language(enum language language)
struct symbol ** template_arguments
tu_abbrev_offset(signatured_type *sig_type_, sect_offset abbrev_offset_)
signatured_type * sig_type
sect_offset abbrev_offset
bool operator<(const tu_abbrev_offset &other) const
int nr_stmt_less_type_units
int nr_all_type_units_reallocs
int nr_uniq_abbrev_tables
struct compunit_symtab * compunit_symtab
struct type * target_type() const
void set_is_prototyped(bool is_prototyped)
void set_code(type_code code)
void set_is_multi_dimensional(bool value)
void set_endianity_is_not_default(bool endianity_is_not_default)
struct field & field(int idx) const
void set_has_no_signedness(bool has_no_signedness)
void set_index_type(type *index_type)
void set_target_type(struct type *target_type)
struct main_type * main_type
void set_is_unsigned(bool is_unsigned)
void set_is_stub(bool is_stub)
void set_is_declared_class(bool is_declared_class) const
void set_has_varargs(bool has_varargs)
void set_is_flag_enum(bool is_flag_enum)
void set_bounds(range_bounds *bounds)
void set_num_fields(int num_fields)
bool is_declared_class() const
bool has_no_signedness() const
void add_dyn_prop(dynamic_prop_node_kind kind, dynamic_prop prop)
void set_name(const char *name)
struct fixed_point_type_info & fixed_point_info() const
ULONGEST bit_stride() const
void set_length(ULONGEST length)
struct field * fields() const
range_bounds * bounds() const
const char * name() const
type * index_type() const
void set_stub_is_supported(bool stub_is_supported)
unsigned short bit_offset() const
void set_fields(struct field *fields)
void set_target_is_stub(bool target_is_stub)
struct dwarf_block * discr_list_data
std::vector< variant_part_builder > variant_parts
ULONGEST discriminant_value
sect_offset discriminant_offset
std::vector< variant_field > variants
gdb::array_view< variant > variants
gdb::array_view< variant_part > parts
gdb::array_view< discriminant_range > discriminants
struct dwarf2_section_info info_or_types
struct dwarf2_section_info abbrev
struct dwarf2_section_info macro
struct dwarf2_section_info str_offsets
struct dwarf2_section_info macinfo
struct dwarf2_section_info line
struct dwarf2_section_info loc
bfd_size_type abbrev_offset
bfd_size_type abbrev_size
bfd_size_type macro_offset
bfd_size_type str_offsets_offset
bfd_size_type loclists_offset
bfd_size_type rnglists_size
bfd_size_type str_offsets_size
bfd_size_type macinfo_offset
bfd_size_type macinfo_size
bfd_size_type rnglists_offset
bfd_size_type line_offset
bfd_size_type info_or_types_size
bfd_size_type info_or_types_offset
bfd_size_type loclists_size
struct symtab * allocate_symtab(struct compunit_symtab *cust, const char *filename, const char *filename_for_id)
scoped_restore_tmpl< int > increment_reading_symtab(void)
int register_symbol_block_impl(enum address_class aclass, const struct symbol_block_ops *ops)
int register_symbol_computed_impl(enum address_class aclass, const struct symbol_computed_ops *ops)
bool producer_is_realview(const char *producer)
struct symbol * fixup_symbol_section(struct symbol *sym, struct objfile *objfile)
bool basenames_may_differ
bool() symbol_name_matcher_ftype(const char *symbol_search_name, const lookup_name_info &lookup_name, completion_match_result *comp_match_res)
#define SYMBOL_COMPUTED_OPS(symbol)
#define SYMBOL_LOCATION_BATON(symbol)
const struct type_print_options type_print_raw_options
std::string ldirname(const char *filename)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
void gdb_printf(struct ui_file *stream, const char *format,...)
void gdb_puts(const char *linebuffer, struct ui_file *stream)
void get_formatted_print_options(struct value_print_options *opts, char format)
void value_print(struct value *val, struct ui_file *stream, const struct value_print_options *options)
struct value * allocate_value(struct type *type)
struct value * value_from_longest(struct type *type, LONGEST num)
gdb::array_view< gdb_byte > value_contents_writeable(struct value *value)
value_ref_ptr release_value(struct value *val)