73#include "gdb/gdb-index.h"
79#include "gdbsupport/function-view.h"
80#include "gdbsupport/gdb_optional.h"
81#include "gdbsupport/underlying.h"
82#include "gdbsupport/hash_enum.h"
87#include <unordered_map>
88#include "gdbsupport/selftest.h"
90#include "gdbsupport/pathstuff.h"
91#include "count-one-bits.h"
92#include <unordered_set>
96#include "gdbsupport/parallel-for.h"
97#include "gdbsupport/thread-pool.h"
106#define dwarf_read_debug_printf(fmt, ...) \
107 debug_prefixed_printf_cond (dwarf_read_debug >= 1, "dwarf-read", fmt, \
112#define dwarf_read_debug_printf_v(fmt, ...) \
113 debug_prefixed_printf_cond (dwarf_read_debug >= 2, "dwarf-read", fmt, \
151#define LOCLIST_HEADER_SIZE32 12
154#define LOCLIST_HEADER_SIZE64 20
157#define RNGLIST_HEADER_SIZE32 12
160#define RNGLIST_HEADER_SIZE64 20
177 {
".debug_info",
".zdebug_info" },
178 {
".debug_abbrev",
".zdebug_abbrev" },
179 {
".debug_line",
".zdebug_line" },
180 {
".debug_loc",
".zdebug_loc" },
181 {
".debug_loclists",
".zdebug_loclists" },
182 {
".debug_macinfo",
".zdebug_macinfo" },
183 {
".debug_macro",
".zdebug_macro" },
184 {
".debug_str",
".zdebug_str" },
185 {
".debug_str_offsets",
".zdebug_str_offsets" },
186 {
".debug_line_str",
".zdebug_line_str" },
187 {
".debug_ranges",
".zdebug_ranges" },
188 {
".debug_rnglists",
".zdebug_rnglists" },
189 {
".debug_types",
".zdebug_types" },
190 {
".debug_addr",
".zdebug_addr" },
191 {
".debug_frame",
".zdebug_frame" },
192 {
".eh_frame", NULL },
193 {
".gdb_index",
".zgdb_index" },
194 {
".debug_names",
".zdebug_names" },
195 {
".debug_aranges",
".zdebug_aranges" },
219 {
".debug_abbrev.dwo",
".zdebug_abbrev.dwo" },
220 {
".debug_info.dwo",
".zdebug_info.dwo" },
221 {
".debug_line.dwo",
".zdebug_line.dwo" },
222 {
".debug_loc.dwo",
".zdebug_loc.dwo" },
223 {
".debug_loclists.dwo",
".zdebug_loclists.dwo" },
224 {
".debug_macinfo.dwo",
".zdebug_macinfo.dwo" },
225 {
".debug_macro.dwo",
".zdebug_macro.dwo" },
226 {
".debug_rnglists.dwo",
".zdebug_rnglists.dwo" },
227 {
".debug_str.dwo",
".zdebug_str.dwo" },
228 {
".debug_str_offsets.dwo",
".zdebug_str_offsets.dwo" },
229 {
".debug_types.dwo",
".zdebug_types.dwo" },
230 {
".debug_cu_index",
".zdebug_cu_index" },
231 {
".debug_tu_index",
".zdebug_tu_index" },
298 std::vector<dwarf2_section_info>
types;
477#define MAX_NR_V2_DWO_SECTIONS \
492#define MAX_NR_V5_DWO_SECTIONS \
502 const gdb_byte *
sizes;
737 gdb_printf (file, _(
"The upper bound on the age of cached "
738 "DWARF compilation units is %s.\n"),
763 bool allow_reprocess =
true);
770 dwarf_tag tag = DW_TAG_padding);
773 unsigned int addr_index);
810 const char *comp_dir);
814 unrelocated_addr,
int decode_mapping);
830 const gdb_byte **
bytes,
859 const char *suffix,
int physname,
907 unrelocated_addr *, unrelocated_addr *,
960 const gdb_byte *info_ptr,
961 const gdb_byte **new_info_ptr,
965 struct die_info **,
const gdb_byte *,
971 gdb::array_view<attribute *> = {});
1038 const gdb_byte *info_ptr,
1040 bool do_skip_children =
true);
1043 (sect_offset
sect_off,
unsigned int offset_in_dwz,
1080 const char *linkagename);
1129 if (data->is_debug_types)
1142 std::string &name_holder);
1148 const char *comp_dir, ULONGEST
signature,
int is_debug_types);
1153 (
dwarf2_cu *cu,
const char *dwo_name,
const char *comp_dir,
1157 (
dwarf2_cu *cu,
const char *dwo_name,
const char *comp_dir);
1174 complaint (_(
".debug_line section has line data without a file"));
1180 complaint (_(
".debug_line section has line "
1181 "program sequence without an end"));
1187 complaint (_(
"location expression too complex"));
1194 complaint (_(
"const value length mismatch for '%s', got %d, expected %d"),
1201 complaint (_(
"invalid attribute class or form for '%s' in '%s'"),
1211 CORE_ADDR tem = (CORE_ADDR) addr + baseaddr;
1213 return (unrelocated_addr) (tem - baseaddr);
1222 CORE_ADDR tem = (CORE_ADDR) addr + baseaddr;
1261 can_copy (can_copy_)
1266 for (asection *sec =
obfd->sections; sec != NULL; sec = sec->next)
1279 per_cu->imported_symtabs_free ();
1280 per_cu->free_cached_file_names ();
1291 gdb_assert (!queue.has_value ());
1325 if (per_cu->
index < this->m_symtabs.size ())
1335 if (per_cu->
index < this->m_symtabs.size ())
1346 if (per_cu->
index >= this->m_symtabs.size ())
1369 if (per_objfile == NULL)
1385 if (per_bfd ==
nullptr)
1415 flagword aflag = bfd_section_flags (sectp);
1417 if ((aflag & SEC_HAS_CONTENTS) == 0)
1420 else if (elf_section_data (sectp)->this_hdr.sh_size
1421 > bfd_get_file_size (abfd))
1423 bfd_size_type
size = elf_section_data (sectp)->this_hdr.sh_size;
1424 warning (_(
"Discarding section %s which has a section size (%s"
1425 ") larger than the file size [in module %s]"),
1426 bfd_section_name (sectp), phex_nz (
size,
sizeof (
size)),
1427 bfd_get_filename (abfd));
1432 this->
info.
size = bfd_section_size (sectp);
1437 this->
abbrev.
size = bfd_section_size (sectp);
1441 this->line.s.section = sectp;
1442 this->line.size = bfd_section_size (sectp);
1447 this->
loc.
size = bfd_section_size (sectp);
1462 this->
macro.
size = bfd_section_size (sectp);
1466 this->str.s.section = sectp;
1467 this->str.size = bfd_section_size (sectp);
1482 this->
addr.
size = bfd_section_size (sectp);
1487 this->
frame.
size = bfd_section_size (sectp);
1497 this->
ranges.
size = bfd_section_size (sectp);
1508 memset (&type_section, 0,
sizeof (type_section));
1510 type_section.
size = bfd_section_size (sectp);
1512 this->
types.push_back (type_section);
1522 this->
debug_names.size = bfd_section_size (sectp);
1530 if ((bfd_section_flags (sectp) & (SEC_LOAD | SEC_ALLOC))
1531 && bfd_section_vma (sectp) == 0)
1541 asection **sectp,
const gdb_byte **bufp,
1542 bfd_size_type *sizep)
1549 if (per_objfile == NULL)
1565 gdb_assert_not_reached (
"unexpected section");
1570 *sectp = info->get_bfd_section ();
1571 *bufp = info->buffer;
1572 *sizep = info->size;
1590 for (
auto §ion :
types)
1645 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
1647 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
1648 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
1649 block_search_flags search_flags,
1712 return htab_up (htab_create_alloc (nr_initial_entries,
1805 result->per_bfd =
this;
1816 result->per_bfd =
this;
1818 result->is_debug_types =
true;
1829 sect_offset sect_off, ULONGEST length)
1832 the_cu->sect_off = sect_off;
1833 the_cu->set_length (length);
1834 the_cu->section = section;
1835 the_cu->is_dwz = is_dwz;
1851 std::unordered_map<sect_offset,
1853 gdb::hash_enum<sect_offset>>
1854 debug_info_offset_to_per_cu;
1855 for (
const auto &per_cu : per_bfd->
all_units)
1861 if (per_cu->is_debug_types || per_cu->is_dwz)
1864 const auto insertpair
1865 = debug_info_offset_to_per_cu.emplace (per_cu->sect_off,
1869 gdb_assert (insertpair.second);
1872 std::set<sect_offset> debug_info_offset_seen;
1878 const gdb_byte *addr = section->
buffer;
1880 while (addr < section->buffer + section->
size)
1882 const gdb_byte *
const entry_addr = addr;
1883 unsigned int bytes_read;
1889 const gdb_byte *
const entry_end = addr + entry_length;
1890 const bool dwarf5_is_dwarf64 = bytes_read != 4;
1891 const uint8_t offset_size = dwarf5_is_dwarf64 ? 8 : 4;
1892 if (addr + entry_length > section->
buffer + section->
size)
1894 warning (_(
"Section .debug_aranges in %s entry at offset %s "
1895 "length %s exceeds section length %s, "
1896 "ignoring .debug_aranges."),
1898 plongest (entry_addr - section->
buffer),
1899 plongest (bytes_read + entry_length),
1900 pulongest (section->
size));
1909 warning (_(
"Section .debug_aranges in %s entry at offset %s "
1910 "has unsupported version %d, ignoring .debug_aranges."),
1916 const uint64_t debug_info_offset
1918 addr += offset_size;
1919 const auto per_cu_it
1920 = debug_info_offset_to_per_cu.find (sect_offset (debug_info_offset));
1921 if (per_cu_it == debug_info_offset_to_per_cu.cend ())
1923 warning (_(
"Section .debug_aranges in %s entry at offset %s "
1924 "debug_info_offset %s does not exists, "
1925 "ignoring .debug_aranges."),
1927 plongest (entry_addr - section->
buffer),
1928 pulongest (debug_info_offset));
1931 const auto insertpair
1932 = debug_info_offset_seen.insert (sect_offset (debug_info_offset));
1933 if (!insertpair.second)
1935 warning (_(
"Section .debug_aranges in %s has duplicate "
1936 "debug_info_offset %s, ignoring .debug_aranges."),
1943 const uint8_t address_size = *addr++;
1944 if (address_size < 1 || address_size > 8)
1946 warning (_(
"Section .debug_aranges in %s entry at offset %s "
1947 "address_size %u is invalid, ignoring .debug_aranges."),
1949 plongest (entry_addr - section->
buffer), address_size);
1953 const uint8_t segment_selector_size = *addr++;
1954 if (segment_selector_size != 0)
1956 warning (_(
"Section .debug_aranges in %s entry at offset %s "
1957 "segment_selector_size %u is not supported, "
1958 "ignoring .debug_aranges."),
1960 plongest (entry_addr - section->
buffer),
1961 segment_selector_size);
1972 addr += (entry_end - addr) % (2 * address_size);
1974 while (addr < entry_end)
1976 if (addr + 2 * address_size > entry_end)
1978 warning (_(
"Section .debug_aranges in %s entry at offset %s "
1979 "address list is not properly terminated, "
1980 "ignoring .debug_aranges."),
1982 plongest (entry_addr - section->
buffer));
1987 addr += address_size;
1990 addr += address_size;
1991 if (start == 0 && length == 0)
2005 ULONGEST end = start + length;
2006 start = (ULONGEST) per_objfile->
adjust ((unrelocated_addr) start);
2007 end = (ULONGEST) per_objfile->
adjust ((unrelocated_addr) end);
2008 mutable_map->
set_empty (start, end - 1, per_cu);
2036 if (comp_unit_die->
tag == DW_TAG_partial_unit)
2047 attr =
dwarf2_attr (comp_unit_die, DW_AT_stmt_list, cu);
2059 &find_entry, INSERT);
2072 else if (lh ==
nullptr)
2079 if (slot !=
nullptr)
2082 std::vector<const char *> include_names;
2085 for (
const auto &entry : lh->file_names ())
2087 std::string name_holder;
2088 const char *include_name =
2090 if (include_name !=
nullptr)
2093 include_names.push_back (include_name);
2106 if (!include_names.empty ())
2107 memcpy (&qfn->
file_names[offset], include_names.data (),
2108 include_names.size () * sizeof (
const char *));
2148 const char *dirname =
nullptr;
2150 if (!IS_ABSOLUTE_PATH (qfn->
file_names[index]))
2153 gdb::unique_xmalloc_ptr<char> fullname;
2156 qfn->
real_names[index] = fullname.release ();
2182 fnd->forget_fullname ();
2188 if (file_data !=
nullptr && file_data->
real_names !=
nullptr)
2205 per_cu->free_cached_file_names ();
2219 for (
int i = 0; i < total; ++i)
2226 gdb_printf (_(
" Number of read CUs: %d\n"), total - count);
2227 gdb_printf (_(
" Number of unread CUs: %d\n"), count);
2236 for (
int i = 0; i < total_units; ++i)
2315 std::string after = search_name;
2316 while (!after.empty () && (
unsigned char) after.back () == 0xff)
2318 if (!after.empty ())
2319 after.back () = (
unsigned char) after.back () + 1;
2325std::pair<std::vector<name_component>::const_iterator,
2326 std::vector<name_component>::const_iterator>
2334 const char *lang_name
2343 const char *elem_name = elem_qualified + elem.
name_offset;
2344 return name_cmp (elem_name,
name) < 0;
2349 auto lookup_compare_upper = [&] (
const char *
name,
2353 const char *elem_name = elem_qualified + elem.
name_offset;
2354 return name_cmp (
name, elem_name) < 0;
2363 if (lookup_name_without_params.
completion_mode () && lang_name[0] ==
'\0')
2366 return std::lower_bound (begin, end, lang_name, lookup_compare_lower);
2388 return std::lower_bound (lower, end, after.c_str (),
2389 lookup_compare_lower);
2392 return std::upper_bound (lower, end, lang_name, lookup_compare_upper);
2395 return {lower, upper};
2422 unsigned int previous_len = 0;
2424 if (strstr (
name,
"::") !=
nullptr)
2427 name[current_len] !=
'\0';
2430 gdb_assert (
name[current_len] ==
':');
2434 previous_len = current_len;
2440 for (
const char *iter = strstr (
name,
"__");
2442 iter = strstr (iter,
"__"))
2446 previous_len = iter -
name;
2457 const char *left_qualified
2459 const char *right_qualified
2462 const char *left_name = left_qualified + left.
name_offset;
2463 const char *right_name = right_qualified + right.name_offset;
2465 return name_cmp (left_name, right_name) < 0;
2469 this->name_components.end (),
2479 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
2480 gdb::function_view<
bool (
offset_type)> match_callback,
2497 std::vector<offset_type> matches;
2499 struct name_and_matcher
2504 bool operator== (
const name_and_matcher &other)
const
2506 return matcher == other.matcher && strcmp (
name, other.name) == 0;
2512 std::vector<name_and_matcher> matchers;
2522 name_and_matcher key {
2531 if (std::find (matchers.begin (), matchers.end (), key)
2534 matchers.push_back (std::move (key));
2538 lang_e, per_objfile);
2543 for (; bounds.first != bounds.second; ++bounds.first)
2545 const char *qualified
2548 if (!name_matcher (qualified, lookup_name_without_params, NULL)
2549 || (symbol_matcher != NULL && !symbol_matcher (qualified)))
2552 matches.push_back (bounds.first->idx);
2556 std::sort (matches.begin (), matches.end ());
2565 if (!match_callback (idx))
2576 static_assert (
sizeof (prev) >
sizeof (
offset_type),
"");
2583namespace selftests {
namespace dw2_expand_symtabs_matching {
2592 mock_mapped_index (gdb::array_view<const char *> symbols)
2593 : m_symbol_table (symbols)
2596 DISABLE_COPY_AND_ASSIGN (mock_mapped_index);
2599 size_t symbol_name_count ()
const override
2601 return m_symbol_table.size ();
2605 const char *symbol_name_at
2608 return m_symbol_table[idx];
2617 gdb::array_view<const char *> m_symbol_table;
2624string_or_null (
const char *str)
2626 return str != NULL ? str :
"<null>";
2637check_match (
const char *file,
int line,
2638 mock_mapped_index &mock_index,
2640 bool completion_mode,
2641 std::initializer_list<const char *> expected_list,
2646 bool matched =
true;
2648 auto mismatch = [&] (
const char *expected_str,
2651 warning (_(
"%s:%d: match_type=%s, looking-for=\"%s\", "
2652 "expected=\"%s\", got=\"%s\"\n"),
2656 name, string_or_null (expected_str), string_or_null (got));
2660 auto expected_it = expected_list.begin ();
2661 auto expected_end = expected_list.end ();
2667 const char *matched_name = mock_index.symbol_name_at (idx, per_objfile);
2668 const char *expected_str
2669 = expected_it == expected_end ? NULL : *expected_it++;
2671 if (expected_str == NULL || strcmp (expected_str, matched_name) != 0)
2672 mismatch (expected_str, matched_name);
2676 const char *expected_str
2677 = expected_it == expected_end ? NULL : *expected_it++;
2678 if (expected_str != NULL)
2679 mismatch (expected_str, NULL);
2686static const char *test_symbols[] = {
2695 "ns2::tmpl<int>::foo2",
2696 "(anonymous namespace)::A::B::C",
2709 (
const char *)u8
"u8função",
2728 "z::std::tuple<(anonymous namespace)::ui*, std::bar<(anonymous namespace)::ui> >" \
2729 "::tuple<(anonymous namespace)::ui*, " \
2730 "std::default_delete<(anonymous namespace)::ui>, void>"
2741 const char *search_name,
2742 gdb::array_view<const char *> expected_syms,
2752 size_t distance = std::distance (bounds.first, bounds.second);
2753 if (distance != expected_syms.size ())
2756 for (
size_t exp_elem = 0; exp_elem < distance; exp_elem++)
2758 auto nc_elem = bounds.first + exp_elem;
2759 const char *qualified = index.
symbol_name_at (nc_elem->idx, per_objfile);
2760 if (strcmp (qualified, expected_syms[exp_elem]) != 0)
2771test_mapped_index_find_name_component_bounds ()
2773 mock_mapped_index mock_index (test_symbols);
2775 mock_index.build_name_components (NULL );
2780 static const char *expected_syms[] = {
2785 SELF_CHECK (check_find_bounds_finds
2786 (mock_index,
"t1_func", expected_syms,
2794 static const char *expected_syms1[] = {
2798 SELF_CHECK (check_find_bounds_finds
2799 (mock_index,
"\377", expected_syms1, NULL ));
2801 static const char *expected_syms2[] = {
2804 SELF_CHECK (check_find_bounds_finds
2805 (mock_index,
"\377\377", expected_syms2,
2813test_dw2_expand_symtabs_matching_symbol ()
2815 mock_mapped_index mock_index (test_symbols);
2819 bool any_mismatch =
false;
2824#define EXPECT(...) { __VA_ARGS__ }
2828#define CHECK_MATCH(NAME, MATCH_TYPE, COMPLETION_MODE, EXPECTED_LIST) \
2829 any_mismatch |= !check_match (__FILE__, __LINE__, \
2831 NAME, MATCH_TYPE, COMPLETION_MODE, \
2832 EXPECTED_LIST, NULL)
2835 for (
const char *sym : test_symbols)
2843 std::string with_params = std::string (sym) +
"(int)";
2849 with_params = std::string (sym) +
" ( int ) const";
2855 with_params = std::string (sym) +
" ( int ) &&";
2864 static const char str[] =
"\377";
2866 EXPECT (
"\377",
"\377\377123"));
2872 static const char str[] =
"t1_func";
2874 EXPECT (
"t1_func",
"t1_func1"));
2880 static const char str[] =
"function(int)";
2881 size_t len = strlen (str);
2884 for (
size_t i = 1; i < len; i++)
2886 lookup.assign (str, i);
2888 EXPECT (
"function"));
2903 static const char str[] = Z_SYM_NAME;
2904 size_t len = strlen (str);
2907 for (
size_t i = 1; i < len; i++)
2909 lookup.assign (str, i);
2911 EXPECT (Z_SYM_NAME));
2925 EXPECT (
"std::zfunction",
"std::zfunction2"));
2927 EXPECT (
"std::zfunction",
"std::zfunction2"));
2929 EXPECT (
"std::zfunction",
"std::zfunction2"));
2935 static const char expected[] =
"ns::foo<int>";
2945 static const char expected[] =
"ns::foo<char*>";
2947 static const bool completion_mode[2] = {
false,
true};
2948 for (
size_t i = 0; i < 2; i++)
2951 completion_mode[i], EXPECT (expected));
2953 completion_mode[i], EXPECT (expected));
2956 completion_mode[i], EXPECT (expected));
2958 completion_mode[i], EXPECT (expected));
2964 static const char expected[] =
"ns::foo<char*>";
2965 CHECK_MATCH (
"ns :: foo < char * > ( int ) const",
2967 CHECK_MATCH (
"ns :: foo < char * > ( int ) &&",
2969 CHECK_MATCH (
"foo < char * > ( int ) const",
2971 CHECK_MATCH (
"foo < char * > ( int ) &&",
2987 static const char *syms[] = {
2991 "A :: B :: C ( int )",
2996 for (
const char *s : syms)
2999 EXPECT (
"(anonymous namespace)::A::B::C"));
3004 static const char expected[] =
"ns2::tmpl<int>::foo2";
3011 SELF_CHECK (!any_mismatch);
3020 test_mapped_index_find_name_component_bounds ();
3021 test_dw2_expand_symtabs_matching_symbol ();
3034 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
3035 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify)
3037 if (file_matcher == NULL || per_cu->
mark)
3039 bool symtab_was_null = !per_objfile->
symtab_set_p (per_cu);
3043 gdb_assert (
symtab !=
nullptr);
3045 if (expansion_notify != NULL && symtab_was_null)
3046 return expansion_notify (
symtab);
3056 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher)
3058 if (file_matcher == NULL)
3061 htab_up visited_found (htab_create_alloc (10, htab_hash_pointer,
3064 htab_up visited_not_found (htab_create_alloc (10, htab_hash_pointer,
3075 if (per_cu->is_debug_types)
3083 if (per_cu->fnd !=
nullptr)
3087 if (file_matcher (fnd->
get_name (),
false))
3096 || file_matcher (lbasename (fnd->
get_name ()),
true))
3106 if (file_data == NULL)
3109 if (htab_find (visited_not_found.get (), file_data) != NULL)
3111 else if (htab_find (visited_found.get (), file_data) != NULL)
3119 const char *this_real_name;
3121 if (file_matcher (file_data->
file_names[j],
false))
3130 && !file_matcher (lbasename (file_data->
file_names[j]),
3135 if (file_matcher (this_real_name,
false))
3142 void **slot = htab_find_slot (per_cu->mark
3143 ? visited_found.get ()
3144 : visited_not_found.get (),
3167 for (i = 0; cust->
includes[i]; ++i)
3181 CORE_ADDR adjusted_pc)
3205 if (data ==
nullptr)
3208 if (warn_if_readin && per_objfile->
symtab_set_p (data))
3209 warning (_(
"(Internal error: pc %s in read in CU, but not in symtab.)"),
3215 if (warn_if_readin && result ==
nullptr)
3216 warning (_(
"(Error: pc %s in address map, but not in symtab.)"),
3225 gdb::function_view<symbol_filename_ftype> fun,
3232 std::unordered_set<quick_file_names *> qfn_cache;
3242 if (!per_cu->is_debug_types
3245 if (per_cu->file_names !=
nullptr)
3246 qfn_cache.insert (per_cu->file_names);
3254 if (per_cu->is_debug_types || per_objfile->
symtab_set_p (per_cu))
3257 if (per_cu->fnd !=
nullptr)
3261 const char *filename = fnd->
get_name ();
3262 const char *key = filename;
3263 const char *fullname =
nullptr;
3271 if (!filenames_cache.
seen (key))
3272 fun (filename, fullname);
3276 if (file_data ==
nullptr
3277 || qfn_cache.find (file_data) != qfn_cache.end ())
3282 const char *filename = file_data->
file_names[j];
3283 const char *key = filename;
3284 const char *fullname =
nullptr;
3292 if (!filenames_cache.
seen (key))
3293 fun (filename, fullname);
3327template <
typename T>
3328static gdb::array_view<const gdb_byte>
3355static gdb::array_view<const gdb_byte>
3359 if (build_id ==
nullptr)
3368static gdb::array_view<const gdb_byte>
3372 if (build_id ==
nullptr)
3463 catch (
const gdb_exception_error &except)
3483 if (attr !=
nullptr)
3488 if (attr !=
nullptr)
3505 abbrev = &per_bfd->
abbrev;
3515 sect_offset sect_off)
3518 const gdb_byte *info_ptr;
3519 unsigned int initial_length_size, offset_size;
3523 info_ptr =
section->buffer + to_underlying (sect_off);
3525 offset_size = initial_length_size == 4 ? 4 : 8;
3526 info_ptr += initial_length_size;
3536 return (sect_offset)
read_offset (abfd, info_ptr, offset_size);
3563 return htab_up (htab_create_alloc (41,
3582 const gdb_byte *info_ptr, *end_ptr;
3593 if (info_ptr == NULL)
3598 abfd =
section->get_bfd_owner ();
3603 end_ptr = info_ptr +
section->size;
3604 while (info_ptr < end_ptr)
3609 const gdb_byte *ptr = info_ptr;
3611 unsigned int length;
3623 abbrev_section, ptr, section_kind);
3628 if (ptr >= info_ptr + length
3630 || (header.unit_type != DW_UT_type
3631 && header.unit_type != DW_UT_split_type))
3637 if (types_htab == NULL)
3648 slot = htab_find_slot (types_htab.get (), dwo_tu, INSERT);
3649 gdb_assert (slot != NULL);
3651 complaint (_(
"debug type entry at offset %s is duplicate to"
3652 " the entry at offset %s, signature %s"),
3677 gdb::array_view<dwarf2_section_info> type_sections,
3678 htab_up &types_htab)
3701 (sig_type_holder.release ());
3708 gdb_assert (*slot == NULL);
3725 gdb_assert (! sig_entry->
queued);
3726 gdb_assert (per_objfile->
get_cu (sig_entry) == NULL);
3733 gdb_assert (sig_entry->
dwo_unit == NULL
3734 || sig_entry->
dwo_unit == dwo_entry);
3762 struct dwo_unit find_dwo_entry, *dwo_entry;
3780 &find_sig_entry, INSERT);
3792 if (sig_entry != NULL && sig_entry->
tu_read)
3805 if (dwo_entry == NULL)
3809 if (sig_entry == NULL)
3812 if (sig_entry->
dwo_unit ==
nullptr)
3841 &find_sig_entry, INSERT);
3847 if (sig_entry != NULL)
3854 if (dwo_entry == NULL)
3935 struct die_info *stub_comp_unit_die,
3936 const char *stub_comp_dir,
3938 const gdb_byte **result_info_ptr,
3939 struct die_info **result_comp_unit_die,
3946 const gdb_byte *begin_info_ptr, *info_ptr;
3950 gdb_assert ((stub_comp_unit_die != NULL) + (stub_comp_dir != NULL) <= 1);
3962 int next_attr_idx = 0;
3965 auto push_back = [&] (
struct attribute *attr)
3967 gdb_assert (next_attr_idx < ARRAY_SIZE (
attributes));
3968 if (attr !=
nullptr)
3972 if (stub_comp_unit_die != NULL)
3977 push_back (
dwarf2_attr (stub_comp_unit_die, DW_AT_stmt_list, cu));
3978 push_back (
dwarf2_attr (stub_comp_unit_die, DW_AT_low_pc, cu));
3979 push_back (
dwarf2_attr (stub_comp_unit_die, DW_AT_high_pc, cu));
3980 push_back (
dwarf2_attr (stub_comp_unit_die, DW_AT_ranges, cu));
3981 push_back (
dwarf2_attr (stub_comp_unit_die, DW_AT_comp_dir, cu));
3997 else if (stub_comp_dir != NULL)
4002 comp_dir->
name = DW_AT_comp_dir;
4003 comp_dir->
form = DW_FORM_string;
4005 push_back (comp_dir);
4013 begin_info_ptr = info_ptr = (section->
buffer
4027 error (_(
"Dwarf Error: signature mismatch %s vs %s while reading"
4028 " TU at offset %s [in module %s]"),
4032 bfd_get_filename (abfd));
4057 *result_dwo_abbrev_table
4060 result_dwo_abbrev_table->get ());
4075 *result_info_ptr = info_ptr;
4082static gdb::optional<ULONGEST>
4088 attr =
dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_id, cu);
4090 return gdb::optional<ULONGEST> ();
4104 static std::mutex dwo_lock;
4106 std::lock_guard<std::mutex> guard (dwo_lock);
4111 const char *comp_dir;
4113 gdb_assert (cu != NULL);
4126 error (_(
"Dwarf Error: missing dwo_id for dwo_name %s"
4128 dwo_name, bfd_get_filename (per_cu->
per_bfd->
obfd));
4151 gdb_assert (sig_type->
dwo_unit != NULL);
4155 if (existing_cu !=
nullptr)
4166 gdb_assert (per_objfile->
get_cu (this_cu) ==
nullptr);
4209 const gdb_byte *begin_info_ptr;
4215 int rereading_dwo_cu = 0;
4227 gdb_assert (this_cu->is_debug_types);
4228 gdb_assert (abbrev_table == NULL);
4229 init_tu_and_read_dwo_dies (this_cu, per_objfile, existing_cu);
4242 if (existing_cu !=
nullptr)
4252 rereading_dwo_cu = 1;
4262 gdb_assert (cache !=
nullptr
4263 || per_objfile->
get_cu (this_cu) ==
nullptr);
4272 info_ptr += to_underlying (cu->header.first_die_cu_offset);
4276 if (this_cu->is_debug_types)
4278 info_ptr = read_and_check_comp_unit_head (per_objfile, &cu->header,
4279 section, abbrev_section,
4280 info_ptr, rcuh_kind::TYPE);
4284 sig_type = (struct signatured_type *) this_cu;
4285 gdb_assert (sig_type->signature == cu->header.signature);
4286 gdb_assert (sig_type->type_offset_in_tu
4287 == cu->header.type_cu_offset_in_tu);
4288 gdb_assert (this_cu->sect_off == cu->header.sect_off);
4292 this_cu->set_length (cu->header.get_length_with_initial ());
4295 sig_type->type_offset_in_section =
4296 this_cu->sect_off + to_underlying (sig_type->type_offset_in_tu);
4298 this_cu->set_version (cu->header.version);
4302 info_ptr = read_and_check_comp_unit_head (per_objfile, &cu->header,
4303 section, abbrev_section,
4305 rcuh_kind::COMPILE);
4307 gdb_assert (this_cu->sect_off == cu->header.sect_off);
4308 this_cu->set_length (cu->header.get_length_with_initial ());
4309 this_cu->set_version (cu->header.version);
4314 if (info_ptr >= begin_info_ptr + this_cu->length ()
4328 if (cache != nullptr)
4329 abbrev_table = cache->find (abbrev_section,
4330 cu->header.abbrev_sect_off);
4331 if (abbrev_table == nullptr)
4333 abbrev_section->read (objfile);
4334 m_abbrev_table_holder
4335 = abbrev_table::read (abbrev_section, cu->header.abbrev_sect_off);
4336 abbrev_table = m_abbrev_table_holder.get ();
4344 if (skip_partial && comp_unit_die->tag == DW_TAG_partial_unit)
4359 if (dwo_name !=
nullptr)
4362 struct die_info *dwo_comp_unit_die;
4364 if (comp_unit_die->has_children)
4366 complaint (_(
"compilation unit with DW_AT_GNU_dwo_name"
4367 " has children (offset %s) [in module %s]"),
4369 bfd_get_filename (abfd));
4375 comp_unit_die, NULL,
4378 &m_dwo_abbrev_table) == 0)
4384 comp_unit_die = dwo_comp_unit_die;
4438 const gdb_byte *begin_info_ptr, *
info_ptr;
4445 gdb_assert (per_objfile->
get_cu (this_cu) ==
nullptr);
4463 if (parent_cu !=
nullptr)
4519 return htab_up (htab_create_alloc (3,
4522 htab_delete_entry<type_unit_group>,
4529#define NO_STMT_LIST_TYPE_UNIT_PSYMTAB (1 << 31)
4530#define NO_STMT_LIST_TYPE_UNIT_PSYMTAB_SIZE 10
4535static std::unique_ptr<type_unit_group>
4538 auto tu_group = gdb::make_unique<type_unit_group> ();
4540 tu_group->hash.dwo_unit = cu->
dwo_unit;
4541 tu_group->hash.line_sect_off = line_offset_struct;
4582 type_unit_group_for_lookup.
hash.dwo_unit = cu->
dwo_unit;
4583 type_unit_group_for_lookup.
hash.line_sect_off = (sect_offset)
line_offset;
4585 &type_unit_group_for_lookup, INSERT);
4586 if (*slot ==
nullptr)
4588 sect_offset line_offset_struct = (sect_offset)
line_offset;
4589 std::unique_ptr<type_unit_group> grp
4591 *slot = grp.release ();
4596 gdb_assert (tu_group !=
nullptr);
4629 int index = per_cu->
index;
4639 int index = reader->cu->per_cu->index;
4640 void **slot = htab_find_slot_with_hash (
m_reader_hash.get (), &index,
4642 gdb_assert (*slot ==
nullptr);
4644 *slot = reader.release ();
4651 cooked_index_flag
flags,
4686 const int *rb = (
const int *) b;
4727 CORE_ADDR
value = to_underlying (offset);
4729 value |= ((CORE_ADDR) 1) << (8 *
sizeof (CORE_ADDR) - 1);
4743 sect_offset sect_off,
4754 const gdb_byte *info_ptr,
4762 const gdb_byte *watermark_ptr,
4763 const gdb_byte *info_ptr,
4766 const char **linkage_name,
4767 cooked_index_flag *
flags,
4768 sect_offset *sibling_offset,
4770 CORE_ADDR *maybe_defer,
4771 bool for_specification);
4777 const gdb_byte *info_ptr,
4783 const gdb_byte *info_ptr,
4830 cutu_reader reader (this_cu, per_objfile,
nullptr,
nullptr,
false,
4845 if (this_cu->
scanned.compare_exchange_strong (nope,
true))
4849 gdb_assert (storage !=
nullptr);
4873 gdb_assert (storage !=
nullptr);
4919 sect_offset abbrev_offset;
4950 std::vector<tu_abbrev_offset> sorted_by_abbrev;
4955 if (cu->is_debug_types)
4958 sorted_by_abbrev.emplace_back
4960 sig_type->sect_off));
4964 std::sort (sorted_by_abbrev.begin (), sorted_by_abbrev.end ());
4966 abbrev_offset = (sect_offset) ~(
unsigned) 0;
4972 || tu.abbrev_offset != abbrev_offset)
4974 abbrev_offset = tu.abbrev_offset;
5026 if (data->per_objfile->per_bfd->signatured_types == NULL)
5027 data->per_objfile->per_bfd->signatured_types
5031 slot = htab_find_slot (data->per_objfile->per_bfd->signatured_types.get (),
5032 &find_entry, INSERT);
5046 cutu_reader reader (entry, data->per_objfile,
nullptr,
nullptr,
false);
5104 std::vector<std::unique_ptr<cooked_index_shard>> indexes;
5106 per_bfd->quick_file_names_table
5108 if (!
per_bfd->debug_aranges.empty ())
5116 using iter_type =
decltype (
per_bfd->all_units.begin ());
5118 auto task_size_ = [] (iter_type iter)
5121 return (
size_t)per_cu->
length ();
5123 auto task_size = gdb::make_function_view (task_size_);
5130 using result_type = std::pair<std::unique_ptr<cooked_index_shard>,
5131 std::vector<gdb_exception>>;
5132 std::vector<result_type> results
5133 = gdb::parallel_for_each (1,
per_bfd->all_units.begin (),
5135 [=] (iter_type iter, iter_type end)
5137 std::vector<gdb_exception> errors;
5138 cooked_index_storage thread_storage;
5139 for (; iter != end; ++iter)
5141 dwarf2_per_cu_data *per_cu = iter->get ();
5144 process_psymtab_comp_unit (per_cu, per_objfile,
5147 catch (gdb_exception &except)
5149 errors.push_back (std::move (except));
5152 return result_type (thread_storage.release (), std::move (errors));
5156 std::unordered_set<gdb_exception> seen_exceptions;
5157 for (
auto &one_result : results)
5159 indexes.push_back (std::move (one_result.first));
5160 for (
auto &one_exc : one_result.second)
5161 if (seen_exceptions.insert (one_exc).second)
5172 indexes.push_back (index_storage.release ());
5173 indexes.shrink_to_fit ();
5176 per_bfd->index_table.reset (vec);
5183 if (main_entry !=
nullptr)
5204 unsigned int is_dwz,
5205 htab_up &types_htab,
5208 const gdb_byte *info_ptr;
5217 info_ptr = section->
buffer;
5219 while (info_ptr < section->buffer + section->
size)
5223 sect_offset sect_off = (sect_offset) (info_ptr - section->
buffer);
5227 abbrev_section, info_ptr,
5231 if (cu_header.unit_type != DW_UT_type)
5235 if (types_htab ==
nullptr)
5242 this_cu.reset (sig_type.release ());
5244 void **slot = htab_find_slot (types_htab.get (), sig_ptr, INSERT);
5245 gdb_assert (slot !=
nullptr);
5246 if (*slot !=
nullptr)
5247 complaint (_(
"debug type entry at offset %s is duplicate to"
5248 " the entry at offset %s, signature %s"),
5254 this_cu->sect_off = sect_off;
5256 this_cu->is_dwz = is_dwz;
5257 this_cu->section = section;
5261 this_cu->set_version (cu_header.
version);
5263 info_ptr = info_ptr + this_cu->length ();
5273 size_t nr_tus =
per_bfd->tu_stats.nr_tus;
5274 size_t nr_cus =
per_bfd->all_units.size () - nr_tus;
5275 gdb::array_view<dwarf2_per_cu_data_up> tmp =
per_bfd->all_units;
5276 per_bfd->all_comp_units = tmp.slice (0, nr_cus);
5277 per_bfd->all_type_units = tmp.slice (nr_cus, nr_tus);
5302 catch (
const gdb_exception_error &)
5318 if (!dwz->
types.empty ())
5321 error (_(
"Dwarf Error: .debug_types section not supported in dwz file"));
5335 unsigned int bytes_read;
5349 const gdb_byte *info_ptr,
unsigned int *bytes_read)
5352 bfd *abfd = reader.
abfd;
5353 unsigned int abbrev_number
5356 if (abbrev_number == 0)
5363 error (_(
"Dwarf Error: Could not find abbrev number %d in %s"
5364 " at offset %s [in module %s]"),
5376static const gdb_byte *
5381 unsigned int bytes_read;
5386 return info_ptr + bytes_read;
5388 info_ptr =
skip_one_die (reader, info_ptr + bytes_read, abbrev);
5401static const gdb_byte *
5403 const struct abbrev_info *abbrev,
bool do_skip_children)
5405 unsigned int bytes_read;
5407 bfd *abfd = reader->
abfd;
5409 const gdb_byte *buffer = reader->
buffer;
5410 const gdb_byte *buffer_end = reader->
buffer_end;
5411 unsigned int form, i;
5413 if (do_skip_children && abbrev->
sibling_offset != (
unsigned short) -1)
5416 const gdb_byte *sibling_data = info_ptr + abbrev->
sibling_offset;
5417 unsigned int offset =
read_4_bytes (abfd, sibling_data);
5418 const gdb_byte *sibling_ptr
5420 if (sibling_ptr >= info_ptr && sibling_ptr < reader->buffer_end)
5435 if (do_skip_children && abbrev->
attrs[i].
name == DW_AT_sibling)
5441 if (attr.
form == DW_FORM_ref_addr)
5442 complaint (_(
"ignoring absolute DW_AT_sibling"));
5446 const gdb_byte *sibling_ptr = buffer + to_underlying (off);
5448 if (sibling_ptr < info_ptr)
5449 complaint (_(
"DW_AT_sibling points backwards"));
5462 case DW_FORM_ref_addr:
5470 case DW_FORM_GNU_ref_alt:
5482 case DW_FORM_flag_present:
5483 case DW_FORM_implicit_const:
5500 case DW_FORM_ref_sig8:
5503 case DW_FORM_data16:
5506 case DW_FORM_string:
5508 info_ptr += bytes_read;
5510 case DW_FORM_sec_offset:
5512 case DW_FORM_GNU_strp_alt:
5515 case DW_FORM_exprloc:
5518 info_ptr += bytes_read;
5520 case DW_FORM_block1:
5523 case DW_FORM_block2:
5526 case DW_FORM_block4:
5533 case DW_FORM_ref_udata:
5534 case DW_FORM_GNU_addr_index:
5535 case DW_FORM_GNU_str_index:
5536 case DW_FORM_rnglistx:
5537 case DW_FORM_loclistx:
5540 case DW_FORM_indirect:
5542 info_ptr += bytes_read;
5545 goto skip_attribute;
5548 error (_(
"Dwarf Error: Cannot handle %s "
5549 "in DWARF reader [in module %s]"),
5551 bfd_get_filename (abfd));
5609 if (dependent_cu != NULL)
5627 bool queued =
false;
5643 return queued && cu ==
nullptr;
5668 unsigned int debug_print_threshold;
5676 sprintf (buf,
"TU %s at offset %s",
5681 debug_print_threshold = 2;
5685 sprintf (buf,
"CU at offset %s",
5687 debug_print_threshold = 1;
5704 per_objfile->
queue->pop ();
5727 cutu_reader reader (this_cu, per_objfile, NULL, existing_cu, skip_partial);
5732 const gdb_byte *info_ptr = reader.
info_ptr;
5741 hashtab_obstack_allocate,
5742 dummy_obstack_deallocate);
5786 size_t mod_len =
sizeof (mod) - 1;
5787 if (len > mod_len && startswith (physname + (len - mod_len), mod))
5811 const char *physname;
5816 = physname ? physname :
"";
5821 if (physname != NULL)
5823 size_t len = strlen (physname);
5827 if (physname[len] ==
')')
5857 gdb::unique_xmalloc_ptr<char> package_name;
5865 for (i = 0; i < list->
nsyms; ++i)
5872 gdb::unique_xmalloc_ptr<char> this_package_name
5875 if (this_package_name == NULL)
5877 if (package_name == NULL)
5878 package_name = std::move (this_package_name);
5882 if (strcmp (package_name.get (), this_package_name.get ()) != 0)
5883 complaint (_(
"Symtab %s has objects from two different Go packages: %s and %s"),
5888 this_package_name.get (), package_name.get ());
5894 if (package_name != NULL)
5897 const char *saved_package_name =
objfile->
intern (package_name.get ());
5900 saved_package_name);
5922 return obconcat (
obstack, p1,
"::", p2, (
char *) NULL);
5939 int discriminant_index,
int default_index,
5940 gdb::array_view<discriminant_range> ranges)
5943 gdb_assert (discriminant_index == -1
5944 || (discriminant_index >= 0
5945 && discriminant_index < type->num_fields ()));
5946 gdb_assert (default_index == -1
5947 || (default_index >= 0 && default_index < type->num_fields ()));
5951 if (discriminant_index != -1)
5959 if (i == discriminant_index)
5963 variants[var_idx].last_field = i + 1;
5967 if (i != default_index)
5969 variants[var_idx].discriminants = ranges.slice (range_idx, 1);
5976 gdb_assert (range_idx == ranges.size ());
5977 gdb_assert (var_idx == n_variants);
5984 = (discriminant_index == -1
5986 :
type->
field (discriminant_index).
type ()->is_unsigned ());
5989 void *storage = obstack_alloc (
obstack,
sizeof (gdb::array_view<variant_part>));
5990 gdb::array_view<variant_part> *prop_value
5991 =
new (storage) gdb::array_view<variant_part> (part, 1);
6022 gdb_assert (
type->
code () == TYPE_CODE_UNION);
6028#define RUST_ENUM_PREFIX "RUST$ENCODED$ENUM$"
6036 ULONGEST bit_offset = 0;
6038 while (
name[0] >=
'0' &&
name[0] <=
'9')
6041 unsigned long index = strtoul (
name, &tail, 10);
6048 complaint (_(
"Could not parse Rust enum encoding string \"%s\""
6057 field_type = field_type->
field (index).
type ();
6082 const char *dataless_name
6085 struct type *dataless_type
6107 const char *variant_name
6118 struct type *disr_type =
nullptr;
6123 if (disr_type->
code () != TYPE_CODE_STRUCT)
6131 disr_type =
nullptr;
6133 else if (strcmp (disr_type->
field (0).
name (),
6134 "RUST$ENUM$DISR") != 0)
6148 if (disr_type ==
nullptr)
6156 struct field *disr_field = &disr_type->
field (0);
6159 * sizeof (
struct field)));
6172 struct type *enum_type = disr_field->
type ();
6173 std::unordered_map<std::string, ULONGEST> discriminant_map;
6174 for (
int i = 0; i < enum_type->
num_fields (); ++i)
6192 for (
int i = 1; i < n_fields; ++i)
6197 const char *variant_name
6200 auto iter = discriminant_map.find (variant_name);
6201 if (iter != discriminant_map.end ())
6203 ranges[i - 1].
low = iter->second;
6204 ranges[i - 1].
high = iter->second;
6226 gdb::array_view<discriminant_range> (ranges,
6250 return iter->second.get ();
6262 auto iter = this->
m_type_map.find (sig_type);
6266 return iter->second;
6272 gdb_assert (this->
m_type_map.find (sig_type) == this->m_type_map.end ());
6282 htab_t all_children, htab_t all_type_symtabs,
6287 void **slot = htab_find_slot (all_children, per_cu, INSERT);
6304 slot = htab_find_slot (all_type_symtabs, cust, INSERT);
6308 result->push_back (cust);
6309 if (cust->
user == NULL)
6310 cust->
user = immediate_parent;
6315 result->push_back (cust);
6316 if (cust->
user == NULL)
6317 cust->
user = immediate_parent;
6325 all_type_symtabs, ptr, per_objfile,
6342 std::vector<compunit_symtab *> result_symtabs;
6349 htab_up all_children (htab_create_alloc (1, htab_hash_pointer,
6352 htab_up all_type_symtabs (htab_create_alloc (1, htab_hash_pointer,
6359 all_type_symtabs.get (), ptr,
6364 len = result_symtabs.size ();
6368 memcpy (cust->
includes, result_symtabs.data (),
6396 unrelocated_addr lowpc, highpc;
6410 case DW_TAG_compile_unit:
6411 case DW_TAG_partial_unit:
6412 case DW_TAG_type_unit:
6415 error (_(
"Dwarf Error: unexpected tag '%s' at offset %s [in module %s]"),
6441 addr = per_objfile->
relocate (highpc);
6484 && (major < 4 || (major == 4 && minor < 5)))
6579 error (_(
"Dwarf Error: DW_TAG_imported_unit is not"
6580 " supported in type units [in module %s]"),
6599 && per_cu->
unit_type (
false) == DW_UT_compile
6607 false, cu->
lang ());
6654 case DW_TAG_padding:
6656 case DW_TAG_compile_unit:
6657 case DW_TAG_partial_unit:
6660 case DW_TAG_type_unit:
6663 case DW_TAG_subprogram:
6667 && die->
parent->
tag == DW_TAG_subprogram)
6670 case DW_TAG_inlined_subroutine:
6673 case DW_TAG_lexical_block:
6674 case DW_TAG_try_block:
6675 case DW_TAG_catch_block:
6678 case DW_TAG_call_site:
6679 case DW_TAG_GNU_call_site:
6682 case DW_TAG_class_type:
6683 case DW_TAG_interface_type:
6684 case DW_TAG_structure_type:
6685 case DW_TAG_union_type:
6686 case DW_TAG_namelist:
6689 case DW_TAG_enumeration_type:
6696 case DW_TAG_subroutine_type:
6697 case DW_TAG_set_type:
6698 case DW_TAG_pointer_type:
6699 case DW_TAG_ptr_to_member_type:
6700 case DW_TAG_reference_type:
6701 case DW_TAG_rvalue_reference_type:
6702 case DW_TAG_string_type:
6705 case DW_TAG_array_type:
6712 case DW_TAG_base_type:
6713 case DW_TAG_subrange_type:
6714 case DW_TAG_generic_subrange:
6715 case DW_TAG_typedef:
6720 case DW_TAG_common_block:
6723 case DW_TAG_common_inclusion:
6725 case DW_TAG_namespace:
6733 case DW_TAG_imported_declaration:
6740 case DW_TAG_imported_module:
6742 if (die->
child != NULL && (die->
tag == DW_TAG_imported_declaration
6744 complaint (_(
"Tag '%s' has unexpected children"),
6749 case DW_TAG_imported_unit:
6753 case DW_TAG_variable:
6776 case DW_TAG_namespace:
6777 case DW_TAG_typedef:
6778 case DW_TAG_class_type:
6779 case DW_TAG_interface_type:
6780 case DW_TAG_structure_type:
6781 case DW_TAG_union_type:
6782 case DW_TAG_enumeration_type:
6783 case DW_TAG_enumerator:
6784 case DW_TAG_subprogram:
6785 case DW_TAG_inlined_subroutine:
6787 case DW_TAG_imported_declaration:
6790 case DW_TAG_variable:
6791 case DW_TAG_constant:
6806 if (attr == NULL && die->
parent->
tag != DW_TAG_namespace
6812 if (die->
parent->
tag == DW_TAG_lexical_block
6814 || die->
parent->
tag == DW_TAG_catch_block
6815 || die->
parent->
tag == DW_TAG_subprogram)
6835 attr =
dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
6847 const char *linkage_name;
6850 if (linkage_name == NULL)
6856 && strchr (linkage_name,
'{') != NULL)
6857 linkage_name = NULL;
6859 return linkage_name;
6906 if (linkage_name != NULL)
6907 return linkage_name;
6925 gdb::unique_xmalloc_ptr<char> prefixed_name
6928 buf.
puts (prefixed_name.get ());
6966 const gdb_byte *bytes;
6970 if (child->
tag != DW_TAG_template_type_param
6971 && child->
tag != DW_TAG_template_value_param)
6985 complaint (_(
"template parameter missing DW_AT_type"));
6986 buf.
puts (
"UNKNOWN_TYPE");
6991 if (child->
tag == DW_TAG_template_type_param)
6998 attr =
dwarf2_attr (child, DW_AT_const_value, cu);
7001 complaint (_(
"template parameter missing "
7002 "DW_AT_const_value"));
7003 buf.
puts (
"UNKNOWN_VALUE");
7009 &
value, &bytes, &baton);
7025 else if (bytes != NULL)
7049 if (!buf.
empty () && buf.
string ().back () ==
'>')
7059 if (physname && die->
tag == DW_TAG_subprogram
7078 buf.
puts (
" const");
7082 const std::string &intermediate_name = buf.
string ();
7084 const char *canonical_name
7091 if (canonical_name == NULL || canonical_name == intermediate_name.c_str ())
7094 name = canonical_name;
7126 const char *retval, *mangled = NULL, *canon = NULL;
7139 gdb::unique_xmalloc_ptr<char> demangled;
7140 if (mangled != NULL)
7156 demangled =
gdb_demangle (mangled, (DMGL_PARAMS | DMGL_ANSI
7160 canon = demangled.get ();
7172 if (canon != NULL && strcmp (physname, canon) != 0)
7178 complaint (_(
"Computed physname <%s> does not match demangled <%s> "
7179 "(from linkage <%s>) - DIE at %s [in module %s]"),
7225#define MAX_NESTED_IMPORTED_DECLARATIONS 100
7233 if (d->
tag != DW_TAG_imported_declaration)
7239 complaint (_(
"DIE at %s has too many recursively imported "
7247 if (d->
tag == DW_TAG_variable)
7254 attr =
dwarf2_attr (d, DW_AT_location, imported_cu);
7256 if (attr !=
nullptr)
7265 if (
type !=
nullptr &&
type->
code () == TYPE_CODE_NAMESPACE)
7306 if (decl_line ==
nullptr)
7311 if (0 <= val && val <= UINT_MAX)
7312 return (
unsigned int) val;
7314 complaint (_(
"Declared line for using directive is too large"));
7318 complaint (_(
"Declared line for using directive is of incorrect format"));
7329 struct die_info *imported_die, *child_die;
7331 const char *imported_name;
7332 const char *imported_name_prefix;
7333 const char *canonical_name;
7334 const char *import_alias;
7335 const char *imported_declaration = NULL;
7336 const char *import_prefix;
7337 std::vector<const char *> excludes;
7339 import_attr =
dwarf2_attr (die, DW_AT_import, cu);
7340 if (import_attr == NULL)
7342 complaint (_(
"Tag '%s' has no DW_AT_import"),
7349 imported_name =
dwarf2_name (imported_die, imported_cu);
7350 if (imported_name == NULL)
7397 if (imported_die->
tag != DW_TAG_namespace
7398 && imported_die->
tag != DW_TAG_module)
7400 imported_declaration = imported_name;
7401 canonical_name = imported_name_prefix;
7403 else if (strlen (imported_name_prefix) > 0)
7405 imported_name_prefix,
7409 imported_name, (
char *) NULL);
7411 canonical_name = imported_name;
7413 if (die->
tag == DW_TAG_imported_module
7415 for (child_die = die->
child; child_die && child_die->
tag;
7416 child_die = child_die->
sibling)
7423 if (child_die->
tag != DW_TAG_imported_declaration)
7425 complaint (_(
"child DW_TAG_imported_declaration expected "
7426 "- DIE at %s [in module %s]"),
7432 import_attr =
dwarf2_attr (child_die, DW_AT_import, cu);
7433 if (import_attr == NULL)
7435 complaint (_(
"Tag '%s' has no DW_AT_import"),
7443 imported_name =
dwarf2_name (imported_die, imported_cu);
7444 if (imported_name == NULL)
7446 complaint (_(
"child DW_TAG_imported_declaration has unknown "
7447 "imported name - DIE at %s [in module %s]"),
7453 excludes.push_back (imported_name);
7462 imported_declaration,
7532 && IS_ABSOLUTE_PATH (res.
get_name ()))
7554 hashval_t line_header_local_hash;
7573 && die->
tag == DW_TAG_partial_unit)
7578 htab_delete_entry<line_header>,
7588 line_header_local_hash, NO_INSERT);
7593 if (die->
tag == DW_TAG_partial_unit && slot != NULL)
7595 gdb_assert (*slot != NULL);
7617 line_header_local_hash, INSERT);
7618 gdb_assert (slot != NULL);
7620 if (slot != NULL && *slot == NULL)
7634 gdb_assert (die->
tag != DW_TAG_partial_unit);
7636 decode_mapping = (die->
tag != DW_TAG_partial_unit);
7657 unrelocated_addr unrel_low, unrel_high;
7662 if (unrel_low == ((unrelocated_addr) -1))
7663 unrel_low = unrel_high;
7664 lowpc = per_objfile->
relocate (unrel_low);
7671 gdb_assert (per_objfile->
sym_cu ==
nullptr);
7672 scoped_restore restore_sym_cu
7673 = make_scoped_restore (&per_objfile->
sym_cu, cu);
7681 if (die->
child != NULL)
7683 child_die = die->
child;
7684 while (child_die && child_die->
tag)
7687 child_die = child_die->
sibling;
7690 per_objfile->
sym_cu =
nullptr;
7702 complaint (_(
"CU refers to both DW_AT_macros and DW_AT_macro_info"));
7760 gdb_assert (tug_unshare->
symtabs == NULL);
7790 for (i = 0; i < file_names.size (); ++i)
7797 if (sf->
symtab ==
nullptr)
7804 const char *
name = sf->
name.c_str ();
7805 const char *name_for_id = sf->
name_for_id.c_str ();
7825 for (i = 0; i < file_names.size (); ++i)
7856 if (die->
child != NULL)
7858 child_die = die->
child;
7859 while (child_die && child_die->
tag)
7862 child_die = child_die->
sibling;
7906 return htab_up (htab_create_alloc (41,
7909 htab_delete_entry<dwo_file>,
7928 slot = htab_find_slot (per_objfile->
per_bfd->
dwo_files.get (), &find_entry,
7964 return htab_up (htab_create_alloc (3,
7974 const gdb_byte *info_ptr,
7983 gdb::optional<ULONGEST> signature =
lookup_dwo_id (cu, comp_unit_die);
7984 if (!signature.has_value ())
7986 complaint (_(
"Dwarf Error: debug entry at offset %s is missing"
7987 " its dwo_id [in module %s]"),
8013 const gdb_byte *info_ptr, *end_ptr;
8016 info_ptr = section.
buffer;
8018 if (info_ptr == NULL)
8025 end_ptr = info_ptr + section.
size;
8026 while (info_ptr < end_ptr)
8043 info_ptr += per_cu.
length ();
8049 if (cus_htab == NULL)
8055 slot = htab_find_slot (cus_htab.get (),
dwo_unit, INSERT);
8056 gdb_assert (slot != NULL);
8060 sect_offset dup_sect_off = dup_cu->
sect_off;
8062 complaint (_(
"debug cu entry at offset %s is duplicate to"
8063 " the entry at offset %s, signature %s"),
8230 const gdb_byte *index_ptr, *index_end;
8232 uint32_t
version, nr_columns, nr_units, nr_slots;
8240 if (index->
empty ())
8244 index_ptr = index->
buffer;
8245 index_end = index_ptr + index->
size;
8264 error (_(
"Dwarf Error: unsupported DWP file version (%s)"
8270 error (_(
"Dwarf Error: number of slots in DWP hash table (%s)"
8271 " is not power of 2 [in module %s]"),
8293 complaint (_(
"Empty DWP but nr_slots,nr_units,nr_columns not"
8294 " all zero [in modules %s]"),
8313 int ids_seen[DW_SECT_MAX + 1];
8318 error (_(
"Dwarf Error: bad DWP hash table, too few columns"
8319 " in section table [in module %s]"),
8324 error (_(
"Dwarf Error: bad DWP hash table, too many columns"
8325 " in section table [in module %s]"),
8328 memset (ids, 255, sizeof_ids);
8329 memset (ids_seen, 255,
sizeof (ids_seen));
8332 int id =
read_4_bytes (dbfd, ids_ptr + i *
sizeof (uint32_t));
8334 if (id < DW_SECT_MIN || id > DW_SECT_MAX)
8336 error (_(
"Dwarf Error: bad DWP hash table, bad section id %d"
8337 " in section table [in module %s]"),
8340 if (ids_seen[
id] != -1)
8342 error (_(
"Dwarf Error: bad DWP hash table, duplicate section"
8343 " id %d in section table [in module %s]"),
8350 if (((ids_seen[DW_SECT_INFO] != -1)
8351 + (ids_seen[DW_SECT_TYPES] != -1))
8354 error (_(
"Dwarf Error: bad DWP hash table, missing/duplicate"
8355 " DWO info/types section [in module %s]"),
8359 if (ids_seen[DW_SECT_ABBREV] == -1)
8361 error (_(
"Dwarf Error: bad DWP hash table, missing DWO abbrev"
8362 " section [in module %s]"),
8373 error (_(
"Dwarf Error: DWP index section is corrupt (too small)"
8384 int ids_seen[DW_SECT_MAX_V5 + 1];
8388 error (_(
"Dwarf Error: bad DWP hash table, too few columns"
8389 " in section table [in module %s]"),
8394 error (_(
"Dwarf Error: bad DWP hash table, too many columns"
8395 " in section table [in module %s]"),
8398 memset (ids, 255, sizeof_ids);
8399 memset (ids_seen, 255,
sizeof (ids_seen));
8402 int id =
read_4_bytes (dbfd, ids_ptr + i *
sizeof (uint32_t));
8404 if (id < DW_SECT_MIN || id > DW_SECT_MAX_V5)
8406 error (_(
"Dwarf Error: bad DWP hash table, bad section id %d"
8407 " in section table [in module %s]"),
8410 if (ids_seen[
id] != -1)
8412 error (_(
"Dwarf Error: bad DWP hash table, duplicate section"
8413 " id %d in section table [in module %s]"),
8420 if (ids_seen[DW_SECT_INFO_V5] == -1)
8422 error (_(
"Dwarf Error: bad DWP hash table, missing/duplicate"
8423 " DWO info/types section [in module %s]"),
8427 if (ids_seen[DW_SECT_ABBREV_V5] == -1)
8429 error (_(
"Dwarf Error: bad DWP hash table, missing DWO abbrev"
8430 " section [in module %s]"),
8441 error (_(
"Dwarf Error: DWP index section is corrupt (too small)"
8470 sections->
abbrev.
size = bfd_section_size (sectp);
8487 sections->
line.
size = bfd_section_size (sectp);
8495 sections->
loc.
size = bfd_section_size (sectp);
8503 sections->
macinfo.
size = bfd_section_size (sectp);
8511 sections->
macro.
size = bfd_section_size (sectp);
8538 uint32_t unit_index,
8539 const char *comp_dir,
8545 const char *kind = is_debug_types ?
"TU" :
"CU";
8549 void **dwo_file_slot;
8555 kind, pulongest (unit_index), hex_string (signature),
8562#define MAX_NR_V1_DWO_SECTIONS \
8571 memset (§ions, 0,
sizeof (sections));
8576 uint32_t section_nr =
8579 + (unit_index + i) * sizeof (uint32_t));
8581 if (section_nr == 0)
8585 error (_(
"Dwarf Error: bad DWP hash table, section number too large"
8593 error (_(
"Dwarf Error: bad DWP hash table, invalid section found"
8603 error (_(
"Dwarf Error: bad DWP hash table, missing DWO sections"
8609 error (_(
"Dwarf Error: bad DWP hash table, too many DWO sections"
8623 std::string virtual_dwo_name =
8624 string_printf (
"virtual-dwo/%d-%d-%d-%d",
8633 if (*dwo_file_slot == NULL)
8636 virtual_dwo_name.c_str ());
8661 virtual_dwo_name.c_str ());
8685 bfd_size_type offset, bfd_size_type
size)
8691 gdb_assert (!
section->is_virtual);
8693 memset (&result, 0,
sizeof (result));
8706 || offset +
size > bfd_section_size (sectp))
8708 error (_(
"Dwarf Error: Bad DWP V2 or V5 section info, doesn't fit"
8709 " in section %s [in module %s]"),
8710 sectp ? bfd_section_name (sectp) :
"<unknown>",
8727 uint32_t unit_index,
8728 const char *comp_dir,
8734 const char *kind = is_debug_types ?
"TU" :
"CU";
8738 void **dwo_file_slot;
8744 kind, pulongest (unit_index), hex_string (signature),
8749 memset (§ions, 0,
sizeof (sections));
8757 * sizeof (uint32_t)));
8762 * sizeof (uint32_t)));
8771 case DW_SECT_ABBREV:
8783 case DW_SECT_STR_OFFSETS:
8787 case DW_SECT_MACINFO:
8807 std::string virtual_dwo_name =
8808 string_printf (
"virtual-dwo/%ld-%ld-%ld-%ld",
8818 if (*dwo_file_slot == NULL)
8821 virtual_dwo_name.c_str ());
8864 virtual_dwo_name.c_str ());
8894 uint32_t unit_index,
8895 const char *comp_dir,
8901 const char *kind = is_debug_types ?
"TU" :
"CU";
8905 void **dwo_file_slot;
8910 kind, pulongest (unit_index), hex_string (signature),
8917 for (
int i = 0; i < dwp_htab->
nr_columns; ++i)
8921 + (((unit_index - 1)
8924 * sizeof (uint32_t)));
8929 * sizeof (uint32_t)));
8933 case DW_SECT_ABBREV_V5:
8937 case DW_SECT_INFO_V5:
8941 case DW_SECT_LINE_V5:
8945 case DW_SECT_LOCLISTS_V5:
8949 case DW_SECT_MACRO_V5:
8953 case DW_SECT_RNGLISTS_V5:
8957 case DW_SECT_STR_OFFSETS_V5:
8961 case DW_SECT_RESERVED_V5:
8976 std::string virtual_dwo_name =
8977 string_printf (
"virtual-dwo/%ld-%ld-%ld-%ld-%ld-%ld",
8987 virtual_dwo_name.c_str (),
8990 if (*dwo_file_slot == NULL)
8993 virtual_dwo_name.c_str ());
9041 virtual_dwo_name.c_str ());
9071 uint32_t mask = dwp_htab->
nr_slots - 1;
9072 uint32_t hash = signature & mask;
9073 uint32_t hash2 = ((signature >> 32) & mask) | 1;
9078 memset (&find_dwo_cu, 0,
sizeof (find_dwo_cu));
9080 slot = htab_find_slot (is_debug_types
9083 &find_dwo_cu, INSERT);
9089 for (i = 0; i < dwp_htab->
nr_slots; ++i)
9091 ULONGEST signature_in_table;
9093 signature_in_table =
9097 uint32_t unit_index =
9099 dwp_htab->
unit_table + hash * sizeof (uint32_t));
9104 unit_index, comp_dir,
9110 unit_index, comp_dir,
9116 unit_index, comp_dir,
9121 if (signature_in_table == 0)
9123 hash = (hash + hash2) & mask;
9126 error (_(
"Dwarf Error: bad DWP hash table, lookup didn't terminate"
9145 const char *file_name,
int is_dwp,
int search_cwd)
9151 const char *search_path;
9152 static const char dirname_separator_string[] = { DIRNAME_SEPARATOR,
'\0' };
9154 gdb::unique_xmalloc_ptr<char> search_path_holder;
9159 search_path_holder.reset (concat (
".", dirname_separator_string,
9162 search_path = search_path_holder.get ();
9172 search_path_holder.reset (concat (objfile_dir.c_str (),
9173 dirname_separator_string,
9174 search_path,
nullptr));
9175 search_path = search_path_holder.get ();
9181 gdb::unique_xmalloc_ptr<char> absolute_name;
9183 O_RDONLY |
O_BINARY, &absolute_name);
9189 if (sym_bfd == NULL)
9192 if (!bfd_check_format (sym_bfd.get (), bfd_object))
9213 const char *file_name,
const char *comp_dir)
9215 if (IS_ABSOLUTE_PATH (file_name))
9221 if (comp_dir != NULL)
9223 std::string path_to_try = path_join (comp_dir, file_name);
9228 (per_objfile, path_to_try.c_str (), 0 , 1 ));
9279 memset (&type_section, 0,
sizeof (type_section));
9284 if (dw_sect !=
nullptr)
9287 dw_sect->
size = bfd_section_size (sectp);
9348 unsigned int elf_section_nr = elf_section_data (sectp)->this_idx;
9352 gdb_assert (elf_section_nr < dwp_file->num_sections);
9364 if (dw_sect !=
nullptr)
9367 dw_sect->
size = bfd_section_size (sectp);
9379 asection *sectp,
void *dwp_file_ptr)
9383 unsigned int elf_section_nr = elf_section_data (sectp)->this_idx;
9387 gdb_assert (elf_section_nr < dwp_file->num_sections);
9409 if (dw_sect !=
nullptr)
9412 dw_sect->
size = bfd_section_size (sectp);
9424 asection *sectp,
void *dwp_file_ptr)
9428 unsigned int elf_section_nr = elf_section_data (sectp)->this_idx;
9432 gdb_assert (elf_section_nr < dwp_file->num_sections);
9452 if (dw_sect !=
nullptr)
9455 dw_sect->
size = bfd_section_size (sectp);
9487 return htab_up (htab_create_alloc (3,
9533static std::unique_ptr<struct dwp_file>
9543 std::string dwp_name;
9547 const char *backlink_basename = lbasename (backlink->
original_name);
9570 return std::unique_ptr<dwp_file> ();
9573 const char *
name = bfd_get_filename (dbfd.get ());
9574 std::unique_ptr<struct dwp_file>
dwp_file
9597 error (_(
"Dwarf Error: DWP file CU version %s doesn't match"
9598 " TU version %s [in DWP file %s]"),
9666 const char *kind = is_debug_types ?
"TU" :
"CU";
9667 void **dwo_file_slot;
9682 if (dwp_htab != NULL)
9688 if (dwo_cutu != NULL)
9692 host_address_to_string (dwo_cutu));
9703 if (*dwo_file_slot == NULL)
9719 memset (&find_dwo_cutu, 0,
sizeof (find_dwo_cutu));
9729 memset (&find_dwo_cutu, 0,
sizeof (find_dwo_cutu));
9735 if (dwo_cutu != NULL)
9739 host_address_to_string (dwo_cutu));
9751 kind, dwo_name, hex_string (
signature));
9758 std::string dwp_text;
9761 dwp_text = string_printf (
" [in DWP file %s]",
9764 warning (_(
"Could not find DWO %s %s(%s)%s referenced by %s at offset %s"
9766 kind, dwo_name, hex_string (
signature), dwp_text.c_str (), kind,
9807 if (sig_type != NULL)
9832 gdb_assert (cu !=
nullptr);
9855 if (attr ==
nullptr)
9870 if (die->
tag != origin_die->
tag
9871 && !(die->
tag == DW_TAG_inlined_subroutine
9872 && origin_die->
tag == DW_TAG_subprogram))
9873 complaint (_(
"DIE %s and its abstract origin %s have different tags"),
9883 bool are_isomorphic =
true;
9886 while (concrete_child !=
nullptr || abstract_child !=
nullptr)
9888 if (concrete_child ==
nullptr
9889 || abstract_child ==
nullptr
9890 || concrete_child->
tag != abstract_child->
tag)
9892 are_isomorphic =
false;
9896 concrete_child = concrete_child->
sibling;
9897 abstract_child = abstract_child->
sibling;
9905 die_info *corresponding_abstract_child
9906 = are_isomorphic ? origin_die->
child :
nullptr;
9908 std::vector<sect_offset> offsets;
9911 child_die && child_die->
tag;
9912 child_die = child_die->sibling)
9919 if (child_die->tag == DW_TAG_call_site
9920 || child_die->tag == DW_TAG_GNU_call_site)
9923 corresponding_abstract_child
9924 = corresponding_abstract_child->
sibling;
9933 die_info *child_origin_die = child_die;
9937 attr =
dwarf2_attr (child_origin_die, DW_AT_abstract_origin,
9939 if (attr ==
nullptr)
9942 die_info *prev_child_origin_die = child_origin_die;
9946 if (prev_child_origin_die == child_origin_die)
9955 if (child_origin_die == child_die
9956 &&
dwarf2_attr (child_die, DW_AT_abstract_origin, cu) ==
nullptr
9958 && child_die->tag == DW_TAG_lexical_block)
9959 child_origin_die = corresponding_abstract_child;
9963 if (child_origin_die != child_die)
9965 if (child_die->tag != child_origin_die->
tag
9966 && !(child_die->tag == DW_TAG_inlined_subroutine
9967 && child_origin_die->
tag == DW_TAG_subprogram))
9968 complaint (_(
"Child DIE %s and its abstract origin %s have "
9972 if (child_origin_die->
parent != origin_die)
9973 complaint (_(
"Child DIE %s and its abstract origin %s have "
9974 "different parents"),
9978 offsets.push_back (child_origin_die->
sect_off);
9982 corresponding_abstract_child = corresponding_abstract_child->
sibling;
9985 if (!offsets.empty ())
9987 std::sort (offsets.begin (), offsets.end ());
9989 for (
auto offsets_it = offsets.begin () + 1;
9990 offsets_it < offsets.end ();
9992 if (*(offsets_it - 1) == *offsets_it)
9993 complaint (_(
"Multiple children of DIE %s refer "
9994 "to DIE %s as their abstract origin"),
9999 auto offsets_it = offsets.begin ();
10001 while (origin_child_die !=
nullptr && origin_child_die->
tag != 0)
10004 while (offsets_it < offsets.end ()
10005 && *offsets_it < origin_child_die->sect_off)
10008 if (offsets_it == offsets.end ()
10009 || *offsets_it > origin_child_die->
sect_off)
10019 origin_child_die = origin_child_die->
sibling;
10024 if (cu != origin_cu)
10040 return (attr !=
nullptr
10052 if (
name ==
nullptr)
10079 struct attribute *attr, *call_line, *call_file;
10082 int inlined_func = (die->
tag == DW_TAG_inlined_subroutine);
10083 std::vector<struct symbol *> template_args;
10091 call_line =
dwarf2_attr (die, DW_AT_call_line, cu);
10092 call_file =
dwarf2_attr (die, DW_AT_call_file, cu);
10093 if (call_line == NULL || call_file == NULL)
10101 if (
name ==
nullptr)
10108 complaint (_(
"missing name for subprogram DIE at %s"),
10122 unrelocated_addr unrel_low, unrel_high;
10129 bool external_p = attr !=
nullptr && attr->
as_boolean ();
10137 bool decl_p = attr !=
nullptr && attr->
as_boolean ();
10138 if (!external_p && !inlined_p && !decl_p)
10139 complaint (_(
"cannot get low and high bounds "
10140 "for subprogram DIE at %s"),
10146 lowpc = per_objfile->
relocate (unrel_low);
10147 highpc = per_objfile->
relocate (unrel_high);
10151 for (child_die = die->
child; child_die; child_die = child_die->
sibling)
10153 if (child_die->
tag == DW_TAG_template_type_param
10154 || child_die->
tag == DW_TAG_template_value_param)
10173 if (attr !=
nullptr)
10179 if (attr !=
nullptr)
10189 if (die->
child != NULL)
10191 child_die = die->
child;
10192 while (child_die && child_die->
tag)
10194 if (child_die->
tag == DW_TAG_template_type_param
10195 || child_die->
tag == DW_TAG_template_value_param)
10200 template_args.push_back (arg);
10204 child_die = child_die->
sibling;
10221 child_die = spec_die->
child;
10222 while (child_die && child_die->
tag)
10224 if (child_die->
tag == DW_TAG_imported_module)
10226 child_die = child_die->
sibling;
10255 if (!template_args.empty ())
10257 gdb_assert (templ_func != NULL);
10264 template_args.data (),
10271 for (
symbol *sym : template_args)
10272 sym->set_symtab (templ_func->
symtab ());
10295 CORE_ADDR lowpc, highpc;
10303 unrelocated_addr unrel_low, unrel_high;
10311 for (child_die = die->
child;
10312 child_die != NULL && child_die->
tag;
10313 child_die = child_die->
sibling)
10328 lowpc = per_objfile->
relocate (unrel_low);
10329 highpc = per_objfile->
relocate (unrel_high);
10332 if (die->
child != NULL)
10334 child_die = die->
child;
10335 while (child_die && child_die->
tag)
10338 child_die = child_die->
sibling;
10371 std::vector<unrelocated_addr> &result);
10395 complaint (_(
"missing DW_AT_call_return_pc for DW_TAG_call_site "
10396 "DIE %s [in module %s]"),
10406 hashtab_obstack_allocate, NULL);
10408 slot = htab_find_slot (cu->
call_site_htab, &call_site_local, INSERT);
10411 complaint (_(
"Duplicate PC %s for DW_TAG_call_site "
10412 "DIE %s [in module %s]"),
10421 for (child_die = die->
child; child_die && child_die->
tag;
10422 child_die = child_die->
sibling)
10424 if (child_die->
tag != DW_TAG_call_site_parameter
10425 && child_die->
tag != DW_TAG_GNU_call_site_parameter)
10427 complaint (_(
"Tag %d is not DW_TAG_call_site_parameter in "
10428 "DW_TAG_call_site child DIE %s [in module %s]"),
10454 for (func_die = die->
parent;
10455 func_die && func_die->
tag != DW_TAG_subprogram
10456 && func_die->
tag != DW_TAG_subroutine_type;
10457 func_die = func_die->
parent);
10484 gdb_assert (
func_type->code () == TYPE_CODE_FUNC);
10491 complaint (_(
"Cannot find function owning DW_TAG_call_site "
10492 "DIE %s [in module %s]"),
10499 attr =
dwarf2_attr (die, DW_AT_GNU_call_site_target, cu);
10505 attr =
dwarf2_attr (die, DW_AT_abstract_origin, cu);
10533 =
dwarf2_attr (target_die, DW_AT_ranges, target_cu);
10537 const char *target_physname;
10541 if (target_physname == NULL)
10543 if (target_physname == NULL)
10544 complaint (_(
"DW_AT_call_target target DIE has invalid "
10545 "physname, for referencing DIE %s [in module %s]"),
10552 ULONGEST ranges_offset = (ranges_attr->
as_unsigned ()
10554 std::vector<unrelocated_addr> addresses;
10556 target_die->
tag, addresses);
10559 addresses.size ());
10560 std::copy (addresses.begin (), addresses.end (), saved);
10565 unrelocated_addr lowpc;
10571 complaint (_(
"DW_AT_call_target target DIE has invalid "
10572 "low pc, for referencing DIE %s [in module %s]"),
10576 lowpc = per_objfile->
adjust (lowpc);
10582 complaint (_(
"DW_TAG_call_site DW_AT_call_target is neither "
10583 "block nor reference, for DIE %s [in module %s]"),
10586 for (child_die = die->
child;
10587 child_die && child_die->
tag;
10588 child_die = child_die->
sibling)
10593 if (child_die->
tag != DW_TAG_call_site_parameter
10594 && child_die->
tag != DW_TAG_GNU_call_site_parameter)
10608 origin =
dwarf2_attr (child_die, DW_AT_call_parameter, cu);
10609 if (origin == NULL)
10613 origin =
dwarf2_attr (child_die, DW_AT_abstract_origin, cu);
10625 complaint (_(
"DW_AT_call_parameter offset is not in CU for "
10626 "DW_TAG_call_site child DIE %s [in module %s]"),
10636 complaint (_(
"No DW_FORM_block* DW_AT_location for "
10637 "DW_TAG_call_site child DIE %s [in module %s]"),
10655 complaint (_(
"Only single DW_OP_reg or DW_OP_fbreg is supported "
10656 "for DW_FORM_block* DW_AT_location is supported for "
10657 "DW_TAG_call_site child DIE %s "
10665 attr =
dwarf2_attr (child_die, DW_AT_call_value, cu);
10667 attr =
dwarf2_attr (child_die, DW_AT_GNU_call_site_value, cu);
10670 complaint (_(
"No DW_FORM_block* DW_AT_call_value for "
10671 "DW_TAG_call_site child DIE %s [in module %s]"),
10686 attr =
dwarf2_attr (child_die, DW_AT_call_data_value, cu);
10688 attr =
dwarf2_attr (child_die, DW_AT_GNU_call_site_data_value, cu);
10689 if (attr !=
nullptr)
10692 complaint (_(
"No DW_FORM_block* DW_AT_call_data_value for "
10693 "DW_TAG_call_site child DIE %s [in module %s]"),
10710static struct type *
10723 if (type_die == NULL)
10726 if (
dwarf2_attr (type_die, DW_AT_containing_type, type_cu) == NULL)
10742 if (containing_type != NULL)
10756 if (res == NULL &&
loc && abstract_origin)
10778template <
typename Callback>
10781 dwarf_tag
tag, Callback &&callback)
10787 gdb::optional<unrelocated_addr> base;
10788 const gdb_byte *buffer;
10789 bool overflow =
false;
10790 ULONGEST addr_index;
10797 if (offset >= rnglists_section->
size)
10799 complaint (_(
"Offset %d out of bounds for DW_AT_ranges attribute"),
10808 unrelocated_addr range_beginning = {}, range_end = {};
10809 const gdb_byte *buf_end = (rnglists_section->
buffer
10810 + rnglists_section->
size);
10811 unsigned int bytes_read;
10818 const auto rlet =
static_cast<enum dwarf_range_list_entry
>(*
buffer++);
10821 case DW_RLE_end_of_list:
10823 case DW_RLE_base_address:
10832 case DW_RLE_base_addressx:
10837 case DW_RLE_start_length:
10847 = (unrelocated_addr) ((CORE_ADDR) range_beginning
10857 case DW_RLE_startx_length:
10867 = (unrelocated_addr) ((CORE_ADDR) range_beginning
10872 case DW_RLE_offset_pair:
10890 case DW_RLE_start_end:
10902 case DW_RLE_startx_endx:
10916 complaint (_(
"Invalid .debug_rnglists data (no base address)"));
10919 if (rlet == DW_RLE_end_of_list || overflow)
10921 if (rlet == DW_RLE_base_address)
10924 if (range_beginning > range_end)
10927 complaint (_(
"Invalid .debug_rnglists data (inverted range)"));
10932 if (range_beginning == range_end)
10936 if (rlet == DW_RLE_offset_pair)
10938 if (!base.has_value ())
10941 complaint (_(
"Invalid .debug_rnglists data (no base address for "
10942 "DW_RLE_offset_pair)"));
10946 range_beginning = (unrelocated_addr) ((CORE_ADDR) range_beginning
10947 + (CORE_ADDR) *base);
10948 range_end = (unrelocated_addr) ((CORE_ADDR) range_end
10949 + (CORE_ADDR) *base);
10954 if (range_beginning == (unrelocated_addr) 0
10957 complaint (_(
".debug_rnglists entry has start address of zero"
10962 callback (range_beginning, range_end);
10967 complaint (_(
"Offset %d is not terminated "
10968 "for DW_AT_ranges attribute"),
10981template <
typename Callback>
10984 Callback &&callback)
10991 CORE_ADDR mask = ~(~(CORE_ADDR)1 << (
addr_size * 8 - 1));
10993 gdb::optional<unrelocated_addr> base;
10994 unsigned int dummy;
10995 const gdb_byte *buffer;
11005 complaint (_(
"Offset %d out of bounds for DW_AT_ranges attribute"),
11013 unrelocated_addr range_beginning, range_end;
11022 if (range_beginning == (unrelocated_addr) 0
11023 && range_end == (unrelocated_addr) 0)
11030 if (((CORE_ADDR) range_beginning & mask) == mask)
11038 if (!base.has_value ())
11042 complaint (_(
"Invalid .debug_ranges data (no base address)"));
11046 if (range_beginning > range_end)
11049 complaint (_(
"Invalid .debug_ranges data (inverted range)"));
11054 if (range_beginning == range_end)
11057 range_beginning = (unrelocated_addr) ((CORE_ADDR) range_beginning
11058 + (CORE_ADDR) *base);
11059 range_end = (unrelocated_addr) ((CORE_ADDR) range_end
11060 + (CORE_ADDR) *base);
11064 if (range_beginning == (unrelocated_addr) 0
11067 complaint (_(
".debug_ranges entry has start address of zero"
11072 callback (range_beginning, range_end);
11085 unrelocated_addr *high_return,
struct dwarf2_cu *cu,
11086 addrmap *map,
void *datum, dwarf_tag tag)
11090 unrelocated_addr low = {};
11091 unrelocated_addr high = {};
11095 [&] (unrelocated_addr range_beginning, unrelocated_addr range_end)
11097 if (map !=
nullptr)
11099 unrelocated_addr lowpc;
11100 unrelocated_addr highpc;
11102 lowpc = per_objfile->
adjust (range_beginning);
11103 highpc = per_objfile->
adjust (range_end);
11105 map->
set_empty ((CORE_ADDR) lowpc, (CORE_ADDR) highpc - 1, datum);
11114 low = range_beginning;
11120 if (range_beginning < low)
11121 low = range_beginning;
11122 if (range_end > high)
11137 *high_return = high;
11146 std::vector<unrelocated_addr> &result)
11149 [&] (unrelocated_addr start, unrelocated_addr end)
11151 result.push_back (start);
11161 unrelocated_addr *highpc,
struct dwarf2_cu *cu,
11167 unrelocated_addr low = {};
11168 unrelocated_addr high = {};
11171 attr_high =
dwarf2_attr (die, DW_AT_high_pc, cu);
11175 if (attr !=
nullptr)
11180 high = (unrelocated_addr) ((ULONGEST) high + (ULONGEST) low);
11200 if (die->
tag != DW_TAG_compile_unit)
11206 map, datum, die->
tag))
11227 if (low == (unrelocated_addr) 0
11244 unrelocated_addr *lowpc,
11245 unrelocated_addr *highpc,
11248 unrelocated_addr low, high;
11254 *lowpc = std::min (*lowpc, low);
11255 *highpc = std::max (*highpc, high);
11269 if (
child->
tag == DW_TAG_subprogram
11270 ||
child->
tag == DW_TAG_lexical_block)
11282 unrelocated_addr *lowpc, unrelocated_addr *highpc,
11285 unrelocated_addr best_low = (unrelocated_addr) -1;
11286 unrelocated_addr best_high = {};
11287 unrelocated_addr current_low, current_high;
11293 best_low = current_low;
11294 best_high = current_high;
11303 case DW_TAG_subprogram:
11306 case DW_TAG_namespace:
11307 case DW_TAG_module:
11318 if (current_low != ((unrelocated_addr) -1))
11320 best_low = std::min (best_low, current_low);
11321 best_high = std::max (best_high, current_high);
11334 *highpc = best_high;
11349 attr_high =
dwarf2_attr (die, DW_AT_high_pc, cu);
11353 if (attr !=
nullptr)
11355 unrelocated_addr unrel_low = attr->
as_address ();
11356 unrelocated_addr unrel_high = attr_high->
as_address ();
11359 unrel_high = (unrelocated_addr) ((ULONGEST) unrel_high
11360 + (ULONGEST) unrel_low);
11362 CORE_ADDR low = per_objfile->
relocate (unrel_low);
11363 CORE_ADDR high = per_objfile->
relocate (unrel_high);
11377 if (die->
tag != DW_TAG_compile_unit)
11380 std::vector<blockrange> blockvec;
11382 [&] (unrelocated_addr start, unrelocated_addr end)
11384 CORE_ADDR abs_start = per_objfile->relocate (start);
11385 CORE_ADDR abs_end = per_objfile->relocate (end);
11386 cu->get_builder ()->record_block_range (block, abs_start,
11388 blockvec.emplace_back (abs_start, abs_end);
11425 else if (startswith (cu->
producer,
"CodeWarrior S12/L-ISA"))
11468static enum dwarf_access_attribute
11472 if (attr !=
nullptr)
11475 if (
value == DW_ACCESS_public
11476 ||
value == DW_ACCESS_protected
11477 ||
value == DW_ACCESS_private)
11478 return (dwarf_access_attribute)
value;
11479 complaint (_(
"Unhandled DW_AT_accessibility value (%s)"),
11488 if (die->
tag != DW_TAG_inheritance)
11489 return DW_ACCESS_public;
11491 return DW_ACCESS_private;
11499 if (die->
parent->
tag == DW_TAG_class_type)
11500 return DW_ACCESS_private;
11502 return DW_ACCESS_public;
11517 attr =
dwarf2_attr (die, DW_AT_data_member_location, cu);
11543 attr =
dwarf2_attr (die, DW_AT_data_bit_offset, cu);
11544 if (attr !=
nullptr)
11563 attr =
dwarf2_attr (die, DW_AT_data_member_location, cu);
11578 complaint (_(
"DW_AT_data_member_location value of -1, assuming 0"));
11615 attr =
dwarf2_attr (die, DW_AT_data_bit_offset, cu);
11616 if (attr !=
nullptr)
11632 const char *fieldname =
"";
11634 if (die->
tag == DW_TAG_inheritance)
11641 fip->
fields.emplace_back ();
11642 new_field = &fip->
fields.back ();
11652 if (attr !=
nullptr)
11657 fp = &new_field->
field;
11659 if ((die->
tag == DW_TAG_member || die->
tag == DW_TAG_namelist_item)
11662 if (die->
tag == DW_TAG_namelist_item)
11667 struct die_info *item_die =
nullptr;
11671 if (item_die !=
nullptr)
11683 if (attr !=
nullptr)
11710 int anonymous_size;
11731 - bit_offset - fp->
bitsize ());
11737 if (fieldname == NULL)
11753 else if (die->
tag == DW_TAG_member || die->
tag == DW_TAG_variable)
11762 const char *physname;
11766 if (fieldname == NULL)
11791 else if (die->
tag == DW_TAG_inheritance)
11800 gdb_assert_not_reached (
"missing case in dwarf2_add_field");
11810 case DW_TAG_typedef:
11811 case DW_TAG_class_type:
11812 case DW_TAG_structure_type:
11813 case DW_TAG_union_type:
11814 case DW_TAG_enumeration_type:
11829 memset (&fp, 0,
sizeof (fp));
11841 case DW_ACCESS_public:
11844 case DW_ACCESS_private:
11847 case DW_ACCESS_protected:
11852 if (die->
tag == DW_TAG_typedef)
11860typedef std::unordered_map<sect_offset, int, gdb::hash_enum<sect_offset>>
11868static const gdb::array_view<discriminant_range>
11872 std::vector<discriminant_range> ranges;
11877 if (
variant.discr_list_data ==
nullptr)
11881 ranges.push_back (r);
11885 gdb::array_view<const gdb_byte> data (
variant.discr_list_data->data,
11886 variant.discr_list_data->size);
11887 while (!data.empty ())
11889 if (data[0] != DW_DSC_range && data[0] != DW_DSC_label)
11891 complaint (_(
"invalid discriminant marker: %d"), data[0]);
11894 bool is_range = data[0] == DW_DSC_range;
11895 data = data.slice (1);
11897 ULONGEST low, high;
11898 unsigned int bytes_read;
11902 complaint (_(
"DW_AT_discr_list missing low value"));
11910 data = data.slice (bytes_read);
11916 complaint (_(
"DW_AT_discr_list missing high value"));
11925 data = data.slice (bytes_read);
11930 ranges.push_back ({ low, high });
11936 std::copy (ranges.begin (), ranges.end (), result);
11937 return gdb::array_view<discriminant_range> (result, ranges.size ());
11941 (
struct obstack *obstack,
11944 const std::vector<variant_part_builder> &variant_parts);
11961 field.variant_parts);
11973 struct obstack *obstack,
11979 if (iter == offset_map.end ())
11992 size_t n = builder.
variants.size ();
11994 for (
size_t i = 0; i < n; ++i)
11998 result.
variants = gdb::array_view<variant> (output, n);
12007static const gdb::array_view<variant_part>
12011 const std::vector<variant_part_builder> &variant_parts)
12013 if (variant_parts.empty ())
12016 size_t n = variant_parts.size ();
12018 for (
size_t i = 0; i < n; ++i)
12022 return gdb::array_view<variant_part> (result, n);
12036 for (
int i = 0; i < fip->
fields.size (); ++i)
12037 offset_map[fip->
fields[i].offset] = i;
12040 gdb::array_view<const variant_part> parts
12058 int nfields = fip->
nfields ();
12083 unsigned char *pointer;
12095 for (
int i = 0; i < nfields; ++i)
12102 switch (
field.accessibility)
12104 case DW_ACCESS_private:
12109 case DW_ACCESS_protected:
12114 case DW_ACCESS_public:
12120 complaint (_(
"unsupported accessibility %d"),
12121 field.accessibility);
12125 if (i < fip->baseclasses.size ())
12127 switch (
field.virtuality)
12129 case DW_VIRTUALITY_virtual:
12130 case DW_VIRTUALITY_pure_virtual:
12132 error (_(
"unexpected virtuality in component of Ada type"));
12146 const char *fieldname;
12147 const char *type_name;
12150 if (die->
parent == NULL)
12153 if (die->
parent->
tag != DW_TAG_structure_type
12154 && die->
parent->
tag != DW_TAG_union_type
12155 && die->
parent->
tag != DW_TAG_class_type)
12160 if (fieldname == NULL || type_name == NULL)
12163 len = strlen (fieldname);
12164 return (strncmp (fieldname, type_name, len) == 0
12165 && (type_name[len] ==
'\0' || type_name[len] ==
'<'));
12179 const char *fieldname;
12180 struct type *this_type;
12183 error (_(
"unexpected member function in Ada type"));
12187 if (fieldname == NULL)
12193 if (strcmp (fip->
fnfieldlists[i].name, fieldname) == 0)
12201 if (flp ==
nullptr)
12205 flp->
name = fieldname;
12221 fnp->
physname = physname ? physname :
"";
12226 if (this_type && this_type->
code () == TYPE_CODE_FUNC)
12248 complaint (_(
"member function type missing for '%s'"),
12252 if (
dwarf2_attr (die, DW_AT_containing_type, cu) != NULL)
12262 case DW_ACCESS_private:
12265 case DW_ACCESS_protected:
12277 if (attr !=
nullptr)
12293 attr =
dwarf2_attr (die, DW_AT_vtable_elem_location, cu);
12294 if (attr !=
nullptr)
12301 if (
block->data[0] == DW_OP_constu
12311 else if ((
block->data[0] == DW_OP_deref
12312 || (
block->size > 1
12313 &&
block->data[0] == DW_OP_deref_size
12335 complaint (_(
"cannot determine context for virtual member "
12336 "function \"%s\" (offset %s)"),
12358 if (attr !=
nullptr && attr->
as_virtuality () != DW_VIRTUALITY_none)
12361 complaint (_(
"Member function \"%s\" (offset %s) is virtual "
12362 "but the vtable offset is not specified"),
12377 error (_(
"unexpected member functions in Ada type"));
12396 for (
int k = 0; k < nf.
fnfields.size (); ++k)
12408 static const char vptr[] =
"_vptr";
12442 if (pfn_type == NULL
12443 || pfn_type->
code () != TYPE_CODE_PTR
12466static struct type *
12469 if (
type->
code () != TYPE_CODE_ARRAY)
12477 if (new_target ==
nullptr)
12489 copy->copy_fields (
type);
12490 if (new_target !=
nullptr)
12491 copy->set_target_type (new_target);
12497 *bounds = *current_bounds;
12501 copy->set_index_type (index_copy);
12538 struct type *new_ary_type
12540 if (new_ary_type !=
nullptr)
12553 if (attr ==
nullptr)
12558 complaint (_(
"DW_AT_alignment must have constant form"
12559 " - DIE at %s [in module %s]"),
12568 complaint (_(
"DW_AT_alignment value must not be negative"
12569 " - DIE at %s [in module %s]"),
12574 ULONGEST align = val;
12578 complaint (_(
"DW_AT_alignment value must not be zero"
12579 " - DIE at %s [in module %s]"),
12584 if ((align & (align - 1)) != 0)
12586 complaint (_(
"DW_AT_alignment value must be a power of 2"
12587 " - DIE at %s [in module %s]"),
12604 complaint (_(
"DW_AT_alignment value too large"
12605 " - DIE at %s [in module %s]"),
12619 case DW_CC_pass_by_reference:
12620 case DW_CC_pass_by_value:
12624 complaint (_(
"unrecognized DW_AT_calling_convention value "
12625 "(%s) for a type"), pulongest (
value));
12640 case DW_CC_program:
12644 case DW_CC_GNU_renesas_sh:
12645 case DW_CC_GNU_borland_fastcall_i386:
12646 case DW_CC_GDB_IBM_OpenCL:
12650 complaint (_(
"unrecognized DW_AT_calling_convention value "
12651 "(%s) for a subroutine"), pulongest (
value));
12668static struct type *
12679 attr = die->
attr (DW_AT_signature);
12680 if (attr !=
nullptr)
12716 if (die->
tag == DW_TAG_structure_type)
12720 else if (die->
tag == DW_TAG_union_type)
12724 else if (die->
tag == DW_TAG_namelist)
12739 attr =
dwarf2_attr (die, DW_AT_calling_convention, cu);
12740 if (attr !=
nullptr
12749 if (attr !=
nullptr)
12778 else if (attr == NULL && die->
child == NULL
12799 std::vector<struct symbol *> *template_args,
12808 std::vector<struct symbol *> *template_args,
12819 complaint (_(
"nested DW_TAG_variant_part seen "
12820 "- DIE at %s [in module %s]"),
12834 scoped_restore save_current_variant_part
12851 complaint (_(
"DW_AT_discr does not have DIE reference form"
12852 " - DIE at %s [in module %s]"),
12859 child_die = child_die->
sibling)
12869 std::vector<struct symbol *> *template_args,
12874 complaint (_(
"saw DW_TAG_variant outside DW_TAG_variant_part "
12875 "- DIE at %s [in module %s]"),
12882 complaint (_(
"nested DW_TAG_variant seen "
12883 "- DIE at %s [in module %s]"),
12889 scoped_restore save_processing_variant
12903 if (discr ==
nullptr || discr->
as_block ()->
size == 0)
12904 variant.default_branch =
true;
12912 variant_child != NULL;
12913 variant_child = variant_child->
sibling)
12925 std::vector<struct symbol *> *template_args,
12928 if (child_die->
tag == DW_TAG_member
12929 || child_die->
tag == DW_TAG_variable
12930 || child_die->
tag == DW_TAG_namelist_item)
12939 else if (child_die->
tag == DW_TAG_subprogram)
12952 else if (child_die->
tag == DW_TAG_inheritance)
12959 else if (child_die->
tag == DW_TAG_template_type_param
12960 || child_die->
tag == DW_TAG_template_value_param)
12965 template_args->push_back (arg);
12967 else if (child_die->
tag == DW_TAG_variant_part)
12969 else if (child_die->
tag == DW_TAG_variant)
12989 bool has_template_parameters =
false;
12993 std::vector<struct symbol *> template_args;
12995 child_die = die->
child;
12997 while (child_die && child_die->
tag)
13000 child_die = child_die->
sibling;
13004 if (!template_args.empty ())
13006 has_template_parameters =
true;
13014 template_args.data (),
13016 *
sizeof (
struct symbol *)));
13031 if (
dwarf2_attr (die, DW_AT_containing_type, cu) != NULL)
13045 const char *fieldname = t->
field (i).
name ();
13056 complaint (_(
"virtual function table pointer "
13057 "not found when defining class '%s'"),
13066 && startswith (cu->
producer,
"IBM(R) XL C/C++ Advanced Edition"))
13140 child_die = die->
child;
13142 while (child_die != NULL && child_die->
tag)
13144 if (child_die->
tag == DW_TAG_member
13145 || child_die->
tag == DW_TAG_variable
13146 || child_die->
tag == DW_TAG_inheritance
13147 || child_die->
tag == DW_TAG_template_value_param
13148 || child_die->
tag == DW_TAG_template_type_param)
13155 child_die = child_die->
sibling;
13161 if (
dwarf2_attr (die, DW_AT_byte_size, cu) != NULL
13163 ||
dwarf2_attr (die, DW_AT_signature, cu) != NULL)
13167 if (has_template_parameters)
13170 if (sym !=
nullptr)
13181 complaint (_(
"could not find suitable "
13182 "symtab for template parameter"
13183 " - DIE at %s [in module %s]"),
13211 int unsigned_enum = 1;
13214 auto_obstack obstack;
13215 std::vector<struct field> fields;
13217 for (child_die = die->
child;
13218 child_die != NULL && child_die->
tag;
13219 child_die = child_die->
sibling)
13223 const gdb_byte *bytes;
13227 if (child_die->
tag != DW_TAG_enumerator)
13230 attr =
dwarf2_attr (child_die, DW_AT_const_value, cu);
13236 name =
"<anonymous enumerator>";
13239 &
value, &bytes, &baton);
13247 if (count_one_bits_ll (
value) >= 2)
13251 fields.emplace_back ();
13257 if (!fields.empty ())
13272static struct type *
13283 attr = die->
attr (DW_AT_signature);
13284 if (attr !=
nullptr)
13309 if (attr !=
nullptr)
13368 struct type *this_type;
13371 if (this_type == NULL)
13374 if (die->
child != NULL)
13379 child_die = die->
child;
13380 while (child_die && child_die->
tag)
13382 if (child_die->
tag != DW_TAG_enumerator)
13393 child_die = child_die->
sibling;
13435 const gdb_byte *start =
block->data;
13436 const gdb_byte *end =
block->data +
block->size;
13459 if (end - start < 2)
13461 if (*start++ != DW_OP_push_object_address)
13463 if (*start++ != DW_OP_plus_uconst)
13466 uint64_t this_bound_off;
13468 if (start ==
nullptr || (
int) this_bound_off != this_bound_off)
13472 if (*bounds_offset == -1)
13473 *bounds_offset = this_bound_off;
13474 else if (*bounds_offset != this_bound_off)
13477 if (start == end || *start++ != DW_OP_deref)
13483 else if (*start == DW_OP_deref_size || *start == DW_OP_deref)
13487 else if (*start++ != DW_OP_plus_uconst)
13494 if (start ==
nullptr)
13496 if ((
int) val != val)
13505 if (*start == DW_OP_deref_size)
13508 if (start ==
nullptr)
13511 else if (*start == DW_OP_deref)
13552static struct type *
13567 || blk->
data[0] != DW_OP_push_object_address
13568 || blk->
data[1] != DW_OP_deref)
13571 int bounds_offset = -1;
13572 int max_align = -1;
13573 std::vector<struct field> range_fields;
13576 child_die = child_die->
sibling)
13578 if (child_die->tag == DW_TAG_subrange_type)
13583 if (this_align > max_align)
13584 max_align = this_align;
13586 range_fields.emplace_back ();
13587 range_fields.emplace_back ();
13589 struct field &lower = range_fields[range_fields.size () - 2];
13590 struct field &upper = range_fields[range_fields.size () - 1];
13599 &bounds_offset, &lower, cu)
13601 &bounds_offset, &upper, cu))
13608 if (bounds_offset == -1)
13612 for (
int i = 0; i < range_fields.size (); i += 2)
13617 xsnprintf (
name,
sizeof (
name),
"LB%d", i / 2);
13619 xsnprintf (
name,
sizeof (
name),
"UB%d", i / 2);
13625 bounds->set_code (TYPE_CODE_STRUCT);
13627 bounds->copy_fields (range_fields);
13629 int last_fieldno = range_fields.size () - 1;
13630 int bounds_size = (
bounds->field (last_fieldno).loc_bitpos () / 8
13631 +
bounds->field (last_fieldno).type ()->length ());
13632 bounds->set_length (align_up (bounds_size, max_align));
13638 for (
int i = 0; i < range_fields.size (); i += 2)
13640 gdb_assert (iter->
code () == TYPE_CODE_ARRAY);
13648 result->
set_code (TYPE_CODE_STRUCT);
13673static struct type *
13683 unsigned int bit_stride = 0;
13685 element_type =
die_type (die, cu);
13704 complaint (_(
"unable to read array DW_AT_byte_stride "
13705 " - DIE at %s [in module %s]"),
13711 byte_stride_prop = NULL;
13721 if (die->
child == NULL)
13727 byte_stride_prop, bit_stride);
13731 std::vector<struct type *> range_types;
13732 child_die = die->
child;
13733 while (child_die && child_die->
tag)
13735 if (child_die->
tag == DW_TAG_subrange_type
13736 || child_die->
tag == DW_TAG_generic_subrange)
13740 if (child_type != NULL)
13744 range_types.push_back (child_type);
13747 child_die = child_die->
sibling;
13750 if (range_types.empty ())
13752 complaint (_(
"unable to find array range - DIE at %s [in module %s]"),
13761 type = element_type;
13768 while (i < range_types.size ())
13774 byte_stride_prop =
nullptr;
13779 size_t ndim = range_types.size ();
13786 byte_stride_prop =
nullptr;
13792 gdb_assert (
type != element_type);
13801 if (attr !=
nullptr)
13813 complaint (_(
"DW_AT_byte_size for array type smaller "
13814 "than the total size of elements"));
13823 struct type *replacement_type =
nullptr;
13827 if (replacement_type !=
nullptr)
13828 type = replacement_type;
13840static enum dwarf_array_dim_ordering
13847 if (attr !=
nullptr)
13850 if (val == DW_ORD_row_major || val == DW_ORD_col_major)
13851 return (
enum dwarf_array_dim_ordering) val;
13864 return DW_ORD_row_major;
13870 return DW_ORD_col_major;
13873 return DW_ORD_row_major;
13880static struct type *
13925 unsigned int cu_off;
13927 LONGEST offset = 0;
13929 gdb_assert (common_loc && member_loc);
13937 gdb_assert (baton->
per_cu);
13939 baton->
size = 5 + 1 ;
13952 *ptr++ = DW_OP_call4;
13959 *ptr++ = DW_OP_addr;
13969 ptr +=
block->size;
13972 *ptr++ = DW_OP_plus;
13973 gdb_assert (ptr - baton->
data == baton->
size);
13991 if (attr !=
nullptr)
14006 "common block member");
14011 if (die->
child != NULL)
14015 size_t n_entries = 0,
size;
14019 for (child_die = die->
child;
14020 child_die && child_die->
tag;
14021 child_die = child_die->
sibling)
14032 for (child_die = die->
child;
14033 child_die && child_die->
tag;
14034 child_die = child_die->
sibling)
14045 member_loc =
dwarf2_attr (child_die, DW_AT_data_member_location,
14053 complaint (_(
"Variable in common block has "
14054 "DW_AT_data_member_location "
14055 "- DIE at %s [in module %s]"),
14064 if (attr !=
nullptr)
14081static struct type *
14085 const char *previous_prefix, *
name;
14090 if (
dwarf2_attr (die, DW_AT_extension, cu) != NULL)
14108 if (previous_prefix[0] !=
'\0')
14110 previous_prefix,
name, 0, cu);
14131 if (
dwarf2_attr (die, DW_AT_extension, cu) == NULL)
14143 std::vector<const char *> excludes;
14145 previous_prefix,
type->
name (), NULL,
14152 if (die->
child != NULL)
14156 while (child_die && child_die->
tag)
14159 child_die = child_die->
sibling;
14168static struct type *
14172 const char *module_name;
14193 while (child_die && child_die->
tag)
14196 child_die = child_die->
sibling;
14208 const char *
name = NULL;
14212 for (current_die = die;
14213 current_die != NULL;
14226 *is_anonymous = (
name == NULL);
14236static struct type *
14244 int byte_size, addr_class;
14256 attr_byte_size =
dwarf2_attr (die, DW_AT_byte_size, cu);
14257 if (attr_byte_size)
14262 attr_address_class =
dwarf2_attr (die, DW_AT_address_class, cu);
14263 if (attr_address_class)
14266 addr_class = DW_ADDR_none;
14276 || addr_class != DW_ADDR_none)
14280 type_instance_flags type_flags
14289 complaint (_(
"invalid pointer size %d"), byte_size);
14294 " - DIE at %s [in module %s]"),
14312static struct type *
14316 struct type *to_type;
14317 struct type *domain;
14348static struct type *
14356 gdb_assert (refcode == TYPE_CODE_REF || refcode == TYPE_CODE_RVALUE_REF);
14367 if (attr !=
nullptr)
14382static struct type *
14384 struct type *base_type,
int cnst,
int voltl)
14386 struct type *el_type, *inner_array;
14389 inner_array = base_type;
14405static struct type *
14408 struct type *base_type, *cv_type;
14419 if (base_type->
code () == TYPE_CODE_ARRAY)
14426static struct type *
14429 struct type *base_type, *cv_type;
14441 if (base_type->
code () == TYPE_CODE_ARRAY)
14450static struct type *
14453 struct type *base_type, *cv_type;
14468static struct type *
14471 struct type *base_type, *cv_type;
14489static struct type *
14497 bool length_is_constant =
true;
14507 if (
dwarf2_attr (die, DW_AT_bit_size, cu) !=
nullptr
14508 ||
dwarf2_attr (die, DW_AT_string_length_bit_size, cu) !=
nullptr)
14510 static bool warning_printed =
false;
14511 if (!warning_printed)
14513 warning (_(
"DW_AT_bit_size and DW_AT_string_length_bit_size not "
14514 "currently supported on DW_TAG_string_type."));
14515 warning_printed =
true;
14519 attr =
dwarf2_attr (die, DW_AT_string_length, cu);
14525 struct type *prop_type;
14527 =
dwarf2_attr (die, DW_AT_string_length_byte_size, cu);
14528 if (len ==
nullptr)
14548 length_is_constant =
false;
14550 else if (attr !=
nullptr)
14558 else if ((attr =
dwarf2_attr (die, DW_AT_byte_size, cu)) !=
nullptr)
14571 if (length_is_constant)
14628static struct type *
14633 struct type *ftype;
14651 attr =
dwarf2_attr (die, DW_AT_calling_convention, cu);
14652 if (attr !=
nullptr
14672 if (die->
child != NULL)
14676 int nparams, iparams;
14682 child_die = die->
child;
14683 while (child_die && child_die->
tag)
14685 if (child_die->
tag == DW_TAG_formal_parameter)
14687 else if (child_die->
tag == DW_TAG_unspecified_parameters)
14690 child_die = child_die->
sibling;
14698 for (iparams = 0; iparams < nparams; iparams++)
14702 child_die = die->
child;
14703 while (child_die && child_die->
tag)
14705 if (child_die->
tag == DW_TAG_formal_parameter)
14707 struct type *arg_type;
14718 attr =
dwarf2_attr (child_die, DW_AT_artificial, cu);
14719 if (attr !=
nullptr)
14723 arg_type =
die_type (child_die, cu);
14736 attr =
dwarf2_attr (die, DW_AT_object_pointer, cu);
14737 if (attr !=
nullptr)
14743 else if (
name && strcmp (
name,
"this") == 0)
14746 else if (
name == NULL && iparams == 0)
14760 child_die = child_die->
sibling;
14767static struct type *
14772 struct type *this_type;
14792 this_type = alloc.
new_type (TYPE_CODE_TYPEDEF, 0,
name);
14801 complaint (_(
"Self-referential DW_TAG_typedef "
14802 "- DIE at %s [in module %s]"),
14827 if (attr->
form == DW_FORM_exprloc)
14830 if (blk->
size > 0 && blk->
data[0] == DW_OP_implicit_value)
14836 if (ptr - blk->
data + len <= blk->
size)
14838 value->read (gdb::make_array_view (ptr, len),
14840 ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE,
14854 ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE,
14874 struct attribute *num_attr, *denom_attr;
14876 num_attr =
dwarf2_attr (die, DW_AT_GNU_numerator, cu);
14877 if (num_attr ==
nullptr)
14878 complaint (_(
"DW_AT_GNU_numerator missing in %s DIE at %s"),
14881 denom_attr =
dwarf2_attr (die, DW_AT_GNU_denominator, cu);
14882 if (denom_attr ==
nullptr)
14883 complaint (_(
"DW_AT_GNU_denominator missing in %s DIE at %s"),
14886 if (num_attr ==
nullptr || denom_attr ==
nullptr)
14889 get_mpz (cu, numerator, num_attr);
14890 get_mpz (cu, denominator, denom_attr);
14909 if (num < 0 && denom < 0)
14916 complaint (_(
"unexpected negative value for DW_AT_GNU_numerator"
14921 else if (denom < 0)
14923 complaint (_(
"unexpected negative value for DW_AT_GNU_denominator"
14929 *numerator = std::move (num);
14930 *denominator = std::move (denom);
14946 if (encoding[k] !=
'_' || !isdigit (encoding[k + 1]))
14954 while (isdigit (encoding[k]))
14959 std::string copy (&encoding[start], k - start);
14960 return result->
set (copy.c_str (), 10);
14987 gdb_assert (
type->
code () == TYPE_CODE_FIXED_POINT
14993 if (suffix ==
nullptr)
14995 attr =
dwarf2_attr (die, DW_AT_binary_scale, cu);
14996 if (attr ==
nullptr)
14997 attr =
dwarf2_attr (die, DW_AT_decimal_scale, cu);
14998 if (attr ==
nullptr)
15011 if (attr ==
nullptr)
15014 if (suffix !=
nullptr
15020 && (suffix[offset] !=
'_'
15033 complaint (_(
"no scale found for fixed-point type (DIE at %s)"),
15037 else if (attr->
name == DW_AT_binary_scale)
15040 gdb_mpz &num_or_denom = scale_exp > 0 ? scale_num : scale_denom;
15042 num_or_denom <<= std::abs (scale_exp);
15044 else if (attr->
name == DW_AT_decimal_scale)
15047 gdb_mpz &num_or_denom = scale_exp > 0 ? scale_num : scale_denom;
15049 num_or_denom =
gdb_mpz::pow (10, std::abs (scale_exp));
15051 else if (attr->
name == DW_AT_small)
15057 if (scale_die->
tag == DW_TAG_constant)
15059 &scale_num, &scale_denom);
15061 complaint (_(
"%s DIE not supported as target of DW_AT_small attribute"
15067 complaint (_(
"unsupported scale attribute %s for fixed-point type"
15078#define GNAT_FIXED_POINT_SUFFIX "___XF_"
15094static struct type *
15096 const char *name_hint,
enum bfd_endian byte_order)
15100 const struct floatformat **format;
15115static struct type *
15126 && strcmp (
name,
"void") == 0)
15148 if (attr ==
nullptr)
15155 if (scale_die->
tag != DW_TAG_constant)
15160 return num == 0 && denom == 0;
15172static struct type *
15174 int bits,
const char *name_hint,
15175 enum bfd_endian byte_order)
15179 struct type *tt =
nullptr;
15184 switch (cu->
lang ())
15221 if (tt !=
nullptr && tt->
length () * TARGET_CHAR_BIT !=
bits)
15224 const char *
name = (tt ==
nullptr) ?
nullptr : tt->
name ();
15231static struct type *
15237 int encoding = 0,
bits = 0;
15245 if (attr !=
nullptr)
15249 complaint (_(
"DW_AT_name missing from DW_TAG_base_type"));
15262 byte_order = BFD_ENDIAN_BIG;
15264 case DW_END_little:
15265 byte_order = BFD_ENDIAN_LITTLE;
15268 complaint (_(
"DW_AT_endianity has unrecognized value %d"), endianity);
15273 if ((encoding == DW_ATE_signed_fixed || encoding == DW_ATE_unsigned_fixed)
15285 encoding = (encoding == DW_ATE_signed_fixed
15287 : DW_ATE_unsigned);
15294 const char *gnat_encoding_suffix =
nullptr;
15295 if ((encoding == DW_ATE_signed || encoding == DW_ATE_unsigned)
15297 &&
name !=
nullptr)
15300 if (gnat_encoding_suffix !=
nullptr)
15302 gdb_assert (startswith (gnat_encoding_suffix,
15305 name, gnat_encoding_suffix -
name);
15310 encoding = (encoding == DW_ATE_signed
15311 ? DW_ATE_signed_fixed
15312 : DW_ATE_unsigned_fixed);
15319 case DW_ATE_address:
15321 type = alloc.
new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, NULL);
15324 case DW_ATE_boolean:
15327 case DW_ATE_complex_float:
15330 if (
type->
code () == TYPE_CODE_ERROR)
15332 if (
name ==
nullptr)
15334 struct obstack *obstack
15344 case DW_ATE_decimal_float:
15350 case DW_ATE_signed:
15353 case DW_ATE_unsigned:
15356 && startswith (
name,
"character("))
15361 case DW_ATE_signed_char:
15370 case DW_ATE_unsigned_char:
15386 case DW_ATE_signed_fixed:
15390 case DW_ATE_unsigned_fixed:
15396 complaint (_(
"unsupported DW_AT_encoding: '%s'"),
15402 if (
type->
code () == TYPE_CODE_INT
15404 && strcmp (
name,
"char") == 0)
15417 if (real_bit_size >= 0 && real_bit_size <= 8 * type->length ())
15419 attr =
dwarf2_attr (die, DW_AT_data_bit_offset, cu);
15421 if (attr ==
nullptr
15429 if (attr !=
nullptr)
15446 if (die->
tag != DW_TAG_variable)
15450 if (attr ==
nullptr || !attr->
as_boolean ())
15454 if (attr ==
nullptr)
15466 struct type *default_type)
15473 gdb_assert (default_type != NULL);
15475 if (attr == NULL || prop == NULL)
15486 if (attr->
form == DW_FORM_data16)
15488 size_t data_size = 16;
15490 block->size = (data_size
15492 gdb_byte *
data = XOBNEWVEC (obstack, gdb_byte,
block->size);
15493 data[0] = DW_OP_implicit_value;
15494 data[1] = data_size;
15503 switch (attr->
name)
15505 case DW_AT_string_length:
15514 gdb_assert (prop->
baton () != NULL);
15523 target_attr =
dwarf2_attr (target_die, DW_AT_location, target_cu);
15524 if (target_attr == NULL)
15525 target_attr =
dwarf2_attr (target_die, DW_AT_data_member_location,
15527 if (target_attr ==
nullptr)
15528 target_attr =
dwarf2_attr (target_die, DW_AT_data_bit_offset,
15530 if (target_attr == NULL)
15533 if (
name !=
nullptr)
15541 switch (target_attr->
name)
15543 case DW_AT_location:
15550 gdb_assert (prop->
baton () != NULL);
15563 gdb_assert (prop->
baton () != NULL);
15568 "dynamic property");
15572 case DW_AT_data_member_location:
15573 case DW_AT_data_bit_offset:
15594 switch (attr->
name)
15596 case DW_AT_string_length:
15601 gdb_assert (prop->
baton () != NULL);
15624static struct type *
15649static struct type *
15652 struct type *base_type, *orig_base_type;
15653 struct type *range_type;
15656 int low_default_is_valid;
15657 int high_bound_is_count = 0;
15677 switch (cu->
lang ())
15682 low_default_is_valid = 1;
15686 low_default_is_valid = 1;
15702 low_default_is_valid = 0;
15707 if (attr !=
nullptr)
15709 else if (!low_default_is_valid)
15710 complaint (_(
"Missing DW_AT_lower_bound "
15711 "- DIE at %s [in module %s]"),
15715 struct attribute *attr_ub, *attr_count;
15716 attr = attr_ub =
dwarf2_attr (die, DW_AT_upper_bound, cu);
15719 attr = attr_count =
dwarf2_attr (die, DW_AT_count, cu);
15726 high_bound_is_count = 1;
15730 if (attr_ub != NULL)
15731 complaint (_(
"Unresolved DW_AT_upper_bound "
15732 "- DIE at %s [in module %s]"),
15735 if (attr_count != NULL)
15737 "- DIE at %s [in module %s]"),
15760 if (base_type->
length () <= sizeof (ULONGEST))
15762 ULONGEST negative_mask
15763 = -((ULONGEST) 1 << (base_type->
length () * TARGET_CHAR_BIT - 1));
15777 if (attr_byte_stride !=
nullptr)
15786 if (attr_bit_stride !=
nullptr)
15789 if (attr_byte_stride !=
nullptr)
15791 complaint (_(
"Found DW_AT_bit_stride and DW_AT_byte_stride "
15792 "- DIE at %s [in module %s]"),
15795 attr_bit_stride =
nullptr;
15806 if (attr_byte_stride !=
nullptr
15807 || attr_bit_stride !=
nullptr)
15809 bool byte_stride_p = (attr_byte_stride !=
nullptr);
15811 = byte_stride_p ? &byte_stride_prop : &bit_stride_prop;
15815 &high, bias, stride, byte_stride_p);
15820 if (high_bound_is_count)
15832 if (attr !=
nullptr)
15845static struct type *
15851 .
new_type (TYPE_CODE_VOID, 0,
nullptr));
15872 const gdb_byte *info_ptr,
15873 const gdb_byte **new_info_ptr,
15877 const gdb_byte *cur_ptr;
15882 *new_info_ptr = cur_ptr;
15892 *new_info_ptr = cur_ptr;
15906 const gdb_byte *info_ptr,
15907 const gdb_byte **new_info_ptr,
15910 struct die_info *first_die, *last_sibling;
15911 const gdb_byte *cur_ptr;
15913 cur_ptr = info_ptr;
15914 first_die = last_sibling = NULL;
15923 *new_info_ptr = cur_ptr;
15932 last_sibling = die;
15943 const gdb_byte *info_ptr,
15944 const gdb_byte **new_info_ptr,
15953 "Read die from %s@0x%x of %s:\n",
15956 bfd_get_filename (reader->
abfd));
15970static const gdb_byte *
15972 struct die_info **diep,
const gdb_byte *info_ptr,
15973 int num_extra_attrs,
bool allow_reprocess)
15975 unsigned int abbrev_number, bytes_read, i;
15979 bfd *abfd = reader->
abfd;
15981 sect_offset sect_off = (sect_offset) (info_ptr - reader->
buffer);
15983 info_ptr += bytes_read;
15984 if (!abbrev_number)
15992 error (_(
"Dwarf Error: could not find abbrev number %d [in module %s]"),
15994 bfd_get_filename (abfd));
16000 die->
abbrev = abbrev_number;
16008 for (i = 0; i < abbrev->
num_attrs; ++i)
16010 info_ptr, allow_reprocess);
16020static const gdb_byte *
16022 struct die_info **diep,
const gdb_byte *info_ptr,
16023 gdb::array_view<attribute *> extra_attrs)
16025 const gdb_byte *result;
16028 result =
read_full_die_1 (reader, diep, info_ptr, extra_attrs.size (),
16032 attribute *next = &(*diep)->attrs[(*diep)->num_attrs];
16036 struct attribute *attr = (*diep)->attr (DW_AT_str_offsets_base);
16040 attr = (*diep)->attr (DW_AT_loclists_base);
16041 if (attr !=
nullptr)
16044 auto maybe_addr_base = (*diep)->addr_base ();
16045 if (maybe_addr_base.has_value ())
16048 attr = (*diep)->attr (DW_AT_rnglists_base);
16049 if (attr !=
nullptr)
16052 for (
int i = 0; i < (*diep)->num_attrs; ++i)
16054 if ((*diep)->attrs[i].form_requires_reprocessing ())
16058 (*diep)->num_attrs += extra_attrs.size ();
16063 "Read die from %s@0x%x of %s:\n",
16066 bfd_get_filename (reader->
abfd));
16082 unrelocated_addr best_lowpc = {}, best_highpc = {};
16092 unrelocated_addr low = per_objfile->
adjust (best_lowpc);
16093 unrelocated_addr high = per_objfile->
adjust (best_highpc);
16098 (CORE_ADDR) high - 1,
16113 case DW_TAG_variable:
16114 case DW_TAG_subprogram:
16125 sect_offset sect_off,
bool is_dwz,
16143 if (!per_cu->
scanned.compare_exchange_strong (nope,
true))
16150 if (result ==
nullptr)
16152 cutu_reader new_reader (per_cu, per_objfile,
nullptr,
nullptr,
false,
16157 std::unique_ptr<cutu_reader> copy
16174 const gdb_byte *watermark_ptr,
16175 const gdb_byte *info_ptr,
16178 const char **linkage_name,
16179 cooked_index_flag *
flags,
16180 sect_offset *sibling_offset,
16182 CORE_ADDR *maybe_defer,
16183 bool for_specification)
16185 bool origin_is_dwz =
false;
16186 bool is_declaration =
false;
16187 sect_offset origin_offset {};
16189 gdb::optional<unrelocated_addr> low_pc;
16190 gdb::optional<unrelocated_addr> high_pc;
16191 bool high_pc_relative =
false;
16193 for (
int i = 0; i < abbrev->
num_attrs; ++i)
16203 switch (abbrev->
tag)
16205 case DW_TAG_compile_unit:
16206 case DW_TAG_partial_unit:
16207 case DW_TAG_type_unit:
16213 if (*
name ==
nullptr)
16219 case DW_AT_linkage_name:
16220 case DW_AT_MIPS_linkage_name:
16224 if (*linkage_name ==
nullptr)
16230 case DW_AT_main_subprogram:
16238 case DW_AT_calling_convention:
16243 case DW_AT_declaration:
16247 case DW_AT_sibling:
16248 if (sibling_offset !=
nullptr)
16252 case DW_AT_specification:
16253 case DW_AT_abstract_origin:
16254 case DW_AT_extension:
16256 origin_is_dwz = attr.
form == DW_FORM_GNU_ref_alt;
16259 case DW_AT_external:
16261 *
flags &= ~IS_STATIC;
16264 case DW_AT_enum_class:
16273 case DW_AT_high_pc:
16276 high_pc_relative =
true;
16279 case DW_AT_location:
16288 low_pc = (unrelocated_addr) addr;
16292 high_pc = (unrelocated_addr) (addr + 1);
16293 high_pc_relative =
false;
16309 unrelocated_addr lowpc, highpc;
16312 scanning_per_cu, abbrev->
tag);
16322 if (is_declaration && !for_specification
16327 if ((abbrev->
tag == DW_TAG_class_type
16328 || abbrev->
tag == DW_TAG_structure_type
16329 || abbrev->
tag == DW_TAG_union_type)
16334 *linkage_name =
nullptr;
16338 else if ((*
name ==
nullptr
16339 || (*linkage_name ==
nullptr
16342 && origin_offset != sect_offset (0))
16346 origin_is_dwz,
false);
16347 if (new_reader !=
nullptr)
16349 const gdb_byte *new_info_ptr = (new_reader->
buffer
16350 + to_underlying (origin_offset));
16352 if (new_reader->
cu == reader->
cu
16353 && new_info_ptr > watermark_ptr
16354 && *parent_entry ==
nullptr)
16355 *maybe_defer =
form_addr (origin_offset, origin_is_dwz);
16356 else if (*parent_entry ==
nullptr)
16358 CORE_ADDR lookup =
form_addr (origin_offset, origin_is_dwz);
16363 unsigned int bytes_read;
16367 new_info_ptr += bytes_read;
16369 if (new_reader->
cu == reader->
cu && new_info_ptr == watermark_ptr)
16375 new_info_ptr, new_abbrev,
name, linkage_name,
16376 flags,
nullptr, parent_entry, maybe_defer,
true);
16380 if (!for_specification)
16383 && *linkage_name ==
nullptr)
16384 *linkage_name = *
name;
16387 && low_pc.has_value ()
16389 || *low_pc != (unrelocated_addr) 0)
16390 && high_pc.has_value ())
16392 if (high_pc_relative)
16393 high_pc = (unrelocated_addr) ((ULONGEST) *high_pc
16394 + (ULONGEST) *low_pc);
16396 if (*high_pc > *low_pc)
16399 unrelocated_addr lo = per_objfile->
adjust (*low_pc);
16400 unrelocated_addr hi = per_objfile->
adjust (*high_pc);
16403 (CORE_ADDR) hi - 1,
16408 if (abbrev->
tag == DW_TAG_module || abbrev->
tag == DW_TAG_namespace)
16409 *
flags &= ~IS_STATIC;
16411 if (abbrev->
tag == DW_TAG_namespace && *
name ==
nullptr)
16412 *
name =
"(anonymous namespace)";
16415 && (abbrev->
tag == DW_TAG_class_type
16416 || abbrev->
tag == DW_TAG_interface_type
16417 || abbrev->
tag == DW_TAG_structure_type
16418 || abbrev->
tag == DW_TAG_union_type
16419 || abbrev->
tag == DW_TAG_enumeration_type
16420 || abbrev->
tag == DW_TAG_enumerator))
16421 *
flags &= ~IS_STATIC;
16429 const gdb_byte *info_ptr,
16432 sect_offset sect_off {};
16433 bool is_dwz =
false;
16435 for (
int i = 0; i < abbrev->
num_attrs; ++i)
16441 if (attr.
name == DW_AT_import)
16444 is_dwz = (attr.
form == DW_FORM_GNU_ref_alt
16450 if (sect_off == sect_offset (0))
16456 if (new_reader !=
nullptr)
16468 const gdb_byte *info_ptr,
16472 info_ptr =
index_dies (reader, info_ptr, parent_entry, fully);
16474 if (parent_entry !=
nullptr)
16480 CORE_ADDR end =
form_addr (sect_offset (info_ptr - 1 - reader->
buffer),
16490 const gdb_byte *info_ptr,
16494 const gdb_byte *end_ptr = (reader->
buffer
16498 while (info_ptr < end_ptr)
16500 sect_offset this_die = (sect_offset) (info_ptr - reader->
buffer);
16501 unsigned int bytes_read;
16504 info_ptr += bytes_read;
16505 if (abbrev ==
nullptr)
16508 if (abbrev->
tag == DW_TAG_imported_unit)
16516 info_ptr =
skip_one_die (reader, info_ptr, abbrev, !fully);
16518 info_ptr =
index_dies (reader, info_ptr, parent_entry, fully);
16522 const char *
name =
nullptr;
16523 const char *linkage_name =
nullptr;
16524 CORE_ADDR defer = 0;
16526 sect_offset sibling {};
16529 info_ptr, abbrev, &
name, &linkage_name,
16530 &
flags, &sibling, &this_parent_entry,
16533 if (abbrev->
tag == DW_TAG_namespace
16535 && strcmp (
name,
"::") == 0)
16545 if (
name !=
nullptr)
16553 name, this_parent_entry,
16557 if (linkage_name !=
nullptr)
16561 if (
name !=
nullptr)
16565 if (
name !=
nullptr
16566 || (abbrev->
tag != DW_TAG_subprogram
16567 && abbrev->
tag != DW_TAG_inlined_subroutine
16568 && abbrev->
tag != DW_TAG_entry_point))
16576 switch (abbrev->
tag)
16578 case DW_TAG_class_type:
16579 case DW_TAG_interface_type:
16580 case DW_TAG_structure_type:
16581 case DW_TAG_union_type:
16584 info_ptr =
recurse (reader, info_ptr, this_entry, fully);
16589 case DW_TAG_enumeration_type:
16596 info_ptr =
recurse (reader, info_ptr,
16603 case DW_TAG_module:
16604 if (this_entry ==
nullptr)
16607 case DW_TAG_namespace:
16610 info_ptr =
recurse (reader, info_ptr, this_entry, fully);
16613 case DW_TAG_subprogram:
16616 && this_entry !=
nullptr)
16618 info_ptr =
recurse (reader, info_ptr, this_entry,
true);
16624 if (sibling != sect_offset (0))
16626 const gdb_byte *sibling_ptr
16627 = reader->
buffer + to_underlying (sibling);
16629 if (sibling_ptr < info_ptr)
16630 complaint (_(
"DW_AT_sibling points backwards"));
16634 info_ptr = sibling_ptr;
16668 CORE_ADDR adjusted_pc)
override;
16677 = (gdb::checked_static_cast<cooked_index *>
16679 if (index ==
nullptr)
16696 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
16698 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
16699 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
16700 block_search_flags search_flags,
16718 bool *symbol_found_p)
override
16720 *symbol_found_p =
false;
16736 = (gdb::checked_static_cast<cooked_index *>
16741 if (entry->tag != DW_TAG_subprogram)
16744 enum language lang = entry->per_cu->lang ();
16748 *symbol_found_p =
true;
16758 CORE_ADDR adjusted_pc)
16761 = (gdb::checked_static_cast<cooked_index *>
16763 if (table ==
nullptr)
16765 return table->
lookup (adjusted_pc);
16777 = (gdb::checked_static_cast<cooked_index *>
16779 if (table ==
nullptr)
16784 if (per_cu ==
nullptr)
16800 = (gdb::checked_static_cast<cooked_index *>
16802 if (table ==
nullptr)
16805 const block_search_flags search_flags = (global
16816 if (entry->parent_entry !=
nullptr)
16819 if (!entry->matches (search_flags)
16820 || !entry->matches (domain))
16823 if (name_match (entry->canonical, lookup_name,
nullptr))
16831 gdb::function_view<expand_symtabs_file_matcher_ftype> file_matcher,
16833 gdb::function_view<expand_symtabs_symbol_matcher_ftype> symbol_matcher,
16834 gdb::function_view<expand_symtabs_exp_notify_ftype> expansion_notify,
16835 block_search_flags search_flags,
16842 = (gdb::checked_static_cast<cooked_index *>
16844 if (table ==
nullptr)
16852 gdb_assert (lookup_name !=
nullptr || symbol_matcher ==
nullptr);
16853 if (lookup_name ==
nullptr)
16873 static const enum language unique_styles[] =
16884 for (
enum language lang : unique_styles)
16886 std::vector<gdb::string_view> name_vec
16887 = lookup_name_without_params.
split_name (lang);
16888 std::string last_name = gdb::to_string (name_vec.back ());
16901 if (file_matcher !=
nullptr && !entry->per_cu->mark)
16905 if (!entry->matches (search_flags)
16906 || !entry->matches (domain)
16907 || !entry->matches (kind))
16916 for (
int i = name_vec.size () - 1; i > 0; --i)
16920 if (parent ==
nullptr
16921 || strncmp (parent->
name, name_vec[i - 1].data (),
16922 name_vec[i - 1].length ()) != 0)
16936 if (symbol_matcher ==
nullptr)
16943 && parent !=
nullptr)
16948 auto_obstack temp_storage;
16949 const char *full_name = entry->full_name (&temp_storage);
16950 if (!symbol_matcher (full_name))
16987 sect_offset header_offset)
16989 unsigned int bytes_read;
16991 const gdb_byte *info_ptr = section->
buffer + to_underlying (header_offset);
16994 info_ptr += bytes_read;
17039 ULONGEST loclist_header_size =
17045 ULONGEST start_offset =
17054 error (_(
"DW_FORM_loclistx used without .debug_loclists "
17059 if (loclist_base < loclist_header_size)
17060 error (_(
"DW_AT_loclists_base is smaller than header size [in module %s]"),
17066 (sect_offset) (loclist_base - loclist_header_size));
17070 error (_(
"DW_FORM_loclistx pointing outside of "
17071 ".debug_loclists offset array [in module %s]"),
17076 error (_(
"Reading DW_FORM_loclistx index beyond end of"
17077 ".debug_loclists section [in module %s]"),
17080 const gdb_byte *info_ptr = section->
buffer + start_offset;
17083 return (sect_offset) (bfd_get_32 (abfd, info_ptr) + loclist_base);
17085 return (sect_offset) (bfd_get_64 (abfd, info_ptr) + loclist_base);
17098 ULONGEST rnglist_header_size =
17105 ULONGEST rnglist_base =
17109 ULONGEST start_offset =
17117 if (
section->buffer ==
nullptr)
17118 error (_(
"DW_FORM_rnglistx used without .debug_rnglists section "
17124 if (rnglist_base < rnglist_header_size)
17125 error (_(
"DW_AT_rnglists_base is smaller than header size [in module %s]"),
17131 (sect_offset) (rnglist_base - rnglist_header_size));
17135 error (_(
"DW_FORM_rnglistx index pointing outside of "
17136 ".debug_rnglists offset array [in module %s]"),
17141 error (_(
"Reading DW_FORM_rnglistx index beyond end of"
17142 ".debug_rnglists section [in module %s]"),
17145 const gdb_byte *info_ptr = section->
buffer + start_offset;
17148 return (sect_offset) (
read_4_bytes (abfd, info_ptr) + rnglist_base);
17150 return (sect_offset) (
read_8_bytes (abfd, info_ptr) + rnglist_base);
17162 switch (attr->
form)
17164 case DW_FORM_addrx:
17165 case DW_FORM_GNU_addr_index:
17169 case DW_FORM_loclistx:
17171 sect_offset loclists_sect_off
17174 attr->
set_unsigned (to_underlying (loclists_sect_off));
17177 case DW_FORM_rnglistx:
17179 sect_offset rnglists_sect_off
17182 attr->
set_unsigned (to_underlying (rnglists_sect_off));
17186 case DW_FORM_strx1:
17187 case DW_FORM_strx2:
17188 case DW_FORM_strx3:
17189 case DW_FORM_strx4:
17190 case DW_FORM_GNU_str_index:
17203 gdb_assert_not_reached (
"Unexpected DWARF form.");
17209static const gdb_byte *
17212 LONGEST implicit_const,
const gdb_byte *info_ptr,
17213 bool allow_reprocess)
17218 bfd *abfd = reader->
abfd;
17220 unsigned int bytes_read;
17223 attr->
form = (
enum dwarf_form) form;
17226 case DW_FORM_ref_addr:
17233 info_ptr += bytes_read;
17235 case DW_FORM_GNU_ref_alt:
17238 info_ptr += bytes_read;
17242 unrelocated_addr addr = cu_header->
read_address (abfd, info_ptr,
17244 addr = per_objfile->
adjust (addr);
17246 info_ptr += bytes_read;
17249 case DW_FORM_block2:
17254 info_ptr += blk->
size;
17257 case DW_FORM_block4:
17262 info_ptr += blk->
size;
17265 case DW_FORM_data2:
17269 case DW_FORM_data4:
17273 case DW_FORM_data8:
17277 case DW_FORM_data16:
17284 case DW_FORM_sec_offset:
17287 info_ptr += bytes_read;
17289 case DW_FORM_loclistx:
17293 info_ptr += bytes_read;
17294 if (allow_reprocess)
17298 case DW_FORM_string:
17301 info_ptr += bytes_read;
17308 abfd, info_ptr, cu_header,
17310 info_ptr += bytes_read;
17314 case DW_FORM_line_strp:
17320 info_ptr += bytes_read;
17324 case DW_FORM_GNU_strp_alt:
17327 LONGEST str_offset = cu_header->
read_offset (abfd, info_ptr,
17332 info_ptr += bytes_read;
17335 case DW_FORM_exprloc:
17336 case DW_FORM_block:
17339 info_ptr += bytes_read;
17341 info_ptr += blk->
size;
17344 case DW_FORM_block1:
17349 info_ptr += blk->
size;
17352 case DW_FORM_data1:
17357 case DW_FORM_flag_present:
17360 case DW_FORM_sdata:
17362 info_ptr += bytes_read;
17364 case DW_FORM_rnglistx:
17368 info_ptr += bytes_read;
17369 if (allow_reprocess)
17373 case DW_FORM_udata:
17375 info_ptr += bytes_read;
17397 case DW_FORM_ref_sig8:
17401 case DW_FORM_ref_udata:
17405 info_ptr += bytes_read;
17407 case DW_FORM_indirect:
17409 info_ptr += bytes_read;
17410 if (form == DW_FORM_implicit_const)
17413 info_ptr += bytes_read;
17416 info_ptr, allow_reprocess);
17418 case DW_FORM_implicit_const:
17421 case DW_FORM_addrx:
17422 case DW_FORM_GNU_addr_index:
17425 info_ptr += bytes_read;
17426 if (allow_reprocess)
17430 case DW_FORM_strx1:
17431 case DW_FORM_strx2:
17432 case DW_FORM_strx3:
17433 case DW_FORM_strx4:
17434 case DW_FORM_GNU_str_index:
17436 ULONGEST str_index;
17437 if (form == DW_FORM_strx1)
17442 else if (form == DW_FORM_strx2)
17447 else if (form == DW_FORM_strx3)
17452 else if (form == DW_FORM_strx4)
17460 info_ptr += bytes_read;
17463 if (allow_reprocess)
17468 error (_(
"Dwarf Error: Cannot handle %s in DWARF reader [in module %s]"),
17470 bfd_get_filename (abfd));
17475 attr->
form = DW_FORM_GNU_ref_alt;
17483 if (attr->
name == DW_AT_byte_size
17484 && form == DW_FORM_data4
17488 (_(
"Suspicious DW_AT_byte_size value treated as zero instead of %s"),
17498static const gdb_byte *
17501 const gdb_byte *info_ptr,
17502 bool allow_reprocess)
17515 LONGEST str_offset)
17518 str_offset,
"DW_FORM_strp");
17527 const gdb_byte *buf,
17529 unsigned int *bytes_read_ptr)
17531 LONGEST str_offset = cu_header->
read_offset (abfd, buf, bytes_read_ptr);
17540 unsigned int offset_size)
17543 ULONGEST str_offset =
read_offset (abfd, buf, offset_size);
17553 unsigned int *bytes_read_ptr)
17556 LONGEST str_offset = cu_header->
read_offset (abfd, buf, bytes_read_ptr);
17565static unrelocated_addr
17567 gdb::optional<ULONGEST> addr_base,
int addr_size)
17571 const gdb_byte *info_ptr;
17572 ULONGEST addr_base_or_zero = addr_base.has_value () ? *addr_base : 0;
17576 error (_(
"DW_FORM_addr_index used without .debug_addr section [in module %s]"),
17578 if (addr_base_or_zero + addr_index * addr_size
17580 error (_(
"DW_FORM_addr_index pointing outside of "
17581 ".debug_addr section [in module %s]"),
17584 + addr_index * addr_size);
17585 if (addr_size == 4)
17586 return (unrelocated_addr) bfd_get_32 (abfd, info_ptr);
17588 return (unrelocated_addr) bfd_get_64 (abfd, info_ptr);
17593static unrelocated_addr
17602static unrelocated_addr
17604 unsigned int *bytes_read)
17617 unsigned int addr_index)
17663 unsigned offset_size)
17669 const gdb_byte *info_ptr;
17670 ULONGEST str_offset;
17671 static const char form_name[] =
"DW_FORM_GNU_str_index or DW_FORM_strx";
17675 if (str_section->
buffer == NULL)
17676 error (_(
"%s used without %s section"
17677 " in CU at offset %s [in module %s]"),
17678 form_name, str_section->
get_name (),
17680 if (str_offsets_section->
buffer == NULL)
17681 error (_(
"%s used without %s section"
17682 " in CU at offset %s [in module %s]"),
17683 form_name, str_section->
get_name (),
17685 info_ptr = (str_offsets_section->
buffer
17687 + str_index * offset_size);
17688 if (offset_size == 4)
17689 str_offset = bfd_get_32 (abfd, info_ptr);
17691 str_offset = bfd_get_64 (abfd, info_ptr);
17692 if (str_offset >= str_section->
size)
17693 error (_(
"Offset from %s pointing outside of"
17694 " .debug_str.dwo section in CU at offset %s [in module %s]"),
17696 return (
const char *) (str_section->
buffer + str_offset);
17704 unsigned offset_size;
17705 ULONGEST str_offsets_base;
17711 unsigned int bytes_read = 0;
17719 const bool dwarf5_is_dwarf64 = bytes_read != 4;
17720 offset_size = dwarf5_is_dwarf64 ? 8 : 4;
17732 complaint (_(
"Section .debug_str_offsets in %s has unsupported"
17733 " version %d, use empty string."),
17741 str_offsets_base = bytes_read;
17748 str_offsets_base = 0;
17757 str_offsets_base, str_index, offset_size);
17767 static const char form_name[] =
"DW_FORM_GNU_str_index";
17768 static const char str_offsets_attr_name[] =
"DW_AT_str_offsets";
17771 error (_(
"%s used in Fission stub without %s"
17772 " in CU at offset 0x%lx [in module %s]"),
17773 form_name, str_offsets_attr_name,
17788 const gdb_byte *begin = buf;
17794 if ((
byte & 128) == 0)
17795 return buf - begin;
17814 case DW_LANG_C_plus_plus:
17815 case DW_LANG_C_plus_plus_11:
17816 case DW_LANG_C_plus_plus_14:
17822 case DW_LANG_Fortran77:
17823 case DW_LANG_Fortran90:
17824 case DW_LANG_Fortran95:
17825 case DW_LANG_Fortran03:
17826 case DW_LANG_Fortran08:
17832 case DW_LANG_Mips_Assembler:
17835 case DW_LANG_Ada83:
17836 case DW_LANG_Ada95:
17839 case DW_LANG_Modula2:
17842 case DW_LANG_Pascal83:
17849 case DW_LANG_Rust_old:
17852 case DW_LANG_OpenCL:
17855 case DW_LANG_Cobol74:
17856 case DW_LANG_Cobol85:
17878 return &die->
attrs[i];
17879 if (die->
attrs[i].
name == DW_AT_specification
17880 || die->
attrs[i].
name == DW_AT_abstract_origin)
17881 spec = &die->
attrs[i];
17889 if (die == prev_die)
17904 const char *
str = NULL;
17911 if (
str ==
nullptr)
17912 complaint (_(
"string type expected for attribute %s for "
17913 "DIE at %s in module %s"),
17927 if (dwo_name ==
nullptr)
17941 return attr !=
nullptr && attr->
as_boolean ();
17955 &&
dwarf2_attr (die, DW_AT_specification, cu) == NULL);
17970 if (spec_attr == NULL)
17971 spec_attr =
dwarf2_attr (die, DW_AT_abstract_origin, *spec_cu);
17973 if (spec_attr == NULL)
18015 const char *comp_dir)
18025 complaint (_(
"missing .debug_line.dwo section"));
18027 complaint (_(
"missing .debug_line section"));
18046 std::string &name_holder)
18048 const char *include_name = fe.
name;
18049 const char *include_name_to_compare = include_name;
18053 std::string hold_compare;
18054 if (!IS_ABSOLUTE_PATH (include_name)
18055 && (dir_name !=
nullptr || cu_info.
get_comp_dir () !=
nullptr))
18078 if (dir_name != NULL)
18080 name_holder = path_join (dir_name, include_name);
18081 include_name = name_holder.c_str ();
18082 include_name_to_compare = include_name;
18084 if (!IS_ABSOLUTE_PATH (include_name)
18087 hold_compare = path_join (cu_info.
get_comp_dir (), include_name);
18088 include_name_to_compare = hold_compare.c_str ();
18092 std::string copied_name;
18093 const char *cu_filename = cu_info.
get_name ();
18094 if (!IS_ABSOLUTE_PATH (cu_filename) && cu_info.
get_comp_dir () !=
nullptr)
18096 copied_name = path_join (cu_info.
get_comp_dir (), cu_filename);
18097 cu_filename = copied_name.c_str ();
18100 if (FILENAME_CMP (include_name_to_compare, cu_filename) == 0)
18102 return include_name;
18128 const gdb_byte *line_ptr,
18129 unrelocated_addr unrelocated_lowpc,
18130 unrelocated_addr address);
18144 (CORE_ADDR) address,
18185 m_flags &= ~LEF_PROLOGUE_END;
18206 if (line_delta != 0)
18261 CORE_ADDR addr_adj = (((
m_op_index + adjust)
18276 CORE_ADDR addr_adj = (((
m_op_index + adj_opcode_d)
18288 m_flags &= ~LEF_PROLOGUE_END;
18356 unsigned int line,
unsigned int last_line,
18357 int line_has_non_zero_discriminator,
18358 struct subfile *last_subfile)
18362 if (line != last_line)
18367 if (!line_has_non_zero_discriminator)
18377 unsigned int line, unrelocated_addr address,
18378 linetable_entry_flags
flags,
18381 unrelocated_addr addr
18383 (CORE_ADDR) address));
18388 "Recording line %u, file %s, address %s\n",
18404 unrelocated_addr address,
struct dwarf2_cu *cu)
18412 "Finishing current line, file %s, address %s\n",
18426 "Processing actual line %u: file %u,"
18427 " address %s, is_stmt %u, prologue_end %u, discrim %u%s\n",
18433 (end_sequence ?
"\t(end sequence)" :
""));
18462 bool ignore_this_line
18466 || (!end_sequence &&
m_line == 0));
18468 if ((file_changed && !ignore_this_line) || end_sequence)
18474 if (!end_sequence && !ignore_this_line)
18476 linetable_entry_flags lte_flags =
m_flags;
18509 m_line_header (lh),
18516 m_flags (lh->default_is_stmt ?
LEF_IS_STMT : (linetable_entry_flags) 0),
18517 m_last_address (m_address)
18523 const gdb_byte *line_ptr,
18524 unrelocated_addr unrelocated_lowpc,
18525 unrelocated_addr address)
18532 if ((address == (unrelocated_addr) 0 && address < unrelocated_lowpc)
18533 || address == (unrelocated_addr) -1)
18541 complaint (_(
".debug_line address at offset 0x%lx is 0 [in module %s]"),
18554 unrelocated_addr lowpc)
18556 const gdb_byte *line_ptr, *extended_end;
18557 const gdb_byte *line_end;
18558 unsigned int bytes_read, extended_len;
18559 unsigned char op_code, extended_op;
18568 while (line_ptr < line_end)
18573 bool end_sequence =
false;
18583 while (line_ptr < line_end && !end_sequence)
18593 else switch (op_code)
18595 case DW_LNS_extended_op:
18598 line_ptr += bytes_read;
18599 extended_end = line_ptr + extended_len;
18602 if (DW_LNE_lo_user <= extended_op
18603 && extended_op <= DW_LNE_hi_user)
18606 line_ptr = extended_end;
18609 switch (extended_op)
18611 case DW_LNE_end_sequence:
18613 end_sequence =
true;
18615 case DW_LNE_set_address:
18617 unrelocated_addr address
18619 line_ptr += bytes_read;
18626 case DW_LNE_define_file:
18628 const char *cur_file;
18629 unsigned int mod_time, length;
18634 line_ptr += bytes_read;
18637 line_ptr += bytes_read;
18640 line_ptr += bytes_read;
18643 line_ptr += bytes_read;
18647 case DW_LNE_set_discriminator:
18657 line_ptr += bytes_read;
18663 complaint (_(
"mangled .debug_line section"));
18669 if (line_ptr != extended_end)
18671 complaint (_(
"mangled .debug_line section"));
18678 case DW_LNS_advance_pc:
18682 line_ptr += bytes_read;
18687 case DW_LNS_advance_line:
18691 line_ptr += bytes_read;
18696 case DW_LNS_set_file:
18701 line_ptr += bytes_read;
18706 case DW_LNS_set_column:
18708 line_ptr += bytes_read;
18710 case DW_LNS_negate_stmt:
18713 case DW_LNS_set_basic_block:
18720 case DW_LNS_const_add_pc:
18723 case DW_LNS_fixed_advance_pc:
18731 case DW_LNS_set_prologue_end:
18742 line_ptr += bytes_read;
18779 unrelocated_addr lowpc,
int decode_mapping)
18781 if (decode_mapping)
18795 if (sf->
symtab ==
nullptr)
18830 std::string filename_holder;
18831 const char *filename = fe.
name;
18841 if (!IS_ABSOLUTE_PATH (filename) &&
dirname != NULL)
18843 filename_holder = path_join (
dirname, filename);
18844 filename = filename_holder.c_str ();
18885 if ((
block->data[0] == DW_OP_addr
18887 || ((
block->data[0] == DW_OP_GNU_addr_index
18888 ||
block->data[0] == DW_OP_addrx)
18892 unsigned int dummy;
18894 unrelocated_addr tem;
18895 if (
block->data[0] == DW_OP_addr)
18932 const char *orig_name,
struct dwarf2_cu *cu,
18933 struct pending **list_to_add)
18939 copy->set_aclass_index (copy->aclass () ==
LOC_BLOCK
18950 const char *linkagename)
18953 && linkagename !=
nullptr
18954 && !streq (
name, linkagename)
18962 && !startswith (
name,
"__builtin")
18963 && !startswith (linkagename,
"___ghost_")
18964 && !startswith (linkagename,
"__gnat")
18965 && !startswith (linkagename,
"_ada_")
18966 && !streq (linkagename,
"adainit"));
18983 struct symbol *sym = NULL;
18987 struct pending **list_to_add = NULL;
18989 int inlined_func = (die->
tag == DW_TAG_inlined_subroutine);
18992 if (
name ==
nullptr && (die->
tag == DW_TAG_subprogram
18993 || die->
tag == DW_TAG_inlined_subroutine
18994 || die->
tag == DW_TAG_entry_point))
18999 int suppress_add = 0;
19011 const char *physname
19027 if (attr !=
nullptr)
19039 inlined_func ? DW_AT_call_line : DW_AT_decl_line,
19041 if (attr !=
nullptr)
19045 inlined_func ? DW_AT_call_file : DW_AT_decl_file,
19059 complaint (_(
"file index out of range"));
19068 if (attr !=
nullptr)
19081 case DW_TAG_subprogram:
19086 if ((attr2 !=
nullptr && attr2->
as_boolean ())
19125 case DW_TAG_inlined_subroutine:
19132 case DW_TAG_template_value_param:
19135 case DW_TAG_constant:
19136 case DW_TAG_variable:
19137 case DW_TAG_member:
19141 if (sym->
type ()->
code () == TYPE_CODE_VOID)
19147 if (die->
tag == DW_TAG_member)
19154 if (attr !=
nullptr)
19160 if (attr2 !=
nullptr && attr2->
as_boolean ())
19168 if (attr !=
nullptr)
19176 && die->
parent->
tag == DW_TAG_common_block)
19188 else if (attr2 !=
nullptr && attr2->
as_boolean ())
19202 if (found.
minsym !=
nullptr)
19217 if (list_to_add !=
nullptr
19240 && die->
parent->
tag == DW_TAG_common_block)
19257 else if (attr2 !=
nullptr && attr2->
as_boolean ()
19279 case DW_TAG_formal_parameter:
19288 if (curr !=
nullptr && curr->
name !=
nullptr)
19291 if (attr !=
nullptr)
19296 if (attr !=
nullptr)
19304 case DW_TAG_unspecified_parameters:
19309 case DW_TAG_template_type_param:
19312 case DW_TAG_class_type:
19313 case DW_TAG_interface_type:
19314 case DW_TAG_structure_type:
19315 case DW_TAG_union_type:
19316 case DW_TAG_set_type:
19317 case DW_TAG_enumeration_type:
19318 case DW_TAG_namelist:
19319 if (die->
tag == DW_TAG_namelist)
19363 case DW_TAG_unspecified_type:
19367 case DW_TAG_typedef:
19368 case DW_TAG_array_type:
19369 case DW_TAG_base_type:
19370 case DW_TAG_subrange_type:
19371 case DW_TAG_generic_subrange:
19376 case DW_TAG_enumerator:
19378 if (attr !=
nullptr)
19393 case DW_TAG_imported_declaration:
19394 case DW_TAG_namespace:
19398 case DW_TAG_module:
19403 case DW_TAG_common_block:
19422 list_to_add = NULL;
19425 if (list_to_add != NULL)
19450 enum bfd_endian byte_order = bfd_big_endian (
objfile->
obfd.get ()) ?
19451 BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
19456 l &= ((LONGEST) 1 <<
bits) - 1;
19463 gdb_byte *bytes = (gdb_byte *) obstack_alloc (obstack,
bits / 8);
19479 const char *
name,
struct obstack *obstack,
19481 LONGEST *
value,
const gdb_byte **bytes,
19488 enum bfd_endian byte_order = (bfd_big_endian (
objfile->
obfd.get ()) ?
19489 BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE);
19495 switch (attr->
form)
19498 case DW_FORM_addrx:
19499 case DW_FORM_GNU_addr_index:
19511 (*baton)->per_objfile = per_objfile;
19512 (*baton)->per_cu = cu->
per_cu;
19513 gdb_assert ((*baton)->per_cu);
19515 (*baton)->size = 2 + cu_header->
addr_size;
19516 data = (gdb_byte *) obstack_alloc (obstack, (*baton)->size);
19517 (*baton)->data =
data;
19519 data[0] = DW_OP_addr;
19521 byte_order, (ULONGEST) attr->
as_address ());
19525 case DW_FORM_string:
19528 case DW_FORM_GNU_str_index:
19529 case DW_FORM_GNU_strp_alt:
19532 *bytes = (
const gdb_byte *) attr->
as_string ();
19534 case DW_FORM_block1:
19535 case DW_FORM_block2:
19536 case DW_FORM_block4:
19537 case DW_FORM_block:
19538 case DW_FORM_exprloc:
19539 case DW_FORM_data16:
19544 *bytes = blk->
data;
19552 case DW_FORM_data1:
19555 case DW_FORM_data2:
19558 case DW_FORM_data4:
19561 case DW_FORM_data8:
19565 case DW_FORM_sdata:
19566 case DW_FORM_implicit_const:
19570 case DW_FORM_udata:
19575 complaint (_(
"unsupported const value attribute form: '%s'"),
19591 const gdb_byte *bytes;
19597 &
value, &bytes, &baton);
19604 else if (bytes != NULL)
19618static struct type *
19650static struct type *
19655 type_attr =
dwarf2_attr (die, DW_AT_GNAT_descriptive_type, cu);
19671 if (descriptive_type)
19681static struct type *
19687 type_attr =
dwarf2_attr (die, DW_AT_containing_type, cu);
19689 error (_(
"Dwarf Error: Problem turning containing type into gdb type "
19697static struct type *
19704 std::string message
19705 = string_printf (_(
"<unknown type in %s, CU %s, DIE %s>"),
19720static struct type *
19726 struct type *this_type;
19728 gdb_assert (attr->
name == DW_AT_type
19729 || attr->
name == DW_AT_GNAT_descriptive_type
19730 || attr->
name == DW_AT_containing_type);
19734 if (attr->
form == DW_FORM_GNU_ref_alt)
19749 else if (attr->
form == DW_FORM_ref_sig8)
19757 complaint (_(
"Dwarf Error: Bad type attribute %s in DIE"
19758 " at %s [in module %s]"),
19766 if (this_type == NULL)
19773 if (type_die == NULL)
19783 if (this_type == NULL)
19797static struct type *
19800 struct type *this_type;
19812static struct type *
19815 struct type *this_type = NULL;
19819 case DW_TAG_class_type:
19820 case DW_TAG_interface_type:
19821 case DW_TAG_structure_type:
19822 case DW_TAG_union_type:
19825 case DW_TAG_enumeration_type:
19828 case DW_TAG_subprogram:
19829 case DW_TAG_subroutine_type:
19830 case DW_TAG_inlined_subroutine:
19833 case DW_TAG_array_type:
19836 case DW_TAG_set_type:
19839 case DW_TAG_pointer_type:
19842 case DW_TAG_ptr_to_member_type:
19845 case DW_TAG_reference_type:
19848 case DW_TAG_rvalue_reference_type:
19851 case DW_TAG_const_type:
19854 case DW_TAG_volatile_type:
19857 case DW_TAG_restrict_type:
19860 case DW_TAG_string_type:
19863 case DW_TAG_typedef:
19866 case DW_TAG_generic_subrange:
19867 case DW_TAG_subrange_type:
19870 case DW_TAG_base_type:
19873 case DW_TAG_unspecified_type:
19876 case DW_TAG_namespace:
19879 case DW_TAG_module:
19882 case DW_TAG_atomic_type:
19886 complaint (_(
"unexpected tag in read_type_die: '%s'"),
19912 if (spec_die != NULL)
19918 for (child = die->
child;
19922 if (child->
tag == DW_TAG_subprogram)
19926 if (linkage_name != NULL)
19928 gdb::unique_xmalloc_ptr<char> actual_name
19930 const char *
name = NULL;
19932 if (actual_name != NULL)
19936 if (die_name != NULL
19937 && strcmp (die_name, actual_name.get ()) != 0)
19941 int die_name_len = strlen (die_name);
19942 int actual_name_len = strlen (actual_name.get ());
19943 const char *ptr = actual_name.get ();
19946 if (actual_name_len > die_name_len + 2
19947 && ptr[actual_name_len - die_name_len - 1] ==
':')
19948 name = obstack_strndup (
19950 ptr, actual_name_len - die_name_len - 2);
19971 if (die->
tag != DW_TAG_class_type && die->
tag != DW_TAG_interface_type
19972 && die->
tag != DW_TAG_structure_type && die->
tag != DW_TAG_union_type)
19979 const char *attr_name = attr->
as_string ();
19980 if (attr == NULL || attr_name == NULL)
19987 base = strrchr (attr_name,
':');
19988 if (base == NULL || base == attr_name || base[-1] !=
':')
19994 &base[-1] - attr_name);
20018 struct type *parent_type;
20019 const char *retval;
20053 if (spec_die == NULL)
20057 parent = spec_die->
parent;
20061 if (parent == NULL)
20066 const char *parent_name;
20099 complaint (_(
"template param type '%s' defined within parent '%s'"),
20101 parent_name ? parent_name :
"<unknown>");
20105 switch (parent->
tag)
20107 case DW_TAG_namespace:
20113 && strcmp (parent_type->
name (),
"::") == 0)
20116 return parent_type->
name ();
20117 case DW_TAG_class_type:
20118 case DW_TAG_interface_type:
20119 case DW_TAG_structure_type:
20120 case DW_TAG_union_type:
20121 case DW_TAG_module:
20123 if (parent_type->
name () != NULL)
20124 return parent_type->
name ();
20130 case DW_TAG_compile_unit:
20131 case DW_TAG_partial_unit:
20135 && die->
child != NULL
20136 && (die->
tag == DW_TAG_class_type
20137 || die->
tag == DW_TAG_structure_type
20138 || die->
tag == DW_TAG_union_type))
20145 case DW_TAG_subprogram:
20150 if ((die->
tag == DW_TAG_subprogram)
20155 case DW_TAG_enumeration_type:
20159 if (parent_type->
name () != NULL)
20160 return parent_type->
name ();
20175#define MAX_SEP_LEN 7
20181 const char *lead =
"";
20184 if (suffix == NULL || suffix[0] ==
'\0'
20191 if (strcmp (suffix,
"D main") == 0)
20212 if (suffix == NULL)
20221 strcpy (retval, lead);
20222 strcat (retval,
prefix);
20223 strcat (retval, sep);
20224 strcat (retval, suffix);
20230 return obconcat (obs, lead,
prefix, sep, suffix, (
char *) NULL);
20245 if (die->
parent ==
nullptr)
20250 size_t nth_unnamed = 0;
20253 while (child != die)
20255 gdb_assert (child !=
nullptr);
20256 if (child->
tag == DW_TAG_template_type_param
20257 || child->
tag == DW_TAG_template_value_param)
20259 if (
dwarf2_attr (child, DW_AT_name, cu) ==
nullptr)
20265 const std::string name_str =
"<unnamed" + std::to_string (nth_unnamed) +
">";
20275 if (
name ==
nullptr)
20280 gdb::unique_xmalloc_ptr<char> canon_name
20283 if (canon_name !=
nullptr)
20288 gdb::unique_xmalloc_ptr<char> canon_name
20291 if (canon_name !=
nullptr)
20309 if (attr_name ==
nullptr
20310 && die->
tag != DW_TAG_namespace
20311 && die->
tag != DW_TAG_class_type
20312 && die->
tag != DW_TAG_interface_type
20313 && die->
tag != DW_TAG_structure_type
20314 && die->
tag != DW_TAG_namelist
20315 && die->
tag != DW_TAG_union_type
20316 && die->
tag != DW_TAG_template_type_param
20317 && die->
tag != DW_TAG_template_value_param)
20326 case DW_TAG_member:
20327 case DW_TAG_compile_unit:
20328 case DW_TAG_partial_unit:
20331 case DW_TAG_enumeration_type:
20332 case DW_TAG_enumerator:
20337 case DW_TAG_namespace:
20338 if (attr_name !=
nullptr)
20343 case DW_TAG_template_type_param:
20344 case DW_TAG_template_value_param:
20345 if (attr_name ==
nullptr)
20348 case DW_TAG_class_type:
20349 case DW_TAG_interface_type:
20350 case DW_TAG_structure_type:
20351 case DW_TAG_union_type:
20352 case DW_TAG_namelist:
20357 if (attr_name !=
nullptr
20358 && (startswith (attr_name,
"._")
20359 || startswith (attr_name,
"<anonymous")))
20364 if (!attr || attr_name == NULL)
20368 if (attr == NULL || attr_name == NULL)
20375 gdb::unique_xmalloc_ptr<char> demangled
20377 if (demangled ==
nullptr)
20387 const char *base = strrchr (attr_name,
':');
20388 if (base && base > attr_name && base[-1] ==
':')
20414 attr =
dwarf2_attr (die, DW_AT_extension, *ext_cu);
20426 slot = htab_find_slot_with_hash (cu->
die_hash, die,
20445 else if (
attr->
form == DW_FORM_ref_sig8)
20450 error (_(
"Dwarf Error: Expected reference attribute [in module %s]"),
20467 struct dwarf2_cu *target_cu, *cu = *ref_cu;
20470 gdb_assert (cu->
per_cu != NULL);
20475 "source CU contains target offset: %d",
20497 "target CU DIEs loaded: %d",
20499 per_objfile->
get_cu (per_cu) !=
nullptr);
20507 || per_objfile->
get_cu (per_cu) ==
nullptr)
20509 false, cu->
lang ());
20511 target_cu = per_objfile->
get_cu (per_cu);
20512 gdb_assert (target_cu !=
nullptr);
20514 else if (cu->
dies == NULL)
20521 *ref_cu = target_cu;
20548 (
attr->
form == DW_FORM_GNU_ref_alt
20552 error (_(
"Dwarf Error: Cannot find DIE at %s referenced from DIE "
20553 "at %s [in module %s]"),
20567 bool resolve_abstract_p)
20574 dwarf2_cu *cu = per_objfile->get_cu (per_cu);
20576 cu =
load_cu (per_cu, per_objfile,
false);
20582 error (_(
"Dwarf Error: Dummy CU at %s referenced in module %s"),
20588 error (_(
"Dwarf Error: Cannot find DIE at %s referenced in module %s"),
20592 if (!attr && resolve_abstract_p
20593 && (per_objfile->per_bfd->abstract_to_concrete.find (die->
sect_off)
20594 != per_objfile->per_bfd->abstract_to_concrete.end ()))
20598 for (
const auto &cand_off
20599 : per_objfile->per_bfd->abstract_to_concrete[die->
sect_off])
20606 || cand->
parent->
tag != DW_TAG_subprogram)
20609 unrelocated_addr unrel_low, unrel_high;
20611 if (unrel_low == ((unrelocated_addr) -1))
20613 CORE_ADDR pc_low = per_objfile->relocate (unrel_low);
20614 CORE_ADDR pc_high = per_objfile->relocate (unrel_high);
20615 if (!(pc_low <= pc && pc < pc_high))
20629 retval.
data = NULL;
20647 error (_(
"Dwarf Error: DIE at %s referenced in module %s "
20648 "is neither DW_FORM_block* nor DW_FORM_exprloc"),
20658 per_objfile->age_comp_units ();
20671 sect_offset sect_off =
per_cu->
sect_off + to_underlying (offset_in_cu);
20680static const gdb_byte *
20682 enum bfd_endian byte_order,
20690 result = (gdb_byte *) obstack_alloc (obstack, *len);
20707 const gdb_byte *result = NULL;
20710 enum bfd_endian byte_order;
20715 cu =
load_cu (per_cu, per_objfile,
false);
20721 error (_(
"Dwarf Error: Dummy CU at %s referenced in module %s"),
20727 error (_(
"Dwarf Error: Cannot find DIE at %s referenced in module %s"),
20734 byte_order = (bfd_big_endian (
objfile->
obfd.get ())
20735 ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE);
20737 switch (attr->
form)
20740 case DW_FORM_addrx:
20741 case DW_FORM_GNU_addr_index:
20746 tem = (gdb_byte *) obstack_alloc (obstack, *len);
20752 case DW_FORM_string:
20755 case DW_FORM_GNU_str_index:
20756 case DW_FORM_GNU_strp_alt:
20760 const char *attr_name = attr->
as_string ();
20761 result = (
const gdb_byte *) attr_name;
20762 *len = strlen (attr_name);
20765 case DW_FORM_block1:
20766 case DW_FORM_block2:
20767 case DW_FORM_block4:
20768 case DW_FORM_block:
20769 case DW_FORM_exprloc:
20770 case DW_FORM_data16:
20773 result =
block->data;
20774 *len =
block->size;
20783 case DW_FORM_data1:
20786 if (result == NULL)
20790 case DW_FORM_data2:
20793 if (result == NULL)
20797 case DW_FORM_data4:
20800 if (result == NULL)
20804 case DW_FORM_data8:
20807 if (result == NULL)
20812 case DW_FORM_sdata:
20813 case DW_FORM_implicit_const:
20819 case DW_FORM_udata:
20826 complaint (_(
"unsupported const value attribute form: '%s'"),
20840 const char **var_name)
20846 cu =
load_cu (per_cu, per_objfile,
false);
20855 if (var_name !=
nullptr)
20867 sect_offset die_offset_sect = per_cu->
sect_off + to_underlying (die_offset);
20897 || per_objfile->
get_cu (sig_type) ==
nullptr)
20900 sig_cu = per_objfile->
get_cu (sig_type);
20901 gdb_assert (sig_cu != NULL);
20904 die = (
struct die_info *) htab_find_with_hash (sig_cu->
die_hash, &temp_die,
20905 to_underlying (temp_die.
sect_off));
20913 (*ref_cu)->per_cu->imported_symtabs_push (sig_cu->
per_cu);
20937 gdb_assert (
attr->
form == DW_FORM_ref_sig8);
20942 if (sig_type == NULL)
20944 error (_(
"Dwarf Error: Cannot find signatured DIE %s referenced"
20945 " from DIE at %s [in module %s]"),
20954 error (_(
"Dwarf Error: Problem reading signatured DIE %s referenced"
20955 " from DIE at %s [in module %s]"),
20966static struct type *
20979 if (sig_type == NULL)
20981 complaint (_(
"Dwarf Error: Cannot find signatured DIE %s referenced"
20982 " from DIE at %s [in module %s]"),
20990 if (
type !=
nullptr)
20995 if (type_die != NULL)
21003 complaint (_(
"Dwarf Error: Cannot build signatured type %s"
21004 " referenced from DIE at %s [in module %s]"),
21012 complaint (_(
"Dwarf Error: Problem reading signatured DIE %s referenced"
21013 " from DIE at %s [in module %s]"),
21027static struct type *
21039 else if (
attr->
form == DW_FORM_ref_sig8)
21047 complaint (_(
"Dwarf Error: DW_AT_signature has bad form %s in DIE"
21048 " at %s [in module %s]"),
21068 gdb_assert (per_objfile->
get_cu (per_cu) ==
nullptr);
21072 gdb_assert (per_objfile->
get_cu (per_cu) !=
nullptr);
21084 gdb_assert (per_objfile->
get_cu (sig_type) ==
nullptr);
21086 cutu_reader reader (sig_type, per_objfile,
nullptr,
nullptr,
false);
21091 const gdb_byte *info_ptr = reader.
info_ptr;
21093 gdb_assert (cu->
die_hash == NULL);
21100 hashtab_obstack_allocate,
21101 dummy_obstack_deallocate);
21157 const gdb_byte *data = blk->
data;
21158 CORE_ADDR stack[64];
21160 unsigned int bytes_read;
21167 stack[++stacki] = 0;
21206 stack[++stacki] = op - DW_OP_lit0;
21217 case DW_OP_const1u:
21222 case DW_OP_const1s:
21227 case DW_OP_const2u:
21232 case DW_OP_const2s:
21237 case DW_OP_const4u:
21242 case DW_OP_const4s:
21247 case DW_OP_const8u:
21264 stack[stacki + 1] = stack[stacki];
21269 stack[stacki - 1] += stack[stacki];
21273 case DW_OP_plus_uconst:
21280 stack[stacki - 1] -= stack[stacki];
21294 case DW_OP_GNU_addr_index:
21295 case DW_OP_GNU_const_index:
21308 if (stacki >= ARRAY_SIZE (stack) - 1)
21310 complaint (_(
"location description stack overflow"));
21316 complaint (_(
"location description stack underflow"));
21321 *result = stack[stacki];
21342 int section_is_gnu)
21349 const char *section_name;
21353 if (section_is_gnu)
21356 section_name =
".debug_macro.dwo";
21361 section_name =
".debug_macinfo.dwo";
21366 if (section_is_gnu)
21369 section_name =
".debug_macro";
21374 section_name =
".debug_macinfo";
21379 if (
section->buffer ==
nullptr)
21381 complaint (_(
"missing %s section"), section_name);
21389 gdb::optional<ULONGEST> str_offsets_base;
21406 offset_size, offset, str_section, str_offsets_section,
21407 str_offsets_base, section_is_gnu, cu);
21433 error (_(
".debug_rnglists section cannot be used in DWARF %d"),
21443 && tag != DW_TAG_compile_unit
21444 && tag != DW_TAG_skeleton_unit)
21451 error (_(
".debug_rnglists section is missing from .dwo file."));
21470 gdb_assert (baton->
per_cu);
21503 complaint (_(
"Location list used without "
21504 "specifying the CU base address."));
21518 gdb_assert (baton->
per_cu);
21552 const gdb_byte *info_ptr
21601 (sect_offset sect_off,
21602 unsigned int offset_in_dwz,
21603 const std::vector<dwarf2_per_cu_data_up> &all_units)
21608 high = all_units.size () - 1;
21612 int mid = low + (high - low) / 2;
21614 mid_cu = all_units[mid].get ();
21615 if (mid_cu->
is_dwz > offset_in_dwz
21616 || (mid_cu->
is_dwz == offset_in_dwz
21622 gdb_assert (low == high);
21631 unsigned int offset_in_dwz,
21640 if (low == 0 || this_cu->
is_dwz != offset_in_dwz)
21641 error (_(
"Dwarf Error: could not find partial DIE containing "
21642 "offset %s [in module %s]"),
21663namespace find_containing_comp_unit {
21678 two->sect_off = sect_offset (one->length ());
21679 two->set_length (7);
21681 three->set_length (5);
21683 four->sect_off = sect_offset (three->length ());
21684 four->set_length (7);
21687 std::vector<dwarf2_per_cu_data_up> units;
21688 units.push_back (std::move (one));
21689 units.push_back (std::move (two));
21690 units.push_back (std::move (three));
21691 units.push_back (std::move (four));
21696 SELF_CHECK (units[result].
get () == one_ptr);
21698 SELF_CHECK (units[result].
get () == one_ptr);
21700 SELF_CHECK (units[result].
get () == two_ptr);
21703 SELF_CHECK (units[result].
get () == three_ptr);
21705 SELF_CHECK (units[result].
get () == three_ptr);
21707 SELF_CHECK (units[result].
get () == four_ptr);
21726 attr =
dwarf2_attr (comp_unit_die, DW_AT_language, cu);
21729 && strstr (cu->
producer,
"IBM XL C for OpenCL") != NULL)
21738 && strstr (cu->
producer,
"GNU Go ") != NULL)
21743 else if (attr !=
nullptr)
21746 lang = pretend_language;
21750 switch (comp_unit_die->
tag)
21752 case DW_TAG_compile_unit:
21755 case DW_TAG_partial_unit:
21758 case DW_TAG_type_unit:
21762 error (_(
"Dwarf Error: unexpected tag '%s' at offset %s"),
21779 return it->second.get ();
21786 std::unique_ptr<dwarf2_cu> cu)
21788 gdb_assert (this->
get_cu (per_cu) ==
nullptr);
21805 gdb_assert (!queue.has_value ());
21809 pair.second->clear_mark ();
21919static struct type *
21921 bool skip_data_location)
21937 &&
type->
code () != TYPE_CODE_FUNC
21939 &&
type->
code () != TYPE_CODE_METHODPTR
21940 &&
type->
code () != TYPE_CODE_MEMBERPTR
21941 &&
type->
code () != TYPE_CODE_METHOD
21942 &&
type->
code () != TYPE_CODE_FIXED_POINT
21974 if (!skip_data_location)
21976 attr =
dwarf2_attr (die, DW_AT_data_location, cu);
21983 = htab_up (htab_create_alloc (127,
21992 htab_find_slot (per_objfile->
die_type_hash.get (), &ofs, INSERT);
21994 complaint (_(
"A problem internal to GDB: DIE %s has type already set"),
22005static struct type *
22028static struct type *
22042 _(
"Whether to check \"physname\" is %s.\n"),
22052Set DWARF specific variables.\n\
22053Configure DWARF variables such as the cache size."),
22055Show DWARF specific variables.\n\
22056Show DWARF variables such as the cache size."),
22062Set the upper bound on the age of cached DWARF compilation units."), _(
"\
22063Show the upper bound on the age of cached DWARF compilation units."), _(
"\
22064A higher limit means that cached compilation units will be stored\n\
22065in memory longer, and more total memory will be used. Zero disables\n\
22066caching, which can slow down startup."),
22073Set debugging of the DWARF reader."), _(
"\
22074Show debugging of the DWARF reader."), _(
"\
22075When enabled (non-zero), debugging messages are printed during DWARF\n\
22076reading and symtab expansion. A value of 1 (one) provides basic\n\
22077information. A value greater than 1 provides more verbose information."),
22083Set debugging of the DWARF DIE reader."), _(
"\
22084Show debugging of the DWARF DIE reader."), _(
"\
22085When enabled (non-zero), DIEs are dumped after they are read in.\n\
22086The value is the maximum depth to print."),
22092Set debugging of the dwarf line reader."), _(
"\
22093Show debugging of the dwarf line reader."), _(
"\
22094When enabled (non-zero), line number entries are dumped as they are read in.\n\
22095A value of 1 (one) provides basic information.\n\
22096A value greater than 1 provides more verbose information."),
22102Set cross-checking of \"physname\" code against demangler."), _(
"\
22103Show cross-checking of \"physname\" code against demangler."), _(
"\
22104When enabled, GDB's internal \"physname\" code is checked against\n\
22124 selftests::register_test (
"dw2_expand_symtabs_matching",
22125 selftests::dw2_expand_symtabs_matching::run_test);
22126 selftests::register_test (
"dwarf2_find_containing_comp_unit",
22127 selftests::find_containing_comp_unit::run_test);
constexpr string_view get()
#define bits(obj, st, fn)
std::unique_ptr< struct abbrev_table > abbrev_table_up
const struct symbol_block_ops ada_function_alias_funcs
const struct symbol_computed_ops ada_imported_funcs
static struct @5 attributes[]
gdb_static_assert(sizeof(splay_tree_key) >=sizeof(CORE_ADDR *))
void * xcalloc(size_t number, size_t size)
bool operator==(const T &lhs, const T &rhs)
struct blockranges * make_blockranges(struct objfile *objfile, const std::vector< blockrange > &rangevec)
int blockvector_contains_pc(const struct blockvector *bv, CORE_ADDR pc)
const struct bfd_build_id * build_id_bfd_get(bfd *abfd)
struct pending ** get_file_symbols()
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)
@ CALL_SITE_PARAMETER_FB_OFFSET
@ CALL_SITE_PARAMETER_DWARF_REG
@ CALL_SITE_PARAMETER_PARAM_OFFSET
void add(abbrev_table_up table)
std::unique_ptr< cooked_index_shard > release()
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()
abbrev_cache m_abbrev_cache
std::unique_ptr< cooked_index_shard > m_index
cutu_reader * get_reader(dwarf2_per_cu_data *per_cu)
dwarf2_per_cu_data * lookup(CORE_ADDR addr)
void start_writing_index(dwarf2_per_bfd *per_bfd)
const cooked_index_entry * get_main() const
void dump(gdbarch *arch) const
quick_symbol_functions_up make_quick_functions() const override
range find(const std::string &name, bool completing) const
range all_entries() const
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()
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)
unsigned int m_discriminator
void handle_set_prologue_end()
unrelocated_addr m_last_address
lnp_state_machine(struct dwarf2_cu *cu, gdbarch *arch, line_header *lh)
bool m_line_has_non_zero_discriminator
unrelocated_addr m_address
void check_line_address(struct dwarf2_cu *cu, const gdb_byte *line_ptr, unrelocated_addr unrelocated_lowpc, unrelocated_addr address)
bool m_currently_recording_lines
void handle_set_address(unrelocated_addr address)
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
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 * 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)
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)
const struct builtin_f_type * builtin_f_type(struct gdbarch *gdbarch)
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_dwarf2_omit_typedef_p(struct gdbarch *gdbarch, struct type *target_type, const char *producer, const char *name)
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_set_type(type_allocator &alloc, struct type *domain_type)
struct type * make_restrict_type(struct type *type)
struct type * lookup_pointer_type(struct type *type)
struct type * init_character_type(type_allocator &alloc, int bit, int unsigned_p, const char *name)
struct type * init_integer_type(type_allocator &alloc, int bit, int unsigned_p, const char *name)
struct type * create_static_range_type(type_allocator &alloc, struct type *index_type, LONGEST low_bound, LONGEST high_bound)
struct type * lookup_methodptr_type(struct type *to_type)
bool set_type_align(struct type *type, ULONGEST align)
struct type * create_range_type(type_allocator &alloc, struct type *index_type, const struct dynamic_prop *low_bound, const struct dynamic_prop *high_bound, LONGEST bias)
struct type * init_fixed_point_type(type_allocator &alloc, int bit, int unsigned_p, const char *name)
struct type * init_decfloat_type(type_allocator &alloc, int bit, 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 * create_string_type(type_allocator &alloc, struct type *string_char_type, struct type *range_type)
struct type * create_range_type_with_stride(type_allocator &alloc, 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 * init_pointer_type(type_allocator &alloc, int bit, const char *name, struct type *target_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)
struct type * init_float_type(type_allocator &alloc, int bit, const char *name, const struct floatformat **floatformats, enum bfd_endian byte_order)
void smash_to_methodptr_type(struct type *type, struct type *to_type)
struct type * lookup_memberptr_type(struct type *type, struct type *domain)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
unsigned type_align(struct type *type)
struct type * init_complex_type(const char *name, struct type *target_type)
struct type * create_array_type_with_stride(type_allocator &alloc, struct type *element_type, struct type *range_type, struct dynamic_prop *byte_stride_prop, unsigned int bit_stride)
struct type * init_boolean_type(type_allocator &alloc, int bit, int unsigned_p, const char *name)
struct type * make_atomic_type(struct type *type)
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 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)
#define TYPE_FN_FIELDLIST_LENGTH(thistype, n)
#define TYPE_N_TEMPLATE_ARGUMENTS(thistype)
#define TYPE_VPTR_FIELDNO(thistype)
#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)
#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)
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
gdb::unique_xmalloc_ptr< char > go_symbol_package_name(const struct symbol *sym)
index_cache global_index_cache
const struct language_defn * language_def(enum language lang)
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(const dwarf2_loclist_baton *baton, size_t *locexpr_length, const 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, unsigned int decl_line, 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
bool dwarf2_read_debug_names(dwarf2_per_objfile *per_objfile)
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 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 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 bool is_ada_import_or_export(dwarf2_cu *cu, const char *name, const char *linkagename)
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 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)
static struct using_direct ** using_directives(struct dwarf2_cu *cu)
static void process_structure_scope(struct die_info *, struct dwarf2_cu *)
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_full_die_1(const struct die_reader_specs *, struct die_info **, const gdb_byte *, int, bool)
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 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)
static void process_full_comp_unit(dwarf2_cu *cu, enum language pretend_language)
static hashval_t hash_dwo_file(const void *item)
static bool check_ada_pragma_import(struct die_info *die, struct dwarf2_cu *cu)
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)
htab_up create_quick_file_names_table(unsigned int nr_initial_entries)
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 unsigned int read_decl_line(struct die_info *die, struct dwarf2_cu *cu)
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 unrelocated_addr read_addr_index_1(dwarf2_per_objfile *per_objfile, unsigned int addr_index, gdb::optional< ULONGEST > addr_base, int addr_size)
static void show_dwarf_max_cache_age(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
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)
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 ** 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 int line_header_eq_voidp(const void *item_lhs, const void *item_rhs)
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 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 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 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 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)
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 void dwarf2_record_block_ranges(struct die_info *, struct block *, struct dwarf2_cu *)
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)
bool dwarf2_has_info(struct objfile *objfile, const struct dwarf2_debug_sections *names, bool can_copy)
static int dwarf2_locexpr_block_index
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 void dwarf_finish_line(struct gdbarch *gdbarch, struct subfile *subfile, unrelocated_addr address, 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)
const char * read_indirect_string_at_offset(dwarf2_per_objfile *per_objfile, LONGEST str_offset)
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 struct type * dwarf2_init_float_type(struct dwarf2_cu *cu, int bits, const char *name, const char *name_hint, enum bfd_endian byte_order)
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 void get_scope_pc_bounds(struct die_info *, unrelocated_addr *, unrelocated_addr *, struct dwarf2_cu *)
static struct type_unit_group * get_type_unit_group(struct dwarf2_cu *cu, const struct attribute *stmt_list)
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 char * typename_concat(struct obstack *obs, const char *prefix, const char *suffix, int physname, struct dwarf2_cu *cu)
static int eq_dwo_file(const void *item_lhs, const void *item_rhs)
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)
void finalize_all_units(dwarf2_per_bfd *per_bfd)
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 *)
void dw_expand_symtabs_matching_file_matcher(dwarf2_per_objfile *per_objfile, gdb::function_view< expand_symtabs_file_matcher_ftype > file_matcher)
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)
bool read_addrmap_from_aranges(dwarf2_per_objfile *per_objfile, dwarf2_section_info *section, addrmap *mutable_map)
#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 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 struct type * dwarf2_init_integer_type(struct dwarf2_cu *cu, int bits, int unsigned_p, const char *name)
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 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 enum pc_bounds_kind dwarf2_get_pc_bounds(struct die_info *, unrelocated_addr *, unrelocated_addr *, struct dwarf2_cu *, addrmap *, void *)
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 int ada_block_index
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 const gdb_byte * read_attribute(const struct die_reader_specs *, struct attribute *, const struct attr_abbrev *, const gdb_byte *, bool allow_reprocess=true)
static unsigned int dwarf_read_debug
static int dwarf2_ranges_read(unsigned offset, unrelocated_addr *low_return, unrelocated_addr *high_return, struct dwarf2_cu *cu, addrmap *map, void *datum, dwarf_tag tag)
static void dwarf2_ranges_read_low_addrs(unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag, std::vector< unrelocated_addr > &result)
static const char * dwarf2_physname(const char *name, struct die_info *die, struct dwarf2_cu *cu)
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 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 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)
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 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 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)
unrelocated_addr dwarf2_read_addr_index(dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, unsigned int addr_index)
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 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 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, bool allow_reprocess)
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 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 void dwarf_record_line_1(struct gdbarch *gdbarch, struct subfile *subfile, unsigned int line, unrelocated_addr address, linetable_entry_flags flags, struct dwarf2_cu *cu)
static file_and_directory & find_file_and_directory(struct die_info *die, struct dwarf2_cu *cu)
static bool dwarf2_func_is_main_p(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 const gdb_byte * read_toplevel_die(const struct die_reader_specs *, struct die_info **, const gdb_byte *, gdb::array_view< attribute * >={})
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
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 const char * dwarf2_name(struct die_info *die, struct dwarf2_cu *)
struct cmd_list_element * show_dwarf_cmdlist
static int ada_imported_index
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 decode_locdesc(struct dwarf_block *, struct dwarf2_cu *, CORE_ADDR *addr)
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 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 void handle_DW_AT_stmt_list(struct die_info *die, struct dwarf2_cu *cu, const file_and_directory &fnd, unrelocated_addr lowpc, bool have_code)
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 int dwarf2_ranges_process(unsigned offset, struct dwarf2_cu *cu, dwarf_tag tag, Callback &&callback)
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 type * dwarf2_init_complex_target_type(struct dwarf2_cu *cu, int bits, const char *name_hint, enum bfd_endian byte_order)
static void read_attribute_reprocess(const struct die_reader_specs *reader, struct attribute *attr, dwarf_tag tag=DW_TAG_padding)
static struct dwarf_block * dwarf_alloc_block(struct dwarf2_cu *)
static int process_skeletonless_type_unit(void **slot, void *info)
htab_up allocate_signatured_type_table()
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 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 const char * read_stub_str_index(struct dwarf2_cu *cu, ULONGEST str_index)
static void dwarf_decode_lines_1(struct line_header *lh, struct dwarf2_cu *cu, unrelocated_addr lowpc)
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 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 unrelocated_addr read_addr_index_from_leb128(struct dwarf2_cu *, const gdb_byte *, unsigned int *)
static struct die_info * follow_die_sig_1(struct die_info *src_die, struct signatured_type *sig_type, struct dwarf2_cu **ref_cu)
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 void dwarf2_get_subprogram_pc_bounds(struct die_info *die, unrelocated_addr *lowpc, unrelocated_addr *highpc, struct dwarf2_cu *cu)
static const struct dwop_section_names dwop_section_names
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 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)
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 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 unrelocated_addr read_addr_index(struct dwarf2_cu *cu, unsigned int addr_index)
static void dwarf_decode_lines(struct line_header *, struct dwarf2_cu *, unrelocated_addr, int decode_mapping)
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)
std::unique_ptr< struct dwo_file > dwo_file_up
static void add_ada_export_symbol(struct symbol *orig, const char *new_name, const char *orig_name, struct dwarf2_cu *cu, struct pending **list_to_add)
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
dwarf2_per_objfile * get_dwarf2_per_objfile(struct objfile *objfile)
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)
gdb::unique_xmalloc_ptr< char > find_source_or_rewrite(const char *filename, const char *dirname)
static struct pending * common_block
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 set_empty(CORE_ADDR start, CORE_ADDR end_inclusive, void *obj) override
const void * find(CORE_ADDR addr) const
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
bool form_is_constant() const
__extension__ enum dwarf_attribute name
void set_string_noncanonical(const char *str)
ULONGEST as_nonnegative() const
const char * as_string() 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)
unrelocated_addr as_address() const
void set_address(unrelocated_addr addr)
ULONGEST as_signature() const
dwarf_virtuality_attribute as_virtuality() const
bool form_is_section_offset() const
const struct block * static_block() const
void set_scope(const char *scope, struct obstack *obstack)
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 compunit_symtab * end_compunit_symtab_from_static_block(struct block *static_block, int expandable)
struct block * finish_block(struct symbol *symbol, struct pending_block *old_blocks, const struct dynamic_prop *static_link, CORE_ADDR start, CORE_ADDR end)
void record_line(struct subfile *subfile, int line, unrelocated_addr pc, linetable_entry_flags flags)
struct compunit_symtab * end_expandable_symtab(CORE_ADDR end_addr)
bool outermost_context_p() const
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()
struct context_stack pop_context()
struct pending ** get_global_symbols()
struct subfile * get_current_subfile()
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_int
struct type * builtin_void
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[]
call_site(unrelocated_addr pc, dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile)
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]
unsigned int get_length_with_initial() const
unsigned int get_length_without_initial() const
cu_offset type_cu_offset_in_tu
cu_offset first_die_cu_offset
sect_offset abbrev_sect_off
bool offset_in_cu_p(sect_offset off) const
unsigned int initial_length_size
LONGEST read_offset(bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read) const
unrelocated_addr read_address(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
enum language lookup_global_symbol_language(struct objfile *objfile, const char *name, domain_enum domain, bool *symbol_found_p) 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
static die_info * allocate(struct obstack *obstack, int num_attrs)
unsigned char building_fullname
struct attribute attrs[1]
struct attribute * attr(dwarf_attribute name)
ULONGEST gnu_ranges_base()
static int eq(const void *item_lhs, const void *item_rhs)
unsigned char has_children
__extension__ enum dwarf_tag tag
struct die_info * sibling
static hashval_t hash(const void *item)
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
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
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< 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
gdb::optional< unrelocated_addr > base_address
auto_obstack comp_unit_obstack
struct comp_unit_head header
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)
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
struct dwarf2_per_cu_data * per_cu
dwarf2_per_objfile * per_objfile
struct dwarf2_per_cu_data * per_cu
unrelocated_addr base_address
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
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
packed< unsigned int, 1 > mark
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
packed< bool, 1 > m_header_read_in
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
packed< bool, 1 > files_read
unsigned int length() const
void set_unit_type(dwarf_unit_type unit_type)
const struct dwarf2_per_cu_data * per_cu
unrelocated_addr adjust(unrelocated_addr addr)
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
CORE_ADDR relocate(unrelocated_addr addr)
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)
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)
std::unique_ptr< type_unit_group_unshareable > type_unit_group_unshareable_up
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)
bfd_size_type virtual_offset
const char * get_name() const
asection * get_bfd_section() 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
union dwarf2_section_info::@54 s
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]
struct dwp_hash_table::@50::@52 v2
const gdb_byte * unit_table
const gdb_byte * hash_table
struct dwp_hash_table::@50::@53 v5
struct dwp_hash_table::@50::@51 v1
union dwp_hash_table::@50 section_pool
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
const dwarf2_property_baton * baton() const
void set_loclist(const dwarf2_property_baton *baton)
LONGEST const_val() const
void set_variable_name(const char *name)
void set_locexpr(const dwarf2_property_baton *baton)
void set_addr_offset(const dwarf2_property_baton *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_is_artificial(bool is_artificial)
void set_loc_dwarf_block(dwarf2_locexpr_baton *dwarf_block)
void set_loc_physname(const char *physname)
bool is_artificial() const
void set_bitsize(unsigned int bitsize)
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
unsigned int bitsize() 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
static gdb_mpz pow(unsigned long base, unsigned long exp)
bool set(const char *str, int base)
void set_section_index(short idx)
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)
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
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
auto_obstack storage_obstack
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
void set_line(unsigned int line)
address_class aclass() const
struct type * type() const
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 copy_fields(struct type *src)
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)
bool is_declared_class() const
bool has_no_signedness() const
void add_dyn_prop(dynamic_prop_node_kind kind, dynamic_prop prop)
void set_num_fields(unsigned int num_fields)
unsigned int num_fields() const
void set_name(const char *name)
struct fixed_point_type_info & fixed_point_info() const
void alloc_fields(unsigned int nfields, bool init=true)
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)
gdb::array_view< gdb_byte > contents_writeable()
static struct value * allocate(struct type *type)
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)
void fixup_symbol_section(struct symbol *sym, struct objfile *objfile)
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)
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
static char * sect_offset_str(sect_offset offset)
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 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 * value_from_longest(struct type *type, LONGEST num)
value_ref_ptr release_value(struct value *val)