42 #include "filenames.h"
65 #include "gdb/gdb-index.h"
74 #include <sys/types.h>
155 #define DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE(cu_index, value) \
157 gdb_assert ((unsigned int) (value) <= 1); \
158 GDB_INDEX_SYMBOL_STATIC_SET_VALUE((cu_index), (value)); \
162 #define DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE(cu_index, value) \
164 gdb_assert ((value) >= GDB_INDEX_SYMBOL_KIND_TYPE \
165 && (value) <= GDB_INDEX_SYMBOL_KIND_OTHER); \
166 GDB_INDEX_SYMBOL_KIND_SET_VALUE((cu_index), (value)); \
170 #define DW2_GDB_INDEX_CU_SET_VALUE(cu_index, value) \
172 gdb_assert (((value) & ~GDB_INDEX_CU_MASK) == 0); \
173 GDB_INDEX_CU_SET_VALUE((cu_index), (value)); \
217 struct dwarf2_per_objfile
235 struct objfile *objfile;
249 int n_allocated_type_units;
257 htab_t type_unit_groups;
261 htab_t signatured_types;
287 int has_section_at_zero;
291 unsigned char using_index;
303 htab_t quick_file_names_table;
307 int reading_partial_symbols;
312 htab_t die_type_hash;
315 VEC (dwarf2_per_cu_ptr) *just_read_cus;
330 {
".debug_info",
".zdebug_info" },
331 {
".debug_abbrev",
".zdebug_abbrev" },
332 {
".debug_line",
".zdebug_line" },
333 {
".debug_loc",
".zdebug_loc" },
334 {
".debug_macinfo",
".zdebug_macinfo" },
335 {
".debug_macro",
".zdebug_macro" },
336 {
".debug_str",
".zdebug_str" },
337 {
".debug_ranges",
".zdebug_ranges" },
338 {
".debug_types",
".zdebug_types" },
339 {
".debug_addr",
".zdebug_addr" },
340 {
".debug_frame",
".zdebug_frame" },
341 {
".eh_frame", NULL },
342 {
".gdb_index",
".zgdb_index" },
364 {
".debug_abbrev.dwo",
".zdebug_abbrev.dwo" },
365 {
".debug_info.dwo",
".zdebug_info.dwo" },
366 {
".debug_line.dwo",
".zdebug_line.dwo" },
367 {
".debug_loc.dwo",
".zdebug_loc.dwo" },
368 {
".debug_macinfo.dwo",
".zdebug_macinfo.dwo" },
369 {
".debug_macro.dwo",
".zdebug_macro.dwo" },
370 {
".debug_str.dwo",
".zdebug_str.dwo" },
371 {
".debug_str_offsets.dwo",
".zdebug_str_offsets.dwo" },
372 {
".debug_types.dwo",
".zdebug_types.dwo" },
373 {
".debug_cu_index",
".zdebug_cu_index" },
374 {
".debug_tu_index",
".zdebug_tu_index" },
504 htab_t call_site_htab;
535 unsigned int mark : 1;
541 unsigned int has_loclist : 1;
547 unsigned int checked_producer : 1;
556 unsigned int processing_has_namespace_info : 1;
651 VEC (dwarf2_per_cu_ptr) *imported_symtabs;
718 #define IS_TYPE_UNIT_GROUP(per_cu) ((per_cu)->section == NULL)
724 VEC (sig_type_ptr) *tus;
736 unsigned int num_symtabs;
931 #define MAX_NR_V2_DWO_SECTIONS \
1095 ENUM_BITFIELD(dwarf_tag)
tag : 16;
1098 unsigned int has_children : 1;
1183 ENUM_BITFIELD(dwarf_attribute) name : 16;
1184 ENUM_BITFIELD(dwarf_form)
form : 16;
1188 #define ABBREV_HASH_SIZE 121
1199 struct obstack abbrev_obstack;
1211 ENUM_BITFIELD(dwarf_attribute) name : 16;
1212 ENUM_BITFIELD(dwarf_form) form : 15;
1217 unsigned int string_is_canonical : 1;
1235 ENUM_BITFIELD(dwarf_tag) tag : 16;
1238 unsigned char num_attrs;
1242 unsigned char building_fullname : 1;
1245 unsigned char in_process : 1;
1248 unsigned int abbrev;
1269 #define DW_STRING(attr) ((attr)->u.str)
1270 #define DW_STRING_IS_CANONICAL(attr) ((attr)->string_is_canonical)
1271 #define DW_UNSND(attr) ((attr)->u.unsnd)
1272 #define DW_BLOCK(attr) ((attr)->u.blk)
1273 #define DW_SND(attr) ((attr)->u.snd)
1274 #define DW_ADDR(attr) ((attr)->u.addr)
1275 #define DW_SIGNATURE(attr) ((attr)->u.signature)
1286 #ifndef ATTR_ALLOC_CHUNK
1287 #define ATTR_ALLOC_CHUNK 4
1291 #ifndef DW_FIELD_ALLOC_CHUNK
1292 #define DW_FIELD_ALLOC_CHUNK 4
1385 "DWARF compilation units is %s.\n"),
1485 unsigned int *,
unsigned int *);
1545 const char *,
const char *,
1560 struct obstack *obstack,
1587 static char *
typename_concat (
struct obstack *obs,
const char *prefix,
1588 const char *suffix,
int physname,
1772 static int partial_die_eq (
const void *item_lhs,
const void *item_rhs);
1775 (
sect_offset offset,
unsigned int offset_in_dwz,
struct objfile *objfile);
1829 const char **name,
const char **comp_dir);
1832 const char *comp_dir);
1838 int is_debug_types_section);
1842 int use_existing_cu,
int keep,
1881 _(
"statement list doesn't fit in .debug_line section"));
1888 _(
".debug_line section has line data without a file"));
1895 _(
".debug_line section has line "
1896 "program sequence without an end"));
1910 _(
"const value length mismatch for '%s', got %d, expected %d"),
1918 _(
"debug info runs off end of %s section"
1928 _(
"macro debug info contains a "
1929 "malformed macro definition:\n`%s'"),
1937 _(
"invalid attribute class or form for '%s' in '%s'"),
1976 byte_swap (offset_type
value)
1980 result = (value & 0xff) << 24;
1981 result |= (value & 0xff00) << 8;
1982 result |= (value & 0xff0000) >> 8;
1983 result |= (value & 0xff000000) >> 24;
1987 #define MAYBE_SWAP(V) byte_swap (V)
1990 #define MAYBE_SWAP(V) (V)
2001 if (attr->
form != DW_FORM_addr && attr->
form != DW_FORM_GNU_addr_index)
2024 #define INDEX_SUFFIX ".gdb-index"
2035 dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
2036 if (!dwarf2_per_objfile)
2039 struct dwarf2_per_objfile *data
2042 memset (data, 0,
sizeof (*data));
2043 set_objfile_data (objfile, dwarf2_objfile_data_key, data);
2044 dwarf2_per_objfile = data;
2048 dwarf2_per_objfile->objfile = objfile;
2110 return bfd_get_filename (abfd);
2135 return bfd_get_section_flags (sectp->owner, sectp);
2145 if (names->
normal != NULL
2146 && strcmp (section_name, names->
normal) == 0)
2149 && strcmp (section_name, names->
compressed) == 0)
2162 flagword aflag = bfd_get_section_flags (abfd, sectp);
2169 if ((aflag & SEC_HAS_CONTENTS) == 0)
2175 dwarf2_per_objfile->
info.
size = bfd_get_section_size (sectp);
2180 dwarf2_per_objfile->
abbrev.
size = bfd_get_section_size (sectp);
2185 dwarf2_per_objfile->
line.
size = bfd_get_section_size (sectp);
2190 dwarf2_per_objfile->
loc.
size = bfd_get_section_size (sectp);
2195 dwarf2_per_objfile->
macinfo.
size = bfd_get_section_size (sectp);
2200 dwarf2_per_objfile->
macro.
size = bfd_get_section_size (sectp);
2205 dwarf2_per_objfile->
str.
size = bfd_get_section_size (sectp);
2210 dwarf2_per_objfile->
addr.
size = bfd_get_section_size (sectp);
2215 dwarf2_per_objfile->
frame.
size = bfd_get_section_size (sectp);
2220 dwarf2_per_objfile->
eh_frame.
size = bfd_get_section_size (sectp);
2225 dwarf2_per_objfile->
ranges.
size = bfd_get_section_size (sectp);
2231 memset (&type_section, 0,
sizeof (type_section));
2233 type_section.
size = bfd_get_section_size (sectp);
2241 dwarf2_per_objfile->
gdb_index.
size = bfd_get_section_size (sectp);
2244 if ((bfd_get_section_flags (abfd, sectp) & SEC_LOAD)
2245 && bfd_section_vma (abfd, sectp) == 0)
2246 dwarf2_per_objfile->has_section_at_zero = 1;
2256 return section->
size == 0;
2290 if ((sectp->flags & SEC_RELOC) != 0)
2292 error (
_(
"Dwarf Error: DWP format V2 with relocations is not"
2293 " supported in section %s [in module %s]"),
2300 <= containing_section->
size);
2310 if ((sectp->flags & SEC_RELOC) == 0)
2333 if (bfd_seek (abfd, sectp->filepos,
SEEK_SET) != 0
2334 || bfd_bread (buf, info->
size, abfd) != info->
size)
2336 error (
_(
"Dwarf Error: Can't read DWARF data"
2337 " in section %s [in module %s]"),
2338 bfd_section_name (abfd, sectp), bfd_get_filename (abfd));
2349 static bfd_size_type
2365 bfd_size_type *sizep)
2367 struct dwarf2_per_objfile *data
2368 = objfile_data (objfile, dwarf2_objfile_data_key);
2383 info = &data->
frame;
2396 *sizep = info->
size;
2411 dwz_file->
abbrev.
size = bfd_get_section_size (sectp);
2416 dwz_file->
info.
size = bfd_get_section_size (sectp);
2421 dwz_file->
str.
size = bfd_get_section_size (sectp);
2426 dwz_file->
line.
size = bfd_get_section_size (sectp);
2431 dwz_file->
macro.
size = bfd_get_section_size (sectp);
2450 const char *filename;
2452 bfd_size_type buildid_len_arg;
2456 if (dwarf2_per_objfile->dwz_file != NULL)
2457 return dwarf2_per_objfile->dwz_file;
2459 bfd_set_error (bfd_error_no_error);
2460 data = bfd_get_alt_debug_link_info (dwarf2_per_objfile->objfile->obfd,
2461 &buildid_len_arg, &buildid);
2464 if (bfd_get_error () == bfd_error_no_error)
2466 error (
_(
"could not read '.gnu_debugaltlink' section: %s"),
2467 bfd_errmsg (bfd_get_error ()));
2472 buildid_len = (size_t) buildid_len_arg;
2474 filename = (
const char *) data;
2475 if (!IS_ABSOLUTE_PATH (filename))
2484 rel = concat (abs,
SLASH_STRING, filename, (
char *) NULL);
2492 if (dwz_bfd != NULL)
2501 if (dwz_bfd == NULL)
2504 if (dwz_bfd == NULL)
2505 error (
_(
"could not find '.gnu_debugaltlink' file for %s"),
2508 result =
OBSTACK_ZALLOC (&dwarf2_per_objfile->objfile->objfile_obstack,
2517 dwarf2_per_objfile->dwz_file = result;
2561 unsigned int mark : 1;
2565 unsigned int no_file_data : 1;
2575 if (stmt_list_hash->
dwo_unit != NULL)
2641 return htab_create_alloc (nr_initial_entries,
2677 if (dwarf2_per_objfile->using_index
2688 && per_cu->
cu->dwo_unit != NULL
2689 && dwarf2_per_objfile->index_table != NULL
2690 && dwarf2_per_objfile->index_table->version <= 7
2712 gdb_assert (dwarf2_per_objfile->using_index);
2741 if (index >= dwarf2_per_objfile->n_comp_units)
2743 index -= dwarf2_per_objfile->n_comp_units;
2744 gdb_assert (index < dwarf2_per_objfile->n_type_units);
2745 return &dwarf2_per_objfile->all_type_units[index]->per_cu;
2748 return dwarf2_per_objfile->all_comp_units[index];
2758 gdb_assert (index >= 0 && index < dwarf2_per_objfile->n_comp_units);
2760 return dwarf2_per_objfile->all_comp_units[index];
2768 const gdb_byte *cu_list, offset_type n_elements,
2775 for (i = 0; i < n_elements; i += 2)
2794 dwarf2_per_objfile->all_comp_units[base_offset + i / 2] = the_cu;
2803 const gdb_byte *cu_list, offset_type cu_list_elements,
2804 const gdb_byte *dwz_list, offset_type dwz_elements)
2808 dwarf2_per_objfile->n_comp_units = (cu_list_elements + dwz_elements) / 2;
2809 dwarf2_per_objfile->all_comp_units
2811 dwarf2_per_objfile->n_comp_units
2815 &dwarf2_per_objfile->
info, 0, 0);
2817 if (dwz_elements == 0)
2822 cu_list_elements / 2);
2831 offset_type elements)
2834 htab_t sig_types_hash;
2836 dwarf2_per_objfile->n_type_units
2837 = dwarf2_per_objfile->n_allocated_type_units
2839 dwarf2_per_objfile->all_type_units
2840 =
xmalloc (dwarf2_per_objfile->n_type_units
2845 for (i = 0; i < elements; i += 3)
2870 slot = htab_find_slot (sig_types_hash, sig_type, INSERT);
2873 dwarf2_per_objfile->all_type_units[i / 3] = sig_type;
2876 dwarf2_per_objfile->signatured_types = sig_types_hash;
2887 struct obstack temp_obstack;
2892 obstack_init (&temp_obstack);
2914 _(
".gdb_index address table has invalid range (%s - %s)"),
2919 if (cu_index >= dwarf2_per_objfile->n_comp_units)
2922 _(
".gdb_index address table has invalid CU number %u"),
2923 (
unsigned) cu_index);
2948 const unsigned char *str = (
const unsigned char *) p;
2952 while ((c = *str++) != 0)
2954 if (index_version >= 5)
2956 r = r * 67 + c - 113;
2968 offset_type **vec_out)
2972 offset_type slot, step;
2973 int (*cmp) (
const char *,
const char *);
2982 if (strchr (name,
'(') != NULL)
2986 if (without_params != NULL)
2989 name = without_params;
3009 offset_type i = 2 * slot;
3018 if (!cmp (name, str))
3043 const char *filename,
3048 offset_type *cu_list_elements,
3050 offset_type *types_list_elements)
3054 offset_type *metadata;
3069 version =
MAYBE_SWAP (*(offset_type *) addr);
3076 static int warning_printed = 0;
3077 if (!warning_printed)
3079 warning (
_(
"Skipping obsolete .gdb_index section in %s."),
3081 warning_printed = 1;
3093 if (version < 6 && !deprecated_ok)
3095 static int warning_printed = 0;
3096 if (!warning_printed)
3099 Skipping deprecated .gdb_index section in %s.\n\
3100 Do \"set use-deprecated-index-sections on\" before the file is read\n\
3101 to use the section anyway."),
3103 warning_printed = 1;
3123 metadata = (offset_type *) (addr +
sizeof (offset_type));
3131 *types_list = addr +
MAYBE_SWAP (metadata[i]);
3132 *types_list_elements = ((
MAYBE_SWAP (metadata[i + 1])
3142 map->
symbol_table = (offset_type *) (addr + MAYBE_SWAP (metadata[i]));
3145 / (2 *
sizeof (offset_type)));
3148 map->
constant_pool = (
char *) (addr + MAYBE_SWAP (metadata[i]));
3161 const gdb_byte *cu_list, *types_list, *dwz_list = NULL;
3162 offset_type cu_list_elements, types_list_elements, dwz_list_elements = 0;
3166 use_deprecated_index_sections,
3167 &dwarf2_per_objfile->
gdb_index, &local_map,
3168 &cu_list, &cu_list_elements,
3169 &types_list, &types_list_elements))
3183 offset_type dwz_types_elements_ignore;
3188 &dwz_list, &dwz_list_elements,
3190 &dwz_types_elements_ignore))
3192 warning (
_(
"could not read '.gdb_index' section from %s; skipping"),
3193 bfd_get_filename (dwz->
dwz_bfd));
3201 if (types_list_elements)
3211 dwarf2_per_objfile->types, 0);
3214 types_list_elements);
3222 dwarf2_per_objfile->index_table = map;
3223 dwarf2_per_objfile->using_index = 1;
3224 dwarf2_per_objfile->quick_file_names_table =
3236 dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
3251 struct objfile *objfile = dwarf2_per_objfile->objfile;
3256 const char *
name, *comp_dir;
3265 if (comp_unit_die->
tag == DW_TAG_partial_unit)
3276 attr =
dwarf2_attr (comp_unit_die, DW_AT_stmt_list, cu);
3287 slot = htab_find_slot (dwarf2_per_objfile->quick_file_names_table,
3288 &find_entry, INSERT);
3371 index = dwarf2_per_objfile->n_comp_units - 1;
3404 htab_traverse_noresize (dwarf2_per_objfile->quick_file_names_table,
3414 const char *name,
const char *real_path,
3415 int (*callback) (
struct symtab *,
void *),
3436 const char *real_path,
3437 int (*callback) (
struct symtab *,
void *),
3441 const char *name_basename = lbasename (name);
3448 for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
3459 if (file_data == NULL)
3464 const char *this_name = file_data->
file_names[j];
3465 const char *this_real_name;
3478 && FILENAME_CMP (lbasename (this_name), name_basename) != 0)
3490 if (real_path != NULL)
3494 if (this_real_name != NULL
3495 && FILENAME_CMP (real_path, this_real_name) == 0)
3543 int want_specific_block,
3548 iter->
index = index;
3571 offset_type cu_index_and_attrs =
3573 offset_type cu_index = GDB_INDEX_CU_VALUE (cu_index_and_attrs);
3577 int is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (cu_index_and_attrs);
3579 GDB_INDEX_SYMBOL_KIND_VALUE (cu_index_and_attrs);
3586 && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
3589 if (cu_index >= (dwarf2_per_objfile->n_comp_units
3590 + dwarf2_per_objfile->n_type_units))
3593 _(
".gdb_index entry has bad CU index"
3609 && want_static != is_static)
3624 if (symbol_kind != GDB_INDEX_SYMBOL_KIND_VARIABLE
3625 && symbol_kind != GDB_INDEX_SYMBOL_KIND_FUNCTION
3627 && symbol_kind != GDB_INDEX_SYMBOL_KIND_TYPE)
3631 if (symbol_kind != GDB_INDEX_SYMBOL_KIND_TYPE)
3635 if (symbol_kind != GDB_INDEX_SYMBOL_KIND_OTHER)
3659 index = dwarf2_per_objfile->index_table;
3671 struct symbol *sym, *with_opaque = NULL;
3687 if (with_opaque != NULL
3701 int i, total, count;
3704 total = dwarf2_per_objfile->n_comp_units + dwarf2_per_objfile->n_type_units;
3706 for (i = 0; i < total; ++i)
3726 gdb_assert (dwarf2_per_objfile->using_index);
3728 if (dwarf2_per_objfile->index_table != NULL)
3731 dwarf2_per_objfile->index_table->version);
3748 const char *func_name)
3754 index = dwarf2_per_objfile->index_table;
3778 for (i = 0; i < (dwarf2_per_objfile->n_comp_units
3779 + dwarf2_per_objfile->n_type_units); ++i)
3789 const char *fullname)
3800 for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
3811 if (file_data == NULL)
3816 const char *this_fullname = file_data->
file_names[j];
3818 if (filename_cmp (this_fullname, fullname) == 0)
3831 int (*callback) (
struct block *,
3832 struct symbol *,
void *),
3843 (
struct objfile *objfile,
3857 if (!dwarf2_per_objfile->index_table)
3859 index = dwarf2_per_objfile->index_table;
3861 if (file_matcher != NULL)
3864 htab_t visited_found, visited_not_found;
3866 visited_found = htab_create_alloc (10,
3867 htab_hash_pointer, htab_eq_pointer,
3870 visited_not_found = htab_create_alloc (10,
3871 htab_hash_pointer, htab_eq_pointer,
3878 for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
3894 if (file_data == NULL)
3897 if (htab_find (visited_not_found, file_data) != NULL)
3899 else if (htab_find (visited_found, file_data) != NULL)
3907 const char *this_real_name;
3909 if (file_matcher (file_data->
file_names[j], data, 0))
3918 && !file_matcher (lbasename (file_data->
file_names[j]),
3923 if (file_matcher (this_real_name, data, 0))
3932 : visited_not_found,
3942 offset_type idx = 2 * iter;
3944 offset_type *vec, vec_len, vec_idx;
3945 int global_seen = 0;
3954 if (! (*symbol_matcher) (name, data))
3962 for (vec_idx = 0; vec_idx < vec_len; ++vec_idx)
3965 offset_type cu_index_and_attrs =
MAYBE_SWAP (vec[vec_idx + 1]);
3967 int is_static = GDB_INDEX_SYMBOL_STATIC_VALUE (cu_index_and_attrs);
3969 GDB_INDEX_SYMBOL_KIND_VALUE (cu_index_and_attrs);
3970 int cu_index = GDB_INDEX_CU_VALUE (cu_index_and_attrs);
3977 && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
3982 if (!is_static && global_seen)
3994 if (symbol_kind != GDB_INDEX_SYMBOL_KIND_VARIABLE)
3998 if (symbol_kind != GDB_INDEX_SYMBOL_KIND_FUNCTION)
4002 if (symbol_kind != GDB_INDEX_SYMBOL_KIND_TYPE)
4011 if (cu_index >= (dwarf2_per_objfile->n_comp_units
4012 + dwarf2_per_objfile->n_type_units))
4015 _(
".gdb_index entry has bad CU index"
4021 if (file_matcher == NULL || per_cu->
v.
quick->
mark)
4023 int symtab_was_null =
4028 if (expansion_notify != NULL
4056 for (i = 0; cust->
includes[i]; ++i)
4088 warning (
_(
"(Internal error: pc %s in read in CU, but not in symtab.)"),
4100 void *data,
int need_fullname)
4104 htab_t visited = htab_create_alloc (10, htab_hash_pointer, htab_eq_pointer,
4114 for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
4127 for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
4139 if (file_data == NULL)
4142 slot = htab_find_slot (visited, file_data, INSERT);
4152 const char *this_real_name;
4157 this_real_name = NULL;
4158 (*fun) (file_data->
file_names[j], this_real_name, data);
4204 dwarf2_per_objfile->using_index = 1;
4207 dwarf2_per_objfile->quick_file_names_table =
4210 for (i = 0; i < (dwarf2_per_objfile->n_comp_units
4211 + dwarf2_per_objfile->n_type_units); ++i)
4317 const gdb_byte *info_ptr, bfd *abfd)
4320 unsigned int bytes_read;
4324 cu_header->
offset_size = (bytes_read == 4) ? 4 : 8;
4325 info_ptr += bytes_read;
4330 info_ptr += bytes_read;
4333 signed_addr = bfd_get_sign_extend_vma (abfd);
4334 if (signed_addr < 0)
4336 _(
"read_comp_unit_head: dwarf from non elf file"));
4353 abbrev = &dwarf2_per_objfile->
abbrev;
4371 error (
_(
"Dwarf Error: wrong version in compilation unit header "
4372 "(is %d, should be 2, 3, or 4) [in module %s]"), header->
version,
4377 error (
_(
"Dwarf Error: bad offset (0x%lx) in compilation unit header "
4378 "(offset 0x%lx + 6) [in module %s]"),
4386 error (
_(
"Dwarf Error: bad length (0x%lx) in compilation unit header "
4387 "(offset 0x%lx + 0) [in module %s]"),
4401 int is_debug_types_section)
4403 const gdb_byte *beg_of_comp_unit = info_ptr;
4412 if (is_debug_types_section)
4433 const gdb_byte *beg_of_comp_unit = info_ptr;
4442 if (signature != NULL)
4445 if (type_offset_in_tu != NULL)
4465 unsigned int length, initial_length_size, offset_size;
4471 offset_size = initial_length_size == 4 ? 4 : 8;
4472 info_ptr += initial_length_size + 2 ;
4474 return abbrev_offset;
4482 struct objfile *objfile)
4486 if (!IS_ABSOLUTE_PATH (subpst->
filename))
4562 return htab_create_alloc_ex (41,
4598 struct objfile *objfile = dwarf2_per_objfile->objfile;
4599 htab_t types_htab = NULL;
4607 abbrev_section = (dwo_file != NULL
4609 : &dwarf2_per_objfile->
abbrev);
4611 if (dwarf_read_debug)
4613 dwo_file ?
".dwo" :
"",
4621 const gdb_byte *info_ptr, *end_ptr;
4624 info_ptr = section->
buffer;
4626 if (info_ptr == NULL)
4637 end_ptr = info_ptr + section->
size;
4638 while (info_ptr < end_ptr)
4656 abbrev_section, ptr,
4657 &signature, &type_offset_in_tu);
4662 if (ptr >= info_ptr + length
4669 if (types_htab == NULL)
4705 slot = htab_find_slot (types_htab,
4706 dwo_file ? (
void*) dwo_tu : (
void *) sig_type,
4715 const struct dwo_unit *dup_tu = *slot;
4717 dup_offset = dup_tu->
offset;
4727 _(
"debug type entry at offset 0x%x is duplicate to"
4728 " the entry at offset 0x%x, signature %s"),
4732 *slot = dwo_file ? (
void *) dwo_tu : (
void *) sig_type;
4734 if (dwarf_read_debug > 1)
4758 if (types_htab == NULL)
4760 dwarf2_per_objfile->signatured_types = NULL;
4764 dwarf2_per_objfile->signatured_types = types_htab;
4766 dwarf2_per_objfile->n_type_units
4767 = dwarf2_per_objfile->n_allocated_type_units
4768 = htab_elements (types_htab);
4769 dwarf2_per_objfile->all_type_units
4770 =
xmalloc (dwarf2_per_objfile->n_type_units
4772 iter = &dwarf2_per_objfile->all_type_units[0];
4774 gdb_assert (iter - &dwarf2_per_objfile->all_type_units[0]
4775 == dwarf2_per_objfile->n_type_units);
4787 struct objfile *objfile = dwarf2_per_objfile->objfile;
4788 int n_type_units = dwarf2_per_objfile->n_type_units;
4791 gdb_assert (n_type_units <= dwarf2_per_objfile->n_allocated_type_units);
4793 if (n_type_units > dwarf2_per_objfile->n_allocated_type_units)
4795 if (dwarf2_per_objfile->n_allocated_type_units == 0)
4796 dwarf2_per_objfile->n_allocated_type_units = 1;
4797 dwarf2_per_objfile->n_allocated_type_units *= 2;
4798 dwarf2_per_objfile->all_type_units
4799 =
xrealloc (dwarf2_per_objfile->all_type_units,
4800 dwarf2_per_objfile->n_allocated_type_units
4802 ++dwarf2_per_objfile->tu_stats.nr_all_type_units_reallocs;
4804 dwarf2_per_objfile->n_type_units = n_type_units;
4808 dwarf2_per_objfile->all_type_units[n_type_units - 1] = sig_type;
4811 if (dwarf2_per_objfile->using_index)
4820 slot = htab_find_slot (dwarf2_per_objfile->signatured_types,
4840 if (dwarf2_per_objfile->using_index)
4876 struct objfile *objfile = dwarf2_per_objfile->objfile;
4877 struct dwo_file *dwo_file;
4878 struct dwo_unit find_dwo_entry, *dwo_entry;
4882 gdb_assert (cu->dwo_unit && dwarf2_per_objfile->using_index);
4886 if (dwarf2_per_objfile->signatured_types == NULL)
4888 dwarf2_per_objfile->signatured_types
4899 slot = htab_find_slot (dwarf2_per_objfile->signatured_types,
4900 &find_sig_entry, INSERT);
4917 dwo_file = cu->dwo_unit->dwo_file;
4920 if (dwo_file->
tus == NULL)
4923 dwo_entry = htab_find (dwo_file->
tus, &find_dwo_entry);
4924 if (dwo_entry == NULL)
4928 if (sig_entry == NULL)
4944 struct objfile *objfile = dwarf2_per_objfile->objfile;
4950 gdb_assert (cu->dwo_unit && dwarf2_per_objfile->using_index);
4955 if (dwarf2_per_objfile->signatured_types == NULL)
4957 dwarf2_per_objfile->signatured_types
4962 slot = htab_find_slot (dwarf2_per_objfile->signatured_types,
4963 &find_sig_entry, INSERT);
4969 if (sig_entry != NULL)
4972 if (dwp_file->
tus == NULL)
4976 if (dwo_entry == NULL)
4993 && dwarf2_per_objfile->using_index)
5006 if (dwarf2_per_objfile->signatured_types == NULL)
5009 entry = htab_find (dwarf2_per_objfile->signatured_types, &find_entry);
5022 struct dwo_file *dwo_file)
5054 int abbrev_table_provided,
5055 struct die_info *stub_comp_unit_die,
5056 const char *stub_comp_dir,
5059 struct die_info **result_comp_unit_die,
5060 int *result_has_children)
5062 struct objfile *objfile = dwarf2_per_objfile->objfile;
5066 const gdb_byte *begin_info_ptr, *info_ptr;
5068 struct attribute *comp_dir, *stmt_list, *low_pc, *high_pc, *ranges;
5069 int i,num_extra_attrs;
5075 gdb_assert ((stub_comp_unit_die != NULL) + (stub_comp_dir != NULL) <= 1);
5091 if (stub_comp_unit_die != NULL)
5096 stmt_list =
dwarf2_attr (stub_comp_unit_die, DW_AT_stmt_list, cu);
5097 low_pc =
dwarf2_attr (stub_comp_unit_die, DW_AT_low_pc, cu);
5098 high_pc =
dwarf2_attr (stub_comp_unit_die, DW_AT_high_pc, cu);
5099 ranges =
dwarf2_attr (stub_comp_unit_die, DW_AT_ranges, cu);
5100 comp_dir =
dwarf2_attr (stub_comp_unit_die, DW_AT_comp_dir, cu);
5105 attr =
dwarf2_attr (stub_comp_unit_die, DW_AT_GNU_addr_base, cu);
5111 cu->ranges_base = 0;
5112 attr =
dwarf2_attr (stub_comp_unit_die, DW_AT_GNU_ranges_base, cu);
5116 else if (stub_comp_dir != NULL)
5121 comp_dir->
name = DW_AT_comp_dir;
5122 comp_dir->
form = DW_FORM_string;
5128 cu->dwo_unit = dwo_unit;
5146 &type_offset_in_tu);
5148 if (sig_type->
signature != header_signature)
5150 error (
_(
"Dwarf Error: signature mismatch %s vs %s while reading"
5151 " TU at offset 0x%x [in module %s]"),
5155 bfd_get_filename (abfd));
5181 if (abbrev_table_provided)
5200 num_extra_attrs = ((stmt_list != NULL)
5204 + (comp_dir != NULL));
5205 info_ptr =
read_full_die_1 (result_reader, result_comp_unit_die, info_ptr,
5206 result_has_children, num_extra_attrs);
5209 comp_unit_die = *result_comp_unit_die;
5211 if (stmt_list != NULL)
5212 comp_unit_die->
attrs[i++] = *stmt_list;
5214 comp_unit_die->
attrs[i++] = *low_pc;
5215 if (high_pc != NULL)
5216 comp_unit_die->
attrs[i++] = *high_pc;
5218 comp_unit_die->
attrs[i++] = *ranges;
5219 if (comp_dir != NULL)
5220 comp_unit_die->
attrs[i++] = *comp_dir;
5221 comp_unit_die->
num_attrs += num_extra_attrs;
5223 if (dwarf_die_debug)
5226 "Read die from %s@0x%x of %s:\n",
5228 (
unsigned) (begin_info_ptr - section->
buffer),
5229 bfd_get_filename (abfd));
5230 dump_die (comp_unit_die, dwarf_die_debug);
5237 if (comp_dir != NULL)
5241 if (info_ptr >= begin_info_ptr + dwo_unit->
length
5245 *result_info_ptr = info_ptr;
5261 const char *comp_dir, *dwo_name;
5266 attr =
dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_name, cu);
5270 attr =
dwarf2_attr (comp_unit_die, DW_AT_comp_dir, cu);
5288 attr =
dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_id, cu);
5290 error (
_(
"Dwarf Error: missing dwo_id for dwo_name %s"
5312 int use_existing_cu,
int keep,
5318 struct cleanup *cleanups, *free_cu_cleanup = NULL;
5332 if (use_existing_cu && this_cu->
cu != NULL)
5358 &comp_unit_die, &has_children) == 0)
5366 die_reader_func (&reader, info_ptr, comp_unit_die, has_children, data);
5372 if (free_cu_cleanup != NULL)
5386 dwarf2_per_objfile->read_in_chain = this_cu;
5414 int use_existing_cu,
int keep,
5418 struct objfile *objfile = dwarf2_per_objfile->objfile;
5422 const gdb_byte *begin_info_ptr, *info_ptr;
5427 struct cleanup *cleanups, *free_cu_cleanup = NULL;
5433 int rereading_dwo_cu = 0;
5435 if (dwarf_die_debug)
5440 if (use_existing_cu)
5451 die_reader_func, data);
5464 if (use_existing_cu && this_cu->
cu != NULL)
5473 if (cu->dwo_unit != NULL)
5474 rereading_dwo_cu = 1;
5500 abbrev_section, info_ptr,
5502 &type_offset_in_tu);
5509 == type_offset_in_tu.
cu_off);
5532 if (info_ptr >= begin_info_ptr + this_cu->
length
5544 if (abbrev_table != NULL)
5556 else if (rereading_dwo_cu)
5564 info_ptr =
read_full_die (&reader, &comp_unit_die, info_ptr, &has_children);
5570 attr =
dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_name, cu);
5574 struct die_info *dwo_comp_unit_die;
5579 _(
"compilation unit with DW_AT_GNU_dwo_name"
5580 " has children (offset 0x%x) [in module %s]"),
5584 if (dwo_unit != NULL)
5587 abbrev_table != NULL,
5588 comp_unit_die, NULL,
5590 &dwo_comp_unit_die, &has_children) == 0)
5596 comp_unit_die = dwo_comp_unit_die;
5609 die_reader_func (&reader, info_ptr, comp_unit_die, has_children, data);
5612 if (free_cu_cleanup != NULL)
5626 dwarf2_per_objfile->read_in_chain = this_cu;
5653 struct dwo_file *dwo_file,
5657 struct objfile *objfile = dwarf2_per_objfile->objfile;
5662 const gdb_byte *begin_info_ptr, *info_ptr;
5668 if (dwarf_die_debug)
5675 abbrev_section = (dwo_file != NULL
5688 abbrev_section, info_ptr,
5694 if (info_ptr >= begin_info_ptr + this_cu->
length
5705 info_ptr =
read_full_die (&reader, &comp_unit_die, info_ptr, &has_children);
5707 die_reader_func (&reader, info_ptr, comp_unit_die, has_children, data);
5759 return htab_create_alloc_ex (3,
5763 &dwarf2_per_objfile->objfile->objfile_obstack,
5771 #define NO_STMT_LIST_TYPE_UNIT_PSYMTAB (1 << 31)
5772 #define NO_STMT_LIST_TYPE_UNIT_PSYMTAB_SIZE 10
5780 struct objfile *objfile = dwarf2_per_objfile->objfile;
5786 per_cu = &tu_group->
per_cu;
5789 if (dwarf2_per_objfile->using_index)
5803 (line_offset & ~NO_STMT_LIST_TYPE_UNIT_PSYMTAB));
5805 name =
xstrprintf (
"<type_units_at_0x%x>", line_offset);
5813 tu_group->hash.dwo_unit = cu->dwo_unit;
5814 tu_group->hash.line_offset = line_offset_struct;
5831 if (dwarf2_per_objfile->type_unit_groups == NULL)
5833 dwarf2_per_objfile->type_unit_groups =
5841 line_offset =
DW_UNSND (stmt_list);
5857 type_unit_group_for_lookup.hash.dwo_unit = cu->dwo_unit;
5858 type_unit_group_for_lookup.hash.line_offset.sect_off = line_offset;
5859 slot = htab_find_slot (dwarf2_per_objfile->type_unit_groups,
5860 &type_unit_group_for_lookup, INSERT);
5870 line_offset_struct.
sect_off = line_offset;
5889 struct objfile *objfile = per_cu->
objfile;
5931 struct objfile *objfile = cu->
objfile;
5936 CORE_ADDR best_lowpc = 0, best_highpc = 0;
5952 attr =
dwarf2_attr (comp_unit_die, DW_AT_name, cu);
5961 attr =
dwarf2_attr (comp_unit_die, DW_AT_comp_dir, cu);
5972 &best_highpc, cu, pst);
5973 if (has_pc_info == 1 && best_lowpc < best_highpc)
5978 best_lowpc + baseaddr),
5980 best_highpc + baseaddr) - 1,
6031 len * sizeof (
struct symtab *));
6045 if (dwarf_read_debug)
6050 "Psymtab for %s unit @0x%x: %s - %s"
6051 ", %d global, %d static syms\n",
6065 int want_partial_unit,
6075 if (this_cu->
cu != NULL)
6098 struct objfile *objfile = dwarf2_per_objfile->objfile;
6154 unsigned int boff = (*b)->abbrev_offset.sect_off;
6156 return (aoff > boff) - (aoff < boff);
6180 struct objfile *objfile = dwarf2_per_objfile->objfile;
6190 gdb_assert (dwarf2_per_objfile->type_unit_groups == NULL);
6192 if (dwarf2_per_objfile->n_type_units == 0)
6214 if (dwarf_read_debug)
6220 dwarf2_per_objfile->n_type_units);
6221 for (i = 0; i < dwarf2_per_objfile->n_type_units; ++i)
6223 struct signatured_type *sig_type = dwarf2_per_objfile->all_type_units[i];
6225 sorted_by_abbrev[i].
sig_type = sig_type;
6231 qsort (sorted_by_abbrev, dwarf2_per_objfile->n_type_units,
6234 abbrev_offset.
sect_off = ~(unsigned) 0;
6235 abbrev_table = NULL;
6238 for (i = 0; i < dwarf2_per_objfile->n_type_units; ++i)
6243 if (abbrev_table == NULL
6246 if (abbrev_table != NULL)
6251 abbrev_table = NULL;
6276 dwarf2_per_objfile->n_type_units);
6294 struct objfile *objfile = dwarf2_per_objfile->objfile;
6307 len * sizeof (
struct psymtab *));
6309 VEC_iterate (sig_type_ptr, tu_group->tus, i, iter);
6317 VEC_free (sig_type_ptr, tu_group->tus);
6341 struct objfile *objfile = info;
6346 if (dwarf2_per_objfile->signatured_types == NULL)
6348 dwarf2_per_objfile->signatured_types
6353 slot = htab_find_slot (dwarf2_per_objfile->signatured_types, &find_entry,
6378 struct dwo_file *dwo_file = (
struct dwo_file *) *slot;
6380 if (dwo_file->
tus != NULL)
6382 htab_traverse_noresize (dwo_file->
tus,
6398 && dwarf2_per_objfile->dwo_files != NULL)
6400 htab_traverse_noresize (dwarf2_per_objfile->dwo_files,
6411 struct objfile *objfile = o;
6423 for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
6447 struct cleanup *back_to, *addrmap_cleanup;
6448 struct obstack temp_obstack;
6451 if (dwarf_read_debug)
6457 dwarf2_per_objfile->reading_partial_symbols = 1;
6471 obstack_init (&temp_obstack);
6476 for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
6487 if (dwarf2_per_objfile->type_unit_groups != NULL)
6489 htab_traverse_noresize (dwarf2_per_objfile->type_unit_groups,
6493 if (dwarf_read_debug)
6504 if (dwarf_read_debug)
6542 unsigned int is_dwz,
6550 if (dwarf_read_debug)
6557 info_ptr = section->
buffer;
6559 while (info_ptr < section->
buffer + section->
size)
6561 unsigned int length, initial_length_size;
6574 memset (this_cu, 0,
sizeof (*this_cu));
6576 this_cu->
length = length + initial_length_size;
6581 if (*n_comp_units == *n_allocated)
6584 *all_comp_units =
xrealloc (*all_comp_units,
6588 (*all_comp_units)[*n_comp_units] = this_cu;
6591 info_ptr = info_ptr + this_cu->
length;
6608 all_comp_units =
xmalloc (n_allocated
6612 &n_allocated, &n_comp_units, &all_comp_units);
6617 &n_allocated, &n_comp_units,
6620 dwarf2_per_objfile->all_comp_units
6623 memcpy (dwarf2_per_objfile->all_comp_units, all_comp_units,
6625 xfree (all_comp_units);
6626 dwarf2_per_objfile->n_comp_units = n_comp_units;
6656 if (pdi->
name != NULL || pdi->
tag == DW_TAG_namespace
6657 || pdi->
tag == DW_TAG_module || pdi->
tag == DW_TAG_enumeration_type
6658 || pdi->
tag == DW_TAG_imported_unit)
6662 case DW_TAG_subprogram:
6665 case DW_TAG_constant:
6666 case DW_TAG_variable:
6667 case DW_TAG_typedef:
6668 case DW_TAG_union_type:
6674 case DW_TAG_class_type:
6675 case DW_TAG_interface_type:
6676 case DW_TAG_structure_type:
6682 case DW_TAG_enumeration_type:
6686 case DW_TAG_base_type:
6687 case DW_TAG_subrange_type:
6692 case DW_TAG_namespace:
6698 case DW_TAG_imported_unit:
6705 error (
_(
"Dwarf Error: DW_TAG_imported_unit is not"
6706 " supported in type units [in module %s]"),
6719 cu->
per_cu->imported_symtabs, per_cu);
6722 case DW_TAG_imported_declaration:
6764 const char *grandparent_scope;
6780 return parent->
scope;
6790 && parent->
tag == DW_TAG_namespace
6791 && strcmp (parent->
name,
"::") == 0
6792 && grandparent_scope == NULL)
6794 parent->
scope = NULL;
6799 if (pdi->
tag == DW_TAG_enumerator)
6801 parent->
scope = grandparent_scope;
6802 else if (parent->
tag == DW_TAG_namespace
6803 || parent->
tag == DW_TAG_module
6804 || parent->
tag == DW_TAG_structure_type
6805 || parent->
tag == DW_TAG_class_type
6806 || parent->
tag == DW_TAG_interface_type
6807 || parent->
tag == DW_TAG_union_type
6808 || parent->
tag == DW_TAG_enumeration_type)
6810 if (grandparent_scope == NULL)
6815 parent->
name, 0, cu);
6823 _(
"unhandled containing DIE tag %d for DIE at %d"),
6825 parent->
scope = grandparent_scope;
6829 return parent->
scope;
6839 const char *parent_scope;
6849 if (pdi->
name != NULL && strchr (pdi->
name,
'<') == NULL)
6857 attr.
form = DW_FORM_ref_addr;
6866 if (parent_scope == NULL)
6875 struct objfile *objfile = cu->
objfile;
6878 const char *actual_name = NULL;
6880 char *built_actual_name;
6885 if (built_actual_name != NULL)
6886 actual_name = built_actual_name;
6888 if (actual_name == NULL)
6889 actual_name = pdi->
name;
6893 case DW_TAG_subprogram:
6904 built_actual_name != NULL,
6914 built_actual_name != NULL,
6920 case DW_TAG_constant:
6930 list, 0, 0, cu->
language, objfile);
6933 case DW_TAG_variable:
6939 && !dwarf2_per_objfile->has_section_at_zero)
6963 built_actual_name != NULL,
6971 int has_loc = pdi->
d.
locdesc != NULL;
6977 xfree (built_actual_name);
6984 built_actual_name != NULL,
6988 has_loc ? addr + baseaddr : (
CORE_ADDR) 0,
6992 case DW_TAG_typedef:
6993 case DW_TAG_base_type:
6994 case DW_TAG_subrange_type:
6996 built_actual_name != NULL,
7001 case DW_TAG_imported_declaration:
7002 case DW_TAG_namespace:
7004 built_actual_name != NULL,
7011 built_actual_name != NULL,
7016 case DW_TAG_class_type:
7017 case DW_TAG_interface_type:
7018 case DW_TAG_structure_type:
7019 case DW_TAG_union_type:
7020 case DW_TAG_enumeration_type:
7028 xfree (built_actual_name);
7035 built_actual_name != NULL,
7044 case DW_TAG_enumerator:
7046 built_actual_name != NULL,
7058 xfree (built_actual_name);
7113 if (pdi->
tag == DW_TAG_subprogram)
7117 if (pdi->
lowpc < *lowpc)
7118 *lowpc = pdi->
lowpc;
7119 if (pdi->
highpc > *highpc)
7123 struct objfile *objfile = cu->
objfile;
7132 pdi->
lowpc + baseaddr);
7160 if (pdi->
tag == DW_TAG_subprogram
7161 || pdi->
tag == DW_TAG_lexical_block)
7176 if (enum_pdi->
name != NULL)
7182 if (pdi->
tag != DW_TAG_enumerator || pdi->
name == NULL)
7195 unsigned int bytes_read;
7210 unsigned int abbrev_number;
7215 if (abbrev_number == 0)
7221 error (
_(
"Dwarf Error: Could not find abbrev number %d in %s"
7222 " at offset 0x%x [in module %s]"),
7239 unsigned int bytes_read;
7245 return info_ptr + bytes_read;
7247 info_ptr =
skip_one_die (reader, info_ptr + bytes_read, abbrev);
7261 unsigned int bytes_read;
7263 bfd *abfd = reader->
abfd;
7267 const gdb_byte *start_info_ptr = info_ptr;
7268 unsigned int form, i;
7273 if (abbrev->
attrs[i].
name == DW_AT_sibling)
7276 if (attr.
form == DW_FORM_ref_addr)
7278 _(
"ignoring absolute DW_AT_sibling"));
7282 const gdb_byte *sibling_ptr = buffer + off;
7284 if (sibling_ptr < info_ptr)
7286 _(
"DW_AT_sibling points backwards"));
7299 case DW_FORM_ref_addr:
7307 case DW_FORM_GNU_ref_alt:
7318 case DW_FORM_flag_present:
7330 case DW_FORM_ref_sig8:
7333 case DW_FORM_string:
7335 info_ptr += bytes_read;
7337 case DW_FORM_sec_offset:
7339 case DW_FORM_GNU_strp_alt:
7342 case DW_FORM_exprloc:
7345 info_ptr += bytes_read;
7347 case DW_FORM_block1:
7350 case DW_FORM_block2:
7353 case DW_FORM_block4:
7358 case DW_FORM_ref_udata:
7359 case DW_FORM_GNU_addr_index:
7360 case DW_FORM_GNU_str_index:
7363 case DW_FORM_indirect:
7365 info_ptr += bytes_read;
7368 goto skip_attribute;
7371 error (
_(
"Dwarf Error: Cannot handle %s "
7372 "in DWARF reader [in module %s]"),
7374 bfd_get_filename (abfd));
7412 struct objfile *objfile)
7416 warning (
_(
"bug: psymtab for %s is already read in."),
7429 dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
7437 struct dwarf2_per_objfile *dpo_backlink
7439 dwarf2_objfile_data_key);
7441 dwarf2_per_objfile->has_section_at_zero
7442 = dpo_backlink->has_section_at_zero;
7445 dwarf2_per_objfile->reading_partial_symbols = 0;
7468 item =
xmalloc (
sizeof (*item));
7473 if (dwarf2_queue == NULL)
7474 dwarf2_queue = item;
7476 dwarf2_queue_tail->
next = item;
7478 dwarf2_queue_tail = item;
7498 if (dwarf2_per_objfile->reading_partial_symbols)
7500 if (per_cu->
cu == NULL || per_cu->
cu->
dies == NULL)
7507 if (dependent_cu != NULL)
7516 if (per_cu->
cu != NULL)
7535 if (dwarf_read_debug)
7538 "Expanding one or more symtabs of objfile %s ...\n",
7544 for (item = dwarf2_queue; item != NULL; dwarf2_queue = item = next_item)
7546 if (dwarf2_per_objfile->using_index
7551 unsigned int debug_print_threshold;
7559 sprintf (buf,
"TU %s at offset 0x%x",
7564 debug_print_threshold = 2;
7569 debug_print_threshold = 1;
7572 if (dwarf_read_debug >= debug_print_threshold)
7580 if (dwarf_read_debug >= debug_print_threshold)
7585 next_item = item->
next;
7589 dwarf2_queue_tail = NULL;
7591 if (dwarf_read_debug)
7624 dwarf2_queue = dwarf2_queue_tail = NULL;
7685 die_eq (
const void *item_lhs,
const void *item_rhs)
7687 const struct die_info *die_lhs = item_lhs;
7688 const struct die_info *die_rhs = item_rhs;
7705 enum language *language_ptr = data;
7719 &info_ptr, comp_unit_die);
7720 cu->
dies = comp_unit_die;
7748 const char *name,
struct die_info *die,
7766 if (cu->method_list != NULL)
7769 cu->method_list = NULL;
7786 const char *physname;
7791 = physname ? physname :
"";
7809 char *package_name = NULL;
7815 for (i = 0; i < list->
nsyms; ++i)
7824 if (this_package_name == NULL)
7826 if (package_name == NULL)
7827 package_name = this_package_name;
7830 if (strcmp (package_name, this_package_name) != 0)
7832 _(
"Symtab %s has objects from two different Go packages: %s and %s"),
7837 this_package_name, package_name);
7838 xfree (this_package_name);
7844 if (package_name != NULL)
7846 struct objfile *objfile = cu->
objfile;
7847 const char *saved_package_name
7850 strlen (package_name));
7852 saved_package_name, objfile);
7860 strlen (saved_package_name), 0, objfile);
7869 xfree (package_name);
7879 return (dwarf2_per_objfile->using_index
7889 htab_t all_children, htab_t all_type_symtabs,
7898 slot = htab_find_slot (all_children, per_cu, INSERT);
7914 slot = htab_find_slot (all_type_symtabs, cust, INSERT);
7919 if (cust->
user == NULL)
7920 cust->
user = immediate_parent;
7926 if (cust->
user == NULL)
7927 cust->
user = immediate_parent;
7932 VEC_iterate (dwarf2_per_cu_ptr, per_cu->imported_symtabs, ix, iter);
7936 all_type_symtabs, iter, cust);
7948 if (!
VEC_empty (dwarf2_per_cu_ptr, per_cu->imported_symtabs))
7954 htab_t all_children, all_type_symtabs;
7961 all_children = htab_create_alloc (1, htab_hash_pointer, htab_eq_pointer,
7963 all_type_symtabs = htab_create_alloc (1, htab_hash_pointer, htab_eq_pointer,
7967 VEC_iterate (dwarf2_per_cu_ptr, per_cu->imported_symtabs,
7972 all_type_symtabs, per_cu_iter,
7979 = obstack_alloc (&dwarf2_per_objfile->objfile->objfile_obstack,
7980 (len + 1) * sizeof (
struct symtab *));
7983 compunit_symtab_iter);
7985 cust->
includes[ix] = compunit_symtab_iter;
7989 htab_delete (all_children);
7990 htab_delete (all_type_symtabs);
8004 VEC_iterate (dwarf2_per_cu_ptr, dwarf2_per_objfile->just_read_cus,
8012 VEC_free (dwarf2_per_cu_ptr, dwarf2_per_objfile->just_read_cus);
8023 struct objfile *objfile = per_cu->
objfile;
8027 struct cleanup *back_to, *delayed_list_cleanup;
8029 struct block *static_block;
8097 if (cu->has_loclist && gcc_4_minor >= 5)
8100 if (gcc_4_minor >= 5)
8106 if (dwarf2_per_objfile->using_index)
8116 VEC_safe_push (dwarf2_per_cu_ptr, dwarf2_per_objfile->just_read_cus, per_cu);
8129 struct objfile *objfile = per_cu->
objfile;
8131 struct cleanup *back_to, *delayed_list_cleanup;
8185 if (dwarf2_per_objfile->using_index)
8207 error (
_(
"Dwarf Error: DW_TAG_imported_unit is not"
8208 " supported in type units [in module %s]"),
8216 struct symtab *imported_symtab;
8258 case DW_TAG_padding:
8260 case DW_TAG_compile_unit:
8261 case DW_TAG_partial_unit:
8264 case DW_TAG_type_unit:
8267 case DW_TAG_subprogram:
8268 case DW_TAG_inlined_subroutine:
8271 case DW_TAG_lexical_block:
8272 case DW_TAG_try_block:
8273 case DW_TAG_catch_block:
8276 case DW_TAG_GNU_call_site:
8279 case DW_TAG_class_type:
8280 case DW_TAG_interface_type:
8281 case DW_TAG_structure_type:
8282 case DW_TAG_union_type:
8285 case DW_TAG_enumeration_type:
8292 case DW_TAG_subroutine_type:
8293 case DW_TAG_set_type:
8294 case DW_TAG_array_type:
8295 case DW_TAG_pointer_type:
8296 case DW_TAG_ptr_to_member_type:
8297 case DW_TAG_reference_type:
8298 case DW_TAG_string_type:
8301 case DW_TAG_base_type:
8302 case DW_TAG_subrange_type:
8303 case DW_TAG_typedef:
8308 case DW_TAG_common_block:
8311 case DW_TAG_common_inclusion:
8313 case DW_TAG_namespace:
8314 cu->processing_has_namespace_info = 1;
8318 cu->processing_has_namespace_info = 1;
8321 case DW_TAG_imported_declaration:
8322 cu->processing_has_namespace_info = 1;
8326 case DW_TAG_imported_module:
8327 cu->processing_has_namespace_info = 1;
8328 if (die->
child != NULL && (die->
tag == DW_TAG_imported_declaration
8335 case DW_TAG_imported_unit:
8360 case DW_TAG_namespace:
8361 case DW_TAG_typedef:
8362 case DW_TAG_class_type:
8363 case DW_TAG_interface_type:
8364 case DW_TAG_structure_type:
8365 case DW_TAG_union_type:
8366 case DW_TAG_enumeration_type:
8367 case DW_TAG_enumerator:
8368 case DW_TAG_subprogram:
8369 case DW_TAG_inlined_subroutine:
8371 case DW_TAG_imported_declaration:
8374 case DW_TAG_variable:
8375 case DW_TAG_constant:
8390 if (attr == NULL && die->
parent->
tag != DW_TAG_namespace
8396 if (die->
parent->
tag == DW_TAG_lexical_block
8398 || die->
parent->
tag == DW_TAG_catch_block
8399 || die->
parent->
tag == DW_TAG_subprogram)
8413 char *last_char_p = (
char *)
object;
8416 *last_char_p = buffer[length - 1];
8439 struct objfile *objfile = cu->
objfile;
8458 attr =
dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
8473 char *intermediate_name;
8474 const char *canonical_name = NULL;
8478 if (*prefix !=
'\0')
8484 xfree (prefixed_name);
8518 for (child = die->
child; child != NULL; child = child->
sibling)
8526 if (child->
tag != DW_TAG_template_type_param
8527 && child->
tag != DW_TAG_template_value_param)
8542 _(
"template parameter missing DW_AT_type"));
8548 if (child->
tag == DW_TAG_template_type_param)
8554 attr =
dwarf2_attr (child, DW_AT_const_value, cu);
8558 _(
"template parameter missing "
8559 "DW_AT_const_value"));
8566 &value, &bytes, &baton);
8581 else if (bytes != NULL)
8606 char last_char =
'\0';
8608 if (last_char ==
'>')
8618 if (physname && die->
tag == DW_TAG_subprogram
8631 if (die->
tag == DW_TAG_subprogram)
8662 if (canonical_name == NULL || canonical_name == intermediate_name)
8665 strlen (intermediate_name));
8667 name = canonical_name;
8669 xfree (intermediate_name);
8700 struct objfile *objfile = cu->
objfile;
8702 const char *retval, *mangled = NULL, *canon = NULL;
8715 attr =
dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
8744 (DMGL_PARAMS | DMGL_ANSI
8746 ? DMGL_JAVA | DMGL_RET_POSTFIX
8761 if (canon == NULL || check_physname)
8765 if (canon != NULL && strcmp (physname, canon) != 0)
8772 _(
"Computed physname <%s> does not match demangled <%s> "
8773 "(from linkage <%s>) - DIE at 0x%x [in module %s]"),
8794 retval, strlen (retval));
8821 #define MAX_NESTED_IMPORTED_DECLARATIONS 100
8829 if (d->
tag != DW_TAG_imported_declaration)
8833 if (num == MAX_NESTED_IMPORTED_DECLARATIONS)
8836 _(
"DIE at 0x%x has too many recursively imported "
8865 struct objfile *objfile = cu->
objfile;
8867 struct die_info *imported_die, *child_die;
8869 const char *imported_name;
8870 const char *imported_name_prefix;
8871 const char *canonical_name;
8872 const char *import_alias;
8873 const char *imported_declaration = NULL;
8874 const char *import_prefix;
8878 import_attr =
dwarf2_attr (die, DW_AT_import, cu);
8879 if (import_attr == NULL)
8888 imported_name =
dwarf2_name (imported_die, imported_cu);
8889 if (imported_name == NULL)
8936 if (imported_die->
tag != DW_TAG_namespace
8937 && imported_die->
tag != DW_TAG_module)
8939 imported_declaration = imported_name;
8940 canonical_name = imported_name_prefix;
8942 else if (strlen (imported_name_prefix) > 0)
8944 imported_name_prefix,
"::", imported_name,
8947 canonical_name = imported_name;
8952 for (child_die = die->
child; child_die && child_die->
tag;
8960 if (child_die->
tag != DW_TAG_imported_declaration)
8963 _(
"child DW_TAG_imported_declaration expected "
8964 "- DIE at 0x%x [in module %s]"),
8969 import_attr =
dwarf2_attr (child_die, DW_AT_import, cu);
8970 if (import_attr == NULL)
8980 imported_name =
dwarf2_name (imported_die, imported_cu);
8981 if (imported_name == NULL)
8984 _(
"child DW_TAG_imported_declaration has unknown "
8985 "imported name - DIE at 0x%x [in module %s]"),
8998 imported_declaration,
9024 if (!cu->checked_producer)
9027 return cu->producer_is_gcc_lt_4_3;
9032 const char **name,
const char **comp_dir)
9051 && IS_ABSOLUTE_PATH (*name))
9059 if (*comp_dir != NULL)
9063 char *cp = strchr (*comp_dir,
':');
9065 if (cp && cp != *comp_dir && cp[-1] ==
'.' && cp[1] ==
'/')
9070 *name =
"<unknown>";
9082 struct objfile *objfile = dwarf2_per_objfile->objfile;
9086 hashval_t line_header_local_hash;
9105 if (dwarf2_per_objfile->line_header_hash == NULL
9106 && die->
tag == DW_TAG_partial_unit)
9108 dwarf2_per_objfile->line_header_hash
9120 if (dwarf2_per_objfile->line_header_hash != NULL)
9122 slot = htab_find_slot_with_hash (dwarf2_per_objfile->line_header_hash,
9124 line_header_local_hash, NO_INSERT);
9129 if (die->
tag == DW_TAG_partial_unit && slot != NULL)
9143 if (dwarf2_per_objfile->line_header_hash == NULL)
9147 slot = htab_find_slot_with_hash (dwarf2_per_objfile->line_header_hash,
9149 line_header_local_hash, INSERT);
9152 if (slot != NULL && *slot == NULL)
9168 decode_mapping = (die->
tag != DW_TAG_partial_unit);
9178 struct objfile *objfile = dwarf2_per_objfile->objfile;
9184 const char *name = NULL;
9185 const char *comp_dir = NULL;
9187 bfd *abfd = objfile->
obfd;
9222 if (die->
child != NULL)
9224 child_die = die->
child;
9225 while (child_die && child_die->
tag)
9241 _(
"CU refers to both DW_AT_GNU_macros and DW_AT_macro_info"));
9250 unsigned int macro_offset =
DW_UNSND (attr);
9268 struct objfile *objfile = dwarf2_per_objfile->objfile;
9292 first_time = tu_group->compunit_symtab == NULL;
9326 const char *dir = NULL;
9344 tu_group->symtabs[i] = fe->
symtab;
9355 fe->
symtab = tu_group->symtabs[i];
9383 if (die->
child != NULL)
9385 child_die = die->
child;
9386 while (child_die && child_die->
tag)
9406 const struct dwo_file *dwo_file = item;
9409 hash = htab_hash_string (dwo_file->
dwo_name);
9411 hash += htab_hash_string (dwo_file->
comp_dir);
9418 const struct dwo_file *lhs = item_lhs;
9419 const struct dwo_file *rhs = item_rhs;
9433 struct objfile *objfile = dwarf2_per_objfile->objfile;
9435 return htab_create_alloc_ex (41,
9449 struct dwo_file find_entry;
9452 if (dwarf2_per_objfile->dwo_files == NULL)
9455 memset (&find_entry, 0,
sizeof (find_entry));
9458 slot = htab_find_slot (dwarf2_per_objfile->dwo_files, &find_entry, INSERT);
9475 const struct dwo_unit *lhs = item_lhs;
9476 const struct dwo_unit *rhs = item_rhs;
9493 return htab_create_alloc_ex (3,
9520 struct objfile *objfile = dwarf2_per_objfile->objfile;
9524 struct dwo_file *dwo_file = data->
dwo_file;
9528 attr =
dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_id, cu);
9532 _(
"Dwarf Error: debug entry at offset 0x%x is missing"
9533 " its dwo_id [in module %s]"),
9544 if (dwarf_read_debug)
9555 struct objfile *objfile = dwarf2_per_objfile->objfile;
9559 const gdb_byte *info_ptr, *end_ptr;
9564 info_ptr = section->
buffer;
9566 if (info_ptr == NULL)
9573 if (dwarf_read_debug)
9583 end_ptr = info_ptr + section->
size;
9584 while (info_ptr < end_ptr)
9588 memset (&create_dwo_cu_data.
dwo_unit, 0,
9589 sizeof (create_dwo_cu_data.
dwo_unit));
9590 memset (&per_cu, 0,
sizeof (per_cu));
9598 &create_dwo_cu_data);
9605 if (dwo_unit != NULL)
9608 _(
"Multiple CUs in DWO file %s [in module %s]"),
9614 *dwo_unit = create_dwo_cu_data.
dwo_unit;
9617 info_ptr += per_cu.
length;
9763 struct objfile *objfile = dwarf2_per_objfile->objfile;
9764 bfd *dbfd = dwp_file->
dbfd;
9765 const gdb_byte *index_ptr, *index_end;
9767 uint32_t
version, nr_columns, nr_units, nr_slots;
9779 index_ptr = index->
buffer;
9780 index_end = index_ptr + index->
size;
9794 if (version != 1 && version != 2)
9796 error (
_(
"Dwarf Error: unsupported DWP file version (%s)"
9800 if (nr_slots != (nr_slots & -nr_slots))
9802 error (
_(
"Dwarf Error: number of slots in DWP hash table (%s)"
9803 " is not power of 2 [in module %s]"),
9816 if (nr_slots == 0 || nr_units == 0
9817 || (version == 2 && nr_columns == 0))
9820 if (nr_slots != 0 || nr_units != 0
9821 || (version == 2 && nr_columns != 0))
9824 _(
"Empty DWP but nr_slots,nr_units,nr_columns not"
9825 " all zero [in modules %s]"),
9834 htab->
unit_table +
sizeof (uint32_t) * nr_slots;
9843 int ids_seen[DW_SECT_MAX + 1];
9848 error (
_(
"Dwarf Error: bad DWP hash table, too few columns"
9849 " in section table [in module %s]"),
9854 error (
_(
"Dwarf Error: bad DWP hash table, too many columns"
9855 " in section table [in module %s]"),
9858 memset (ids, 255, (DW_SECT_MAX + 1) *
sizeof (int32_t));
9859 memset (ids_seen, 255, (DW_SECT_MAX + 1) *
sizeof (int32_t));
9862 int id =
read_4_bytes (dbfd, ids_ptr + i *
sizeof (uint32_t));
9864 if (id < DW_SECT_MIN || id > DW_SECT_MAX)
9866 error (
_(
"Dwarf Error: bad DWP hash table, bad section id %d"
9867 " in section table [in module %s]"),
9868 id, dwp_file->
name);
9870 if (ids_seen[
id] != -1)
9872 error (
_(
"Dwarf Error: bad DWP hash table, duplicate section"
9873 " id %d in section table [in module %s]"),
9874 id, dwp_file->
name);
9880 if (((ids_seen[DW_SECT_INFO] != -1)
9881 + (ids_seen[DW_SECT_TYPES] != -1))
9884 error (
_(
"Dwarf Error: bad DWP hash table, missing/duplicate"
9885 " DWO info/types section [in module %s]"),
9889 if (ids_seen[DW_SECT_ABBREV] == -1)
9891 error (
_(
"Dwarf Error: bad DWP hash table, missing DWO abbrev"
9892 " section [in module %s]"),
9895 htab->
section_pool.
v2.offsets = ids_ptr +
sizeof (uint32_t) * nr_columns;
9898 * nr_units * nr_columns);
9903 error (
_(
"Dwarf Error: DWP index section is corrupt (too small)"
9932 sections->
abbrev.
size = bfd_get_section_size (sectp);
9949 sections->
line.
size = bfd_get_section_size (sectp);
9957 sections->
loc.
size = bfd_get_section_size (sectp);
9965 sections->
macinfo.
size = bfd_get_section_size (sectp);
9973 sections->
macro.
size = bfd_get_section_size (sectp);
9999 uint32_t unit_index,
10000 const char *comp_dir,
10003 struct objfile *objfile = dwarf2_per_objfile->objfile;
10005 is_debug_types ? dwp_file->
tus : dwp_file->
cus;
10006 bfd *dbfd = dwp_file->
dbfd;
10007 const char *kind = is_debug_types ?
"TU" :
"CU";
10008 struct dwo_file *dwo_file;
10011 void **dwo_file_slot;
10012 char *virtual_dwo_name;
10019 if (dwarf_read_debug)
10031 #define MAX_NR_V1_DWO_SECTIONS \
10040 memset (§ions, 0,
sizeof (sections));
10046 uint32_t section_nr =
10049 + (unit_index + i) * sizeof (uint32_t));
10051 if (section_nr == 0)
10055 error (
_(
"Dwarf Error: bad DWP hash table, section number too large"
10056 " [in module %s]"),
10063 error (
_(
"Dwarf Error: bad DWP hash table, invalid section found"
10064 " [in module %s]"),
10073 error (
_(
"Dwarf Error: bad DWP hash table, missing DWO sections"
10074 " [in module %s]"),
10077 if (i == MAX_NR_V1_DWO_SECTIONS)
10079 error (
_(
"Dwarf Error: bad DWP hash table, too many DWO sections"
10080 " [in module %s]"),
10103 if (*dwo_file_slot == NULL)
10105 if (dwarf_read_debug)
10113 strlen (virtual_dwo_name));
10130 *dwo_file_slot = dwo_file;
10134 if (dwarf_read_debug)
10139 dwo_file = *dwo_file_slot;
10169 memset (&result, 0,
sizeof (result));
10182 || offset +
size > bfd_get_section_size (sectp))
10184 bfd *abfd = sectp->owner;
10186 error (
_(
"Dwarf Error: Bad DWP V2 section info, doesn't fit"
10187 " in section %s [in module %s]"),
10188 sectp ? bfd_section_name (abfd, sectp) :
"<unknown>",
10204 uint32_t unit_index,
10205 const char *comp_dir,
10208 struct objfile *objfile = dwarf2_per_objfile->objfile;
10210 is_debug_types ? dwp_file->
tus : dwp_file->
cus;
10211 bfd *dbfd = dwp_file->
dbfd;
10212 const char *kind = is_debug_types ?
"TU" :
"CU";
10213 struct dwo_file *dwo_file;
10216 void **dwo_file_slot;
10217 char *virtual_dwo_name;
10224 if (dwarf_read_debug)
10234 memset (§ions, 0,
sizeof (sections));
10243 * sizeof (uint32_t)));
10248 * sizeof (uint32_t)));
10253 case DW_SECT_TYPES:
10257 case DW_SECT_ABBREV:
10269 case DW_SECT_STR_OFFSETS:
10273 case DW_SECT_MACINFO:
10277 case DW_SECT_MACRO:
10304 if (*dwo_file_slot == NULL)
10306 if (dwarf_read_debug)
10314 strlen (virtual_dwo_name));
10344 *dwo_file_slot = dwo_file;
10348 if (dwarf_read_debug)
10353 dwo_file = *dwo_file_slot;
10380 is_debug_types ? dwp_file->
tus : dwp_file->
cus;
10381 bfd *dbfd = dwp_file->
dbfd;
10382 uint32_t mask = dwp_htab->
nr_slots - 1;
10383 uint32_t
hash = signature & mask;
10384 uint32_t hash2 = ((signature >> 32) & mask) | 1;
10387 struct dwo_unit find_dwo_cu, *dwo_cu;
10389 memset (&find_dwo_cu, 0,
sizeof (find_dwo_cu));
10391 slot = htab_find_slot (is_debug_types
10394 &find_dwo_cu, INSERT);
10400 for (i = 0; i < dwp_htab->
nr_slots; ++i)
10404 signature_in_table =
10406 if (signature_in_table == signature)
10408 uint32_t unit_index =
10410 dwp_htab->
unit_table + hash * sizeof (uint32_t));
10415 comp_dir, signature,
10421 comp_dir, signature,
10426 if (signature_in_table == 0)
10428 hash = (hash + hash2) & mask;
10431 error (
_(
"Dwarf Error: bad DWP hash table, lookup didn't terminate"
10432 " [in module %s]"),
10453 char *absolute_name;
10463 search_path = concat (
".", dirname_separator_string,
10466 search_path = xstrdup (
".");
10474 desc =
openp (search_path, flags, file_name,
10475 O_RDONLY |
O_BINARY, &absolute_name);
10476 xfree (search_path);
10481 xfree (absolute_name);
10482 if (sym_bfd == NULL)
10484 bfd_set_cacheable (sym_bfd, 1);
10486 if (!bfd_check_format (sym_bfd, bfd_object))
10513 if (IS_ABSOLUTE_PATH (file_name))
10518 if (comp_dir != NULL)
10520 char *path_to_try = concat (comp_dir,
SLASH_STRING, file_name, NULL);
10525 xfree (path_to_try);
10551 dwo_sections->
abbrev.
size = bfd_get_section_size (sectp);
10556 dwo_sections->
info.
size = bfd_get_section_size (sectp);
10561 dwo_sections->
line.
size = bfd_get_section_size (sectp);
10566 dwo_sections->
loc.
size = bfd_get_section_size (sectp);
10571 dwo_sections->
macinfo.
size = bfd_get_section_size (sectp);
10576 dwo_sections->
macro.
size = bfd_get_section_size (sectp);
10581 dwo_sections->
str.
size = bfd_get_section_size (sectp);
10592 memset (&type_section, 0,
sizeof (type_section));
10594 type_section.
size = bfd_get_section_size (sectp);
10604 static struct dwo_file *
10608 struct objfile *objfile = dwarf2_per_objfile->objfile;
10609 struct dwo_file *dwo_file;
10616 if (dwarf_read_debug)
10623 dwo_file->
dbfd = dbfd;
10636 if (dwarf_read_debug)
10648 void *dwp_file_ptr)
10652 unsigned int elf_section_nr = elf_section_data (sectp)->this_idx;
10656 gdb_assert (elf_section_nr < dwp_file->num_sections);
10687 unsigned int elf_section_nr = elf_section_data (sectp)->this_idx;
10691 gdb_assert (elf_section_nr < dwp_file->num_sections);
10764 return htab_create_alloc_ex (3,
10815 struct objfile *objfile = dwarf2_per_objfile->objfile;
10838 if (dwarf_read_debug)
10844 dwp_file->
name = bfd_get_filename (dbfd);
10845 dwp_file->
dbfd = dbfd;
10849 dwp_file->
num_sections = bfd_count_sections (dbfd) + 1;
10866 error (
_(
"Dwarf Error: DWP file CU version %s doesn't match"
10867 " TU version %s [in DWP file %s]"),
10879 if (dwarf_read_debug)
10883 " %s CUs, %s TUs\n",
10896 if (! dwarf2_per_objfile->dwp_checked)
10899 dwarf2_per_objfile->dwp_checked = 1;
10901 return dwarf2_per_objfile->dwp_file;
10922 const char *dwo_name,
const char *comp_dir,
10925 struct objfile *objfile = dwarf2_per_objfile->objfile;
10926 const char *kind = is_debug_types ?
"TU" :
"CU";
10927 void **dwo_file_slot;
10928 struct dwo_file *dwo_file;
10937 if (dwp_file != NULL)
10940 is_debug_types ? dwp_file->
tus : dwp_file->
cus;
10942 if (dwp_htab != NULL)
10946 signature, is_debug_types);
10948 if (dwo_cutu != NULL)
10950 if (dwarf_read_debug)
10953 "Virtual DWO %s %s found: @%s\n",
10966 if (*dwo_file_slot == NULL)
10972 dwo_file = *dwo_file_slot;
10974 if (dwo_file != NULL)
10978 if (is_debug_types && dwo_file->
tus)
10982 memset (&find_dwo_cutu, 0,
sizeof (find_dwo_cutu));
10984 dwo_cutu = htab_find (dwo_file->
tus, &find_dwo_cutu);
10986 else if (!is_debug_types && dwo_file->
cu)
10989 dwo_cutu = dwo_file->
cu;
10992 if (dwo_cutu != NULL)
10994 if (dwarf_read_debug)
11009 if (dwarf_read_debug)
11020 char *dwp_text = NULL;
11023 if (dwp_file != NULL)
11024 dwp_text =
xstrprintf (
" [in DWP file %s]", lbasename (dwp_file->
name));
11027 warning (
_(
"Could not find DWO %s %s(%s)%s referenced by %s at offset 0x%x"
11028 " [in module %s]"),
11030 dwp_text != NULL ? dwp_text :
"",
11044 const char *dwo_name,
const char *comp_dir,
11055 const char *dwo_name,
const char *comp_dir)
11071 if (sig_type != NULL)
11080 VEC_safe_push (dwarf2_per_cu_ptr, per_cu->imported_symtabs, sig_cu);
11095 struct dwo_file *dwo_file;
11101 dwo_unit = per_cu->
cu->dwo_unit;
11105 if (dwo_file->
tus != NULL)
11130 struct dwo_file *dwo_file = (
struct dwo_file *) arg;
11131 struct objfile *objfile = dwarf2_per_objfile->objfile;
11141 struct dwo_file *dwo_file = (
struct dwo_file *) *slot;
11142 struct objfile *objfile = (
struct objfile *) info;
11164 unsigned int a = *(
unsigned int *) ap;
11165 unsigned int b = *(
unsigned int *) bp;
11167 return (a > b) - (b > a);
11179 unsigned die_children_count;
11186 struct die_info *origin_child_die;
11190 struct pending **origin_previous_list_in_scope;
11192 attr =
dwarf2_attr (die, DW_AT_abstract_origin, cu);
11207 if (die->
tag != origin_die->
tag
11208 && !(die->
tag == DW_TAG_inlined_subroutine
11209 && origin_die->
tag == DW_TAG_subprogram))
11211 _(
"DIE 0x%x and its abstract origin 0x%x have different tags"),
11214 child_die = die->
child;
11215 die_children_count = 0;
11216 while (child_die && child_die->
tag)
11219 die_children_count++;
11221 offsets =
xmalloc (
sizeof (*offsets) * die_children_count);
11224 offsets_end = offsets;
11225 for (child_die = die->
child;
11226 child_die && child_die->
tag;
11229 struct die_info *child_origin_die;
11237 if (child_die->
tag == DW_TAG_GNU_call_site)
11245 child_origin_die = child_die;
11246 child_origin_cu = cu;
11249 attr =
dwarf2_attr (child_origin_die, DW_AT_abstract_origin,
11259 if (child_origin_die != child_die)
11261 if (child_die->
tag != child_origin_die->
tag
11262 && !(child_die->
tag == DW_TAG_inlined_subroutine
11263 && child_origin_die->
tag == DW_TAG_subprogram))
11265 _(
"Child DIE 0x%x and its abstract origin 0x%x have "
11268 if (child_origin_die->
parent != origin_die)
11270 _(
"Child DIE 0x%x and its abstract origin 0x%x have "
11274 *offsets_end++ = child_origin_die->
offset;
11277 qsort (offsets, offsets_end - offsets,
sizeof (*offsets),
11279 for (offsetp = offsets + 1; offsetp < offsets_end; offsetp++)
11280 if (offsetp[-1].sect_off == offsetp->
sect_off)
11282 _(
"Multiple children of DIE 0x%x refer "
11283 "to DIE 0x%x as their abstract origin"),
11287 origin_child_die = origin_die->
child;
11288 while (origin_child_die && origin_child_die->
tag)
11291 while (offsetp < offsets_end
11294 if (offsetp >= offsets_end
11304 origin_child_die =
sibling_die (origin_child_die);
11314 struct objfile *objfile = cu->
objfile;
11320 struct attribute *attr, *call_line, *call_file;
11324 int inlined_func = (die->
tag == DW_TAG_inlined_subroutine);
11325 VEC (symbolp) *template_args = NULL;
11333 call_line =
dwarf2_attr (die, DW_AT_call_line, cu);
11334 call_file =
dwarf2_attr (die, DW_AT_call_file, cu);
11335 if (call_line == NULL || call_file == NULL)
11351 _(
"missing name for subprogram DIE at %d"),
11362 _(
"cannot get low and high bounds "
11363 "for subprogram DIE at %d"),
11373 for (child_die = die->
child; child_die; child_die =
sibling_die (child_die))
11375 if (child_die->
tag == DW_TAG_template_type_param
11376 || child_die->
tag == DW_TAG_template_value_param)
11386 (
struct symbol *) templ_func);
11396 if (die->
child != NULL)
11398 child_die = die->
child;
11399 while (child_die && child_die->
tag)
11401 if (child_die->
tag == DW_TAG_template_type_param
11402 || child_die->
tag == DW_TAG_template_value_param)
11428 child_die = spec_die->
child;
11429 while (child_die && child_die->
tag)
11431 if (child_die->
tag == DW_TAG_imported_module)
11449 && cu->processing_has_namespace_info)
11459 if (!
VEC_empty (symbolp, template_args))
11467 * sizeof (
struct symbol *)));
11471 VEC_free (symbolp, template_args);
11493 struct objfile *objfile = cu->
objfile;
11513 if (die->
child != NULL)
11515 child_die = die->
child;
11516 while (child_die && child_die->
tag)
11552 struct objfile *objfile = cu->
objfile;
11567 _(
"missing DW_AT_low_pc for DW_TAG_GNU_call_site "
11568 "DIE 0x%x [in module %s]"),
11575 if (cu->call_site_htab == NULL)
11579 call_site_local.
pc = pc;
11580 slot = htab_find_slot (cu->call_site_htab, &call_site_local, INSERT);
11584 _(
"Duplicate PC %s for DW_TAG_GNU_call_site "
11585 "DIE 0x%x [in module %s]"),
11594 for (child_die = die->
child; child_die && child_die->
tag;
11597 if (child_die->
tag != DW_TAG_GNU_call_site_parameter)
11600 _(
"Tag %d is not DW_TAG_GNU_call_site_parameter in "
11601 "DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"),
11611 (sizeof (*call_site)
11613 * (nparams - 1))));
11615 memset (call_site, 0,
sizeof (*call_site) -
sizeof (*call_site->
parameter));
11616 call_site->
pc = pc;
11623 for (func_die = die->
parent;
11624 func_die && func_die->
tag != DW_TAG_subprogram
11625 && func_die->
tag != DW_TAG_subroutine_type;
11626 func_die = func_die->
parent);
11649 if (func_type != NULL)
11659 _(
"Cannot find function owning DW_TAG_GNU_call_site "
11660 "DIE 0x%x [in module %s]"),
11665 attr =
dwarf2_attr (die, DW_AT_GNU_call_site_target, cu);
11667 attr =
dwarf2_attr (die, DW_AT_abstract_origin, cu);
11675 dlbaton = obstack_alloc (&objfile->
objfile_obstack, sizeof (*dlbaton));
11691 const char *target_physname = NULL;
11695 target_attr =
dwarf2_attr (target_die, DW_AT_linkage_name, target_cu);
11696 if (target_attr == NULL)
11697 target_attr =
dwarf2_attr (target_die, DW_AT_MIPS_linkage_name,
11699 if (target_attr != NULL &&
DW_STRING (target_attr) != NULL)
11700 target_physname =
DW_STRING (target_attr);
11703 if (target_physname == NULL)
11705 _(
"DW_AT_GNU_call_site_target target DIE has invalid "
11706 "physname, for referencing DIE 0x%x [in module %s]"),
11718 _(
"DW_AT_GNU_call_site_target target DIE has invalid "
11719 "low pc, for referencing DIE 0x%x [in module %s]"),
11730 _(
"DW_TAG_GNU_call_site DW_AT_GNU_call_site_target is neither "
11731 "block nor reference, for DIE 0x%x [in module %s]"),
11736 for (child_die = die->
child;
11737 child_die && child_die->
tag;
11743 if (child_die->
tag != DW_TAG_GNU_call_site_parameter)
11756 loc =
dwarf2_attr (child_die, DW_AT_location, cu);
11757 origin =
dwarf2_attr (child_die, DW_AT_abstract_origin, cu);
11770 _(
"DW_AT_abstract_origin offset is not in CU for "
11771 "DW_TAG_GNU_call_site child DIE 0x%x "
11782 _(
"No DW_FORM_block* DW_AT_location for "
11783 "DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"),
11800 _(
"Only single DW_OP_reg or DW_OP_fbreg is supported "
11801 "for DW_FORM_block* DW_AT_location is supported for "
11802 "DW_TAG_GNU_call_site child DIE 0x%x "
11809 attr =
dwarf2_attr (child_die, DW_AT_GNU_call_site_value, cu);
11813 _(
"No DW_FORM_block* DW_AT_GNU_call_site_value for "
11814 "DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"),
11826 attr =
dwarf2_attr (child_die, DW_AT_GNU_call_site_data_value, cu);
11831 _(
"No DW_FORM_block* DW_AT_GNU_call_site_data_value for "
11832 "DW_TAG_GNU_call_site child DIE 0x%x [in module %s]"),
11852 struct objfile *objfile = cu->
objfile;
11855 bfd *obfd = objfile->
obfd;
11861 unsigned int dummy;
11873 if (offset >= dwarf2_per_objfile->
ranges.
size)
11876 _(
"Offset %d out of bounds for DW_AT_ranges attribute"),
11884 if ((marker & mask) == mask)
11888 base =
read_address (obfd, buffer + addr_size, cu, &dummy);
11902 range_beginning =
read_address (obfd, buffer, cu, &dummy);
11909 if (range_beginning == 0 && range_end == 0)
11916 if ((range_beginning & mask) == mask)
11920 base =
read_address (obfd, buffer + addr_size, cu, &dummy);
11930 _(
"Invalid .debug_ranges data (no base address)"));
11934 if (range_beginning > range_end)
11938 _(
"Invalid .debug_ranges data (inverted range)"));
11943 if (range_beginning == range_end)
11946 range_beginning += base;
11951 if (range_beginning + baseaddr == 0
11952 && !dwarf2_per_objfile->has_section_at_zero)
11955 _(
".debug_ranges entry has start address of zero"
11960 if (ranges_pst != NULL)
11966 range_beginning + baseaddr);
11968 range_end + baseaddr);
11979 low = range_beginning;
11985 if (range_beginning < low)
11986 low = range_beginning;
11987 if (range_end > high)
12000 *high_return = high;
12019 attr_high =
dwarf2_attr (die, DW_AT_high_pc, cu);
12045 int need_ranges_base = die->
tag != DW_TAG_compile_unit;
12046 unsigned int ranges_offset = (
DW_UNSND (attr)
12047 + (need_ranges_base
12072 if (low == 0 && !dwarf2_per_objfile->has_section_at_zero)
12096 *lowpc =
min (*lowpc, low);
12097 *highpc =
max (*highpc, high);
12109 while (child && child->
tag)
12111 if (child->
tag == DW_TAG_subprogram
12112 || child->
tag == DW_TAG_lexical_block)
12133 best_low = current_low;
12134 best_high = current_high;
12140 while (child && child->
tag)
12142 switch (child->
tag) {
12143 case DW_TAG_subprogram:
12146 case DW_TAG_namespace:
12147 case DW_TAG_module:
12160 best_low =
min (best_low, current_low);
12161 best_high =
max (best_high, current_high);
12174 *highpc = best_high;
12184 struct objfile *objfile = cu->
objfile;
12189 attr_high =
dwarf2_attr (die, DW_AT_high_pc, cu);
12210 bfd *obfd = objfile->
obfd;
12214 int need_ranges_base = die->
tag != DW_TAG_compile_unit;
12218 unsigned long offset = (
DW_UNSND (attr)
12219 + (need_ranges_base ? cu->ranges_base : 0));
12240 if (offset >= dwarf2_per_objfile->
ranges.
size)
12243 _(
"Offset %lu out of bounds for DW_AT_ranges attribute"),
12251 unsigned int bytes_read;
12255 buffer += bytes_read;
12257 buffer += bytes_read;
12260 if (start == 0 && end == 0)
12264 else if ((start & base_select_mask) == base_select_mask)
12276 _(
"Invalid .debug_ranges data "
12277 "(no base address)"));
12285 _(
"Invalid .debug_ranges data "
12286 "(inverted range)"));
12294 start += base + baseaddr;
12295 end += base + baseaddr;
12299 if (start == 0 && !dwarf2_per_objfile->has_section_at_zero)
12302 _(
".debug_ranges entry has start address of zero"
12337 cu->producer_is_gxx_lt_4_6 = major < 4 || (major == 4 && minor < 6);
12338 cu->producer_is_gcc_lt_4_3 = major < 4 || (major == 4 && minor < 3);
12341 cu->producer_is_icc = 1;
12348 cu->checked_producer = 1;
12358 if (!cu->checked_producer)
12361 return cu->producer_is_gxx_lt_4_6;
12367 static enum dwarf_access_attribute
12375 if (die->
tag != DW_TAG_inheritance)
12376 return DW_ACCESS_public;
12378 return DW_ACCESS_private;
12386 if (die->
parent->
tag == DW_TAG_class_type)
12387 return DW_ACCESS_private;
12389 return DW_ACCESS_public;
12404 attr =
dwarf2_attr (die, DW_AT_data_member_location, cu);
12434 struct objfile *objfile = cu->
objfile;
12439 const char *fieldname =
"";
12444 memset (new_field, 0,
sizeof (
struct nextfield));
12446 if (die->
tag == DW_TAG_inheritance)
12454 fip->
fields = new_field;
12458 attr =
dwarf2_attr (die, DW_AT_accessibility, cu);
12472 fp = &new_field->
field;
12519 int anonymous_size;
12540 + anonymous_size * bits_per_byte
12547 if (fieldname == NULL)
12552 fp->
name = fieldname;
12563 else if (die->
tag == DW_TAG_member || die->
tag == DW_TAG_variable)
12572 const char *physname;
12576 if (fieldname == NULL)
12601 else if (die->
tag == DW_TAG_inheritance)
12621 struct objfile *objfile = cu->
objfile;
12625 char *fieldname =
"";
12628 new_field =
xzalloc (
sizeof (*new_field));
12633 fp = &new_field->
field;
12637 if (fp->
name == NULL)
12684 unsigned char *pointer;
12696 while (nfields-- > 0)
12714 case DW_ACCESS_private:
12719 case DW_ACCESS_protected:
12724 case DW_ACCESS_public:
12735 if (nfields < fip->nbaseclasses)
12739 case DW_VIRTUALITY_virtual:
12740 case DW_VIRTUALITY_pure_virtual:
12742 error (
_(
"unexpected virtuality in component of Ada type"));
12756 const char *fieldname;
12757 const char *type_name;
12760 if (die->
parent == NULL)
12763 if (die->
parent->
tag != DW_TAG_structure_type
12764 && die->
parent->
tag != DW_TAG_union_type
12765 && die->
parent->
tag != DW_TAG_class_type)
12770 if (fieldname == NULL || type_name == NULL)
12773 len = strlen (fieldname);
12774 return (strncmp (fieldname, type_name, len) == 0
12775 && (type_name[len] ==
'\0' || type_name[len] ==
'<'));
12784 struct objfile *objfile = cu->
objfile;
12789 const char *fieldname;
12791 struct type *this_type;
12795 error (
_(
"unexpected member function in Ada type"));
12799 if (fieldname == NULL)
12810 if (i < fip->nfnfields)
12824 flp->
name = fieldname;
12834 memset (new_fnfield, 0,
sizeof (
struct nextfnfield));
12836 flp->
head = new_fnfield;
12851 fnp->
physname = physname ? physname :
"";
12882 if (
dwarf2_attr (die, DW_AT_containing_type, cu) != NULL)
12889 attr =
dwarf2_attr (die, DW_AT_accessibility, cu);
12894 switch (accessibility)
12896 case DW_ACCESS_private:
12899 case DW_ACCESS_protected:
12917 attr =
dwarf2_attr (die, DW_AT_vtable_elem_location, cu);
12922 if (
DW_BLOCK (attr)->data[0] == DW_OP_constu)
12927 else if (
DW_BLOCK (attr)->data[0] == DW_OP_deref
12929 &&
DW_BLOCK (attr)->data[0] == DW_OP_deref_size
12935 offset = (
DW_BLOCK (attr)->data[0] == DW_OP_deref
12958 _(
"cannot determine context for virtual member "
12959 "function \"%s\" (offset %d)"),
12986 _(
"Member function \"%s\" (offset %d) is virtual "
12987 "but the vtable offset is not specified"),
13005 error (
_(
"unexpected member functions in Ada type"));
13011 for (i = 0, flp = fip->
fnfieldlists; i < fip->nfnfields; i++, flp++)
13021 for (k = flp->
length; (k--, nfp); nfp = nfp->
next)
13033 static const char vptr[] =
"_vptr";
13034 static const char vtable[] =
"vtable";
13056 struct type *pfn_type, *self_type, *
new_type;
13071 if (pfn_type == NULL
13097 if (!cu->checked_producer)
13100 return cu->producer_is_icc;
13115 static struct type *
13118 struct objfile *objfile = cu->
objfile;
13153 if (die->
tag == DW_TAG_structure_type
13154 || die->
tag == DW_TAG_class_type)
13162 if (die->
tag == DW_TAG_class_type)
13167 if (die->
tag == DW_TAG_structure_type)
13171 else if (die->
tag == DW_TAG_union_type)
13204 else if (attr == NULL && die->
child == NULL
13227 struct objfile *objfile = cu->
objfile;
13238 VEC (symbolp) *template_args = NULL;
13241 memset (&fi, 0,
sizeof (
struct field_info));
13243 child_die = die->
child;
13245 while (child_die && child_die->
tag)
13247 if (child_die->
tag == DW_TAG_member
13248 || child_die->
tag == DW_TAG_variable)
13257 else if (child_die->
tag == DW_TAG_subprogram)
13262 else if (child_die->
tag == DW_TAG_inheritance)
13267 else if (child_die->
tag == DW_TAG_typedef)
13269 else if (child_die->
tag == DW_TAG_template_type_param
13270 || child_die->
tag == DW_TAG_template_value_param)
13282 if (!
VEC_empty (symbolp, template_args))
13290 *
sizeof (
struct symbol *)));
13294 *
sizeof (
struct symbol *)));
13295 VEC_free (symbolp, template_args);
13310 if (
dwarf2_attr (die, DW_AT_containing_type, cu) != NULL)
13336 _(
"virtual function table pointer "
13337 "not found when defining class '%s'"),
13407 child_die = die->
child;
13409 while (child_die != NULL && child_die->
tag)
13411 if (child_die->
tag == DW_TAG_member
13412 || child_die->
tag == DW_TAG_variable
13413 || child_die->
tag == DW_TAG_inheritance
13414 || child_die->
tag == DW_TAG_template_value_param
13415 || child_die->
tag == DW_TAG_template_type_param)
13428 if (
dwarf2_attr (die, DW_AT_byte_size, cu) != NULL
13441 struct obstack obstack;
13443 int unsigned_enum = 1;
13448 obstack_init (&obstack);
13451 for (child_die = die->
child;
13452 child_die != NULL && child_die->
tag;
13461 if (child_die->
tag != DW_TAG_enumerator)
13464 attr =
dwarf2_attr (child_die, DW_AT_const_value, cu);
13470 name =
"<anonymous enumerator>";
13473 &value, &bytes, &baton);
13479 else if ((mask & value) != 0)
13486 if (!unsigned_enum && !flag_enum)
13501 static struct type *
13504 struct objfile *objfile = cu->
objfile;
13532 struct type *underlying_type =
die_type (die, cu);
13588 struct type *this_type;
13591 if (this_type == NULL)
13594 if (die->
child != NULL)
13598 struct field *fields = NULL;
13599 int num_fields = 0;
13602 child_die = die->
child;
13603 while (child_die && child_die->
tag)
13605 if (child_die->
tag != DW_TAG_enumerator)
13614 sym =
new_symbol (child_die, this_type, cu);
13618 fields = (
struct field *)
13620 (num_fields + DW_FIELD_ALLOC_CHUNK)
13621 *
sizeof (
struct field));
13642 sizeof (
struct field) * num_fields);
13673 static struct type *
13676 struct objfile *objfile = cu->
objfile;
13679 struct type *element_type, *range_type, *index_type;
13680 struct type **range_types = NULL;
13685 unsigned int bit_stride = 0;
13687 element_type =
die_type (die, cu);
13704 if (die->
child == NULL)
13714 child_die = die->
child;
13715 while (child_die && child_die->
tag)
13717 if (child_die->
tag == DW_TAG_subrange_type)
13721 if (child_type != NULL)
13727 range_types = (
struct type **)
13728 xrealloc (range_types, (ndim + DW_FIELD_ALLOC_CHUNK)
13729 *
sizeof (
struct type *));
13733 range_types[ndim++] = child_type;
13742 type = element_type;
13779 _(
"DW_AT_byte_size for array type smaller "
13780 "than the total size of elements"));
13798 static enum dwarf_array_dim_ordering
13805 if (attr)
return DW_SND (attr);
13817 return DW_ORD_row_major;
13823 return DW_ORD_col_major;
13826 return DW_ORD_row_major;
13833 static struct type *
13871 struct objfile *objfile = dwarf2_per_objfile->objfile;
13874 unsigned int cu_off;
13888 baton->
size = 5 + 1 ;
13901 *ptr++ = DW_OP_call4;
13908 *ptr++ = DW_OP_addr;
13917 ptr +=
DW_BLOCK (member_loc)->size;
13920 *ptr++ = DW_OP_plus;
13954 "common block member");
13959 if (die->
child != NULL)
13961 struct objfile *objfile = cu->
objfile;
13963 size_t n_entries = 0,
size;
13967 for (child_die = die->
child;
13968 child_die && child_die->
tag;
13972 size = (
sizeof (
struct common_block)
13973 + (n_entries - 1) *
sizeof (
struct symbol *));
13975 memset (common_block->
contents, 0, n_entries * sizeof (
struct symbol *));
13978 for (child_die = die->
child;
13979 child_die && child_die->
tag;
13991 member_loc =
dwarf2_attr (child_die, DW_AT_data_member_location,
14000 _(
"Variable in common block has "
14001 "DW_AT_data_member_location "
14002 "- DIE at 0x%x [in module %s]"),
14028 static struct type *
14031 struct objfile *objfile = cu->
objfile;
14032 const char *previous_prefix, *
name;
14037 if (
dwarf2_attr (die, DW_AT_extension, cu) != NULL)
14055 if (previous_prefix[0] !=
'\0')
14057 previous_prefix, name, 0, cu);
14073 struct objfile *objfile = cu->
objfile;
14080 if (
dwarf2_attr (die, DW_AT_extension, cu) == NULL)
14097 if (die->
child != NULL)
14101 while (child_die && child_die->
tag)
14113 static struct type *
14116 struct objfile *objfile = cu->
objfile;
14117 const char *module_name;
14123 _(
"DW_TAG_module has no name, offset 0x%x"),
14144 while (child_die && child_die->
tag)
14155 static const char *
14159 const char *name = NULL;
14163 for (current_die = die;
14164 current_die != NULL;
14179 *is_anonymous = (name == NULL);
14189 static struct type *
14197 int byte_size, addr_class;
14198 struct type *target_type;
14209 attr_byte_size =
dwarf2_attr (die, DW_AT_byte_size, cu);
14210 if (attr_byte_size)
14211 byte_size =
DW_UNSND (attr_byte_size);
14215 attr_address_class =
dwarf2_attr (die, DW_AT_address_class, cu);
14216 if (attr_address_class)
14217 addr_class =
DW_UNSND (attr_address_class);
14219 addr_class = DW_ADDR_none;
14224 if (
TYPE_LENGTH (type) != byte_size || addr_class != DW_ADDR_none)
14231 (gdbarch, byte_size, addr_class);
14239 _(
"invalid pointer size %d"), byte_size);
14254 static struct type *
14258 struct type *to_type;
14259 struct type *domain;
14289 static struct type *
14322 static struct type *
14324 struct type *base_type,
int cnst,
int voltl)
14326 struct type *el_type, *inner_array;
14329 inner_array = base_type;
14346 static struct type *
14349 struct type *base_type, *cv_type;
14367 static struct type *
14370 struct type *base_type, *cv_type;
14391 static struct type *
14394 struct type *base_type, *cv_type;
14409 static struct type *
14412 struct type *base_type, *cv_type;
14430 static struct type *
14433 struct objfile *objfile = cu->
objfile;
14435 struct type *
type, *range_type, *index_type, *char_type;
14437 unsigned int length;
14439 attr =
dwarf2_attr (die, DW_AT_string_length, cu);
14475 if (attr && (
DW_UNSND (attr) != 0))
14508 static struct type *
14511 struct objfile *objfile = cu->
objfile;
14513 struct type *ftype;
14531 attr =
dwarf2_attr (die, DW_AT_calling_convention, cu);
14542 if (attr && (
DW_UNSND (attr) != 0))
14550 if (die->
child != NULL)
14554 int nparams, iparams;
14560 child_die = die->
child;
14561 while (child_die && child_die->
tag)
14563 if (child_die->
tag == DW_TAG_formal_parameter)
14565 else if (child_die->
tag == DW_TAG_unspecified_parameters)
14577 for (iparams = 0; iparams < nparams; iparams++)
14581 child_die = die->
child;
14582 while (child_die && child_die->
tag)
14584 if (child_die->
tag == DW_TAG_formal_parameter)
14586 struct type *arg_type;
14597 attr =
dwarf2_attr (child_die, DW_AT_artificial, cu);
14610 if (name && !strcmp (name,
"this"))
14614 arg_type =
die_type (child_die, cu);
14626 attr =
dwarf2_attr (die, DW_AT_object_pointer, cu);
14633 else if (name && strcmp (name,
"this") == 0)
14636 else if (name == NULL && iparams == 0)
14657 static struct type *
14660 struct objfile *objfile = cu->
objfile;
14661 const char *name = NULL;
14662 struct type *this_type, *target_type;
14670 if (target_type != this_type)
14677 _(
"Self-referential DW_TAG_typedef "
14678 "- DIE at 0x%x [in module %s]"),
14688 static struct type *
14691 struct objfile *objfile = cu->
objfile;
14697 int type_flags = 0;
14698 struct type *target_type = NULL;
14714 _(
"DW_AT_name missing from DW_TAG_base_type"));
14719 case DW_ATE_address:
14725 case DW_ATE_boolean:
14729 case DW_ATE_complex_float:
14733 case DW_ATE_decimal_float:
14739 case DW_ATE_signed:
14741 case DW_ATE_unsigned:
14748 case DW_ATE_signed_char:
14754 case DW_ATE_unsigned_char:
14776 if (name && strcmp (name,
"char") == 0)
14793 if (attr == NULL || prop == NULL)
14798 baton = obstack_alloc (obstack,
sizeof (*baton));
14814 target_attr =
dwarf2_attr (target_die, DW_AT_location, target_cu);
14815 if (target_attr == NULL)
14816 target_attr =
dwarf2_attr (target_die, DW_AT_data_member_location,
14818 if (target_attr == NULL)
14821 switch (target_attr->
name)
14823 case DW_AT_location:
14826 baton = obstack_alloc (obstack,
sizeof (*baton));
14835 baton = obstack_alloc (obstack,
sizeof (*baton));
14847 "dynamic property");
14851 case DW_AT_data_member_location:
14859 baton = obstack_alloc (obstack,
sizeof (*baton));
14887 static struct type *
14890 struct type *base_type, *orig_base_type;
14891 struct type *range_type;
14894 int low_default_is_valid;
14895 int high_bound_is_count = 0;
14899 orig_base_type =
die_type (die, cu);
14922 low_default_is_valid = 1;
14926 low_default_is_valid = 1;
14942 low_default_is_valid = 0;
14949 else if (!low_default_is_valid)
14951 "- DIE at 0x%x [in module %s]"),
14964 high_bound_is_count = 1;
14982 struct objfile *objfile = cu->
objfile;
14990 if (int_type &&
TYPE_LENGTH (int_type) >= addr_size)
14991 base_type = int_type;
14995 if (int_type &&
TYPE_LENGTH (int_type) >= addr_size)
14996 base_type = int_type;
15000 if (int_type &&
TYPE_LENGTH (int_type) >= addr_size)
15001 base_type = int_type;
15024 if (high_bound_is_count)
15047 static struct type *
15076 cur_ptr =
read_full_die_1 (reader, &die, info_ptr, &has_children, 0);
15079 *new_info_ptr = cur_ptr;
15089 *new_info_ptr = cur_ptr;
15107 struct die_info *first_die, *last_sibling;
15110 cur_ptr = info_ptr;
15111 first_die = last_sibling = NULL;
15120 *new_info_ptr = cur_ptr;
15129 last_sibling = die;
15145 new_info_ptr, parent);
15147 if (dwarf_die_debug)
15150 "Read die from %s@0x%x of %s:\n",
15153 bfd_get_filename (reader->
abfd));
15171 int *has_children,
int num_extra_attrs)
15173 unsigned int abbrev_number, bytes_read, i;
15178 bfd *abfd = reader->
abfd;
15182 info_ptr += bytes_read;
15183 if (!abbrev_number)
15192 error (
_(
"Dwarf Error: could not find abbrev number %d [in module %s]"),
15194 bfd_get_filename (abfd));
15199 die->
abbrev = abbrev_number;
15206 for (i = 0; i < abbrev->
num_attrs; ++i)
15229 if (dwarf_die_debug)
15232 "Read die from %s@0x%x of %s:\n",
15235 bfd_get_filename (reader->
abfd));
15236 dump_die (*diep, dwarf_die_debug);
15266 unsigned int abbrev_number,
15269 unsigned int hash_number;
15272 abbrev->
next = abbrev_table->
abbrevs[hash_number];
15273 abbrev_table->
abbrevs[hash_number] = abbrev;
15281 unsigned int abbrev_number)
15283 unsigned int hash_number;
15287 abbrev = abbrev_table->
abbrevs[hash_number];
15291 if (abbrev->
number == abbrev_number)
15293 abbrev = abbrev->
next;
15304 struct objfile *objfile = dwarf2_per_objfile->objfile;
15309 unsigned int abbrev_number, bytes_read, abbrev_name;
15310 unsigned int abbrev_form;
15312 unsigned int allocated_attrs;
15314 abbrev_table = XNEW (
struct abbrev_table);
15320 memset (abbrev_table->
abbrevs, 0,
15326 abbrev_ptr += bytes_read;
15332 while (abbrev_number)
15337 cur_abbrev->
number = abbrev_number;
15339 abbrev_ptr += bytes_read;
15345 abbrev_ptr += bytes_read;
15347 abbrev_ptr += bytes_read;
15348 while (abbrev_name)
15350 if (cur_abbrev->
num_attrs == allocated_attrs)
15354 =
xrealloc (cur_attrs, (allocated_attrs
15361 abbrev_ptr += bytes_read;
15363 abbrev_ptr += bytes_read;
15369 memcpy (cur_abbrev->
attrs, cur_attrs,
15381 if ((
unsigned int) (abbrev_ptr - section->
buffer) >= section->
size)
15384 abbrev_ptr += bytes_read;
15390 return abbrev_table;
15399 xfree (abbrev_table);
15412 if (*abbrev_table_ptr != NULL)
15414 *abbrev_table_ptr = NULL;
15452 case DW_TAG_array_type:
15453 case DW_TAG_file_type:
15454 case DW_TAG_ptr_to_member_type:
15455 case DW_TAG_set_type:
15456 case DW_TAG_string_type:
15457 case DW_TAG_subroutine_type:
15459 case DW_TAG_base_type:
15460 case DW_TAG_class_type:
15461 case DW_TAG_interface_type:
15462 case DW_TAG_enumeration_type:
15463 case DW_TAG_structure_type:
15464 case DW_TAG_subrange_type:
15465 case DW_TAG_typedef:
15466 case DW_TAG_union_type:
15477 const gdb_byte *info_ptr,
int building_psymtab)
15480 struct objfile *objfile = cu->
objfile;
15484 unsigned int bytes_read;
15485 unsigned int load_all = 0;
15486 int nesting_level = 1;
15512 if (abbrev == NULL)
15514 if (--nesting_level == 0)
15524 info_ptr += bytes_read;
15525 last_die = parent_die;
15532 if (parent_die != NULL
15534 && (abbrev->
tag == DW_TAG_template_type_param
15535 || abbrev->
tag == DW_TAG_template_value_param))
15542 info_ptr =
skip_one_die (reader, info_ptr + bytes_read, abbrev);
15551 && parent_die != NULL
15552 && parent_die->
tag == DW_TAG_subprogram)
15554 info_ptr =
skip_one_die (reader, info_ptr + bytes_read, abbrev);
15564 && abbrev->
tag != DW_TAG_constant
15565 && abbrev->
tag != DW_TAG_enumerator
15566 && abbrev->
tag != DW_TAG_subprogram
15567 && abbrev->
tag != DW_TAG_lexical_block
15568 && abbrev->
tag != DW_TAG_variable
15569 && abbrev->
tag != DW_TAG_namespace
15570 && abbrev->
tag != DW_TAG_module
15571 && abbrev->
tag != DW_TAG_member
15572 && abbrev->
tag != DW_TAG_imported_unit
15573 && abbrev->
tag != DW_TAG_imported_declaration)
15576 info_ptr =
skip_one_die (reader, info_ptr + bytes_read, abbrev);
15599 if (parent_die == NULL
15603 || part_die->
tag == DW_TAG_base_type
15604 || part_die->
tag == DW_TAG_subrange_type))
15606 if (building_psymtab && part_die->
name != NULL)
15625 _(
"DW_TAG_typedef has childen - GCC PR debug/47510 bug "
15626 "- DIE at 0x%x [in module %s]"),
15633 if (part_die->
tag == DW_TAG_enumerator
15634 && parent_die != NULL
15636 && parent_die->
tag == DW_TAG_enumeration_type
15639 if (part_die->
name == NULL)
15641 _(
"malformed enumerator DIE ignored"));
15642 else if (building_psymtab)
15660 if (last_die && last_die == parent_die)
15665 last_die = part_die;
15667 if (first_die == NULL)
15668 first_die = part_die;
15692 || abbrev->
tag == DW_TAG_constant
15693 || abbrev->
tag == DW_TAG_subprogram
15694 || abbrev->
tag == DW_TAG_variable
15695 || abbrev->
tag == DW_TAG_namespace
15700 slot = htab_find_slot_with_hash (cu->
partial_dies, part_die,
15722 || last_die->
tag == DW_TAG_namespace
15723 || last_die->
tag == DW_TAG_module
15724 || last_die->
tag == DW_TAG_enumeration_type
15726 && last_die->
tag == DW_TAG_subprogram
15727 && (last_die->
name == NULL
15728 || strchr (last_die->
name,
'<') == NULL))
15730 && (last_die->
tag == DW_TAG_class_type
15731 || last_die->
tag == DW_TAG_interface_type
15732 || last_die->
tag == DW_TAG_structure_type
15733 || last_die->
tag == DW_TAG_union_type))
15735 && (last_die->
tag == DW_TAG_subprogram
15736 || last_die->
tag == DW_TAG_lexical_block))))
15739 parent_die = last_die;
15755 struct abbrev_info *abbrev,
unsigned int abbrev_len,
15759 struct objfile *objfile = cu->
objfile;
15763 int has_low_pc_attr = 0;
15764 int has_high_pc_attr = 0;
15765 int high_pc_relative = 0;
15771 info_ptr += abbrev_len;
15773 if (abbrev == NULL)
15776 part_die->
tag = abbrev->
tag;
15779 for (i = 0; i < abbrev->
num_attrs; ++i)
15788 switch (part_die->
tag)
15790 case DW_TAG_compile_unit:
15791 case DW_TAG_partial_unit:
15792 case DW_TAG_type_unit:
15795 case DW_TAG_enumeration_type:
15796 case DW_TAG_enumerator:
15808 case DW_AT_linkage_name:
15809 case DW_AT_MIPS_linkage_name:
15818 has_low_pc_attr = 1;
15821 case DW_AT_high_pc:
15822 has_high_pc_attr = 1;
15825 high_pc_relative = 1;
15827 case DW_AT_location:
15840 "partial symbol information");
15843 case DW_AT_external:
15846 case DW_AT_declaration:
15852 case DW_AT_abstract_origin:
15853 case DW_AT_specification:
15854 case DW_AT_extension:
15860 case DW_AT_sibling:
15863 if (attr.
form == DW_FORM_ref_addr)
15865 _(
"ignoring absolute DW_AT_sibling"));
15869 const gdb_byte *sibling_ptr = buffer + off;
15871 if (sibling_ptr < info_ptr)
15873 _(
"DW_AT_sibling points backwards"));
15877 part_die->
sibling = sibling_ptr;
15880 case DW_AT_byte_size:
15883 case DW_AT_const_value:
15886 case DW_AT_calling_convention:
15901 if (
DW_UNSND (&attr) == DW_CC_program
15906 if (
DW_UNSND (&attr) == DW_INL_inlined
15907 ||
DW_UNSND (&attr) == DW_INL_declared_inlined)
15912 if (part_die->
tag == DW_TAG_imported_unit)
15915 part_die->
is_dwz = (attr.
form == DW_FORM_GNU_ref_alt
15925 if (high_pc_relative)
15928 if (has_low_pc_attr && has_high_pc_attr)
15938 if (part_die->
lowpc == 0 && !dwarf2_per_objfile->has_section_at_zero)
15943 _(
"DW_AT_low_pc %s is zero "
15944 "for DIE at 0x%x [in module %s]"),
15954 _(
"DW_AT_low_pc %s is not < DW_AT_high_pc %s "
15955 "for DIE at 0x%x [in module %s]"),
15976 lookup_die = htab_find_with_hash (cu->
partial_dies, &part_die,
15990 struct objfile *objfile = cu->
objfile;
16009 error (
_(
"Dwarf Error: Type Unit at offset 0x%lx contains"
16010 " external reference to offset 0x%lx [in module %s].\n"),
16012 bfd_get_filename (objfile->
obfd));
16044 _(
"could not find partial DIE 0x%x "
16045 "in cache [from module %s]\n"),
16071 real_pdi = struct_pdi;
16079 for (child_pdi = struct_pdi->
die_child;
16083 if (child_pdi->
tag == DW_TAG_subprogram
16086 char *actual_class_name
16089 if (actual_class_name != NULL)
16094 strlen (actual_class_name));
16095 xfree (actual_class_name);
16127 if (spec_die->
name)
16139 if (part_die->
name == NULL && part_die->
tag == DW_TAG_namespace)
16149 && (part_die->
tag == DW_TAG_class_type
16150 || part_die->
tag == DW_TAG_structure_type
16151 || part_die->
tag == DW_TAG_union_type))
16156 if (part_die->
name == NULL
16157 && (part_die->
tag == DW_TAG_class_type
16158 || part_die->
tag == DW_TAG_interface_type
16159 || part_die->
tag == DW_TAG_structure_type
16160 || part_die->
tag == DW_TAG_union_type)
16172 base = strrchr (demangled,
':');
16173 if (base && base > demangled && base[-1] ==
':')
16180 base, strlen (base));
16196 struct objfile *objfile = cu->
objfile;
16198 bfd *abfd = reader->
abfd;
16200 unsigned int bytes_read;
16206 case DW_FORM_ref_addr:
16211 &cu->
header, &bytes_read);
16212 info_ptr += bytes_read;
16214 case DW_FORM_GNU_ref_alt:
16216 info_ptr += bytes_read;
16221 info_ptr += bytes_read;
16223 case DW_FORM_block2:
16228 info_ptr += blk->
size;
16231 case DW_FORM_block4:
16236 info_ptr += blk->
size;
16239 case DW_FORM_data2:
16243 case DW_FORM_data4:
16247 case DW_FORM_data8:
16251 case DW_FORM_sec_offset:
16253 info_ptr += bytes_read;
16255 case DW_FORM_string:
16258 info_ptr += bytes_read;
16266 info_ptr += bytes_read;
16270 case DW_FORM_GNU_strp_alt:
16278 info_ptr += bytes_read;
16281 case DW_FORM_exprloc:
16282 case DW_FORM_block:
16285 info_ptr += bytes_read;
16287 info_ptr += blk->
size;
16290 case DW_FORM_block1:
16295 info_ptr += blk->
size;
16298 case DW_FORM_data1:
16306 case DW_FORM_flag_present:
16309 case DW_FORM_sdata:
16311 info_ptr += bytes_read;
16313 case DW_FORM_udata:
16315 info_ptr += bytes_read;
16337 case DW_FORM_ref_sig8:
16341 case DW_FORM_ref_udata:
16344 info_ptr += bytes_read;
16346 case DW_FORM_indirect:
16348 info_ptr += bytes_read;
16351 case DW_FORM_GNU_addr_index:
16356 error (
_(
"Dwarf Error: %s found in non-DWO CU [in module %s]"),
16358 bfd_get_filename (abfd));
16361 info_ptr += bytes_read;
16363 case DW_FORM_GNU_str_index:
16368 error (
_(
"Dwarf Error: %s found in non-DWO CU [in module %s]"),
16370 bfd_get_filename (abfd));
16378 info_ptr += bytes_read;
16382 error (
_(
"Dwarf Error: Cannot handle %s in DWARF reader [in module %s]"),
16384 bfd_get_filename (abfd));
16389 attr->
form = DW_FORM_GNU_ref_alt;
16397 if (attr->
name == DW_AT_byte_size
16398 && form == DW_FORM_data4
16403 _(
"Suspicious DW_AT_byte_size value treated as zero instead of %s"),
16424 static unsigned int
16427 return bfd_get_8 (abfd, buf);
16433 return bfd_get_signed_8 (abfd, buf);
16436 static unsigned int
16439 return bfd_get_16 (abfd, buf);
16445 return bfd_get_signed_16 (abfd, buf);
16448 static unsigned int
16451 return bfd_get_32 (abfd, buf);
16457 return bfd_get_signed_32 (abfd, buf);
16463 return bfd_get_64 (abfd, buf);
16468 unsigned int *bytes_read)
16478 retval = bfd_get_signed_16 (abfd, buf);
16481 retval = bfd_get_signed_32 (abfd, buf);
16484 retval = bfd_get_signed_64 (abfd, buf);
16488 _(
"read_address: bad switch, signed [in module %s]"),
16489 bfd_get_filename (abfd));
16497 retval = bfd_get_16 (abfd, buf);
16500 retval = bfd_get_32 (abfd, buf);
16503 retval = bfd_get_64 (abfd, buf);
16507 _(
"read_address: bad switch, "
16508 "unsigned [in module %s]"),
16509 bfd_get_filename (abfd));
16560 if (length == 0xffffffff)
16562 length = bfd_get_64 (abfd, buf + 4);
16565 else if (length == 0)
16568 length = bfd_get_64 (abfd, buf);
16590 unsigned int *bytes_read,
16601 _(
"intermixed 32-bit and 64-bit DWARF sections"));
16603 *offset_size = (*bytes_read == 4) ? 4 : 8;
16613 unsigned int *bytes_read)
16628 switch (offset_size)
16631 retval = bfd_get_32 (abfd, buf);
16634 retval = bfd_get_64 (abfd, buf);
16638 _(
"read_offset_1: bad switch [in module %s]"),
16639 bfd_get_filename (abfd));
16655 static const char *
16657 unsigned int *bytes_read_ptr)
16665 *bytes_read_ptr = 1;
16668 *bytes_read_ptr = strlen ((
const char *) buf) + 1;
16669 return (
const char *) buf;
16672 static const char *
16676 if (dwarf2_per_objfile->
str.
buffer == NULL)
16677 error (
_(
"DW_FORM_strp used without .debug_str section [in module %s]"),
16678 bfd_get_filename (abfd));
16679 if (str_offset >= dwarf2_per_objfile->
str.
size)
16680 error (
_(
"DW_FORM_strp pointing outside of "
16681 ".debug_str section [in module %s]"),
16682 bfd_get_filename (abfd));
16684 if (dwarf2_per_objfile->
str.
buffer[str_offset] ==
'\0')
16686 return (
const char *) (dwarf2_per_objfile->
str.
buffer + str_offset);
16694 static const char *
16700 error (
_(
"DW_FORM_GNU_strp_alt used without .debug_str "
16701 "section [in module %s]"),
16702 bfd_get_filename (dwz->
dwz_bfd));
16703 if (str_offset >= dwz->
str.
size)
16704 error (
_(
"DW_FORM_GNU_strp_alt pointing outside of "
16705 ".debug_str section [in module %s]"),
16706 bfd_get_filename (dwz->
dwz_bfd));
16708 if (dwz->
str.
buffer[str_offset] ==
'\0')
16710 return (
const char *) (dwz->
str.
buffer + str_offset);
16713 static const char *
16716 unsigned int *bytes_read_ptr)
16725 unsigned int *bytes_read_ptr)
16728 unsigned int num_read;
16730 unsigned char byte;
16738 byte = bfd_get_8 (abfd, buf);
16741 result |= ((
ULONGEST) (byte & 127) << shift);
16742 if ((byte & 128) == 0)
16748 *bytes_read_ptr = num_read;
16754 unsigned int *bytes_read_ptr)
16757 int i, shift, num_read;
16758 unsigned char byte;
16766 byte = bfd_get_8 (abfd, buf);
16769 result |= ((
LONGEST) (byte & 127) << shift);
16771 if ((byte & 128) == 0)
16776 if ((shift < 8 *
sizeof (result)) && (byte & 0x40))
16777 result |= -(((
LONGEST) 1) << shift);
16778 *bytes_read_ptr = num_read;
16789 struct objfile *objfile = dwarf2_per_objfile->objfile;
16790 bfd *abfd = objfile->
obfd;
16794 if (dwarf2_per_objfile->
addr.
buffer == NULL)
16795 error (
_(
"DW_FORM_addr_index used without .debug_addr section [in module %s]"),
16797 if (addr_base + addr_index * addr_size >= dwarf2_per_objfile->
addr.
size)
16798 error (
_(
"DW_FORM_addr_index pointing outside of "
16799 ".debug_addr section [in module %s]"),
16802 + addr_base + addr_index * addr_size);
16803 if (addr_size == 4)
16804 return bfd_get_32 (abfd, info_ptr);
16806 return bfd_get_64 (abfd, info_ptr);
16821 unsigned int *bytes_read)
16862 unsigned int addr_index)
16864 struct objfile *objfile = per_cu->
objfile;
16890 addr_base = cu->addr_base;
16911 static const char *
16914 struct objfile *objfile = dwarf2_per_objfile->objfile;
16916 bfd *abfd = objfile->
obfd;
16923 static const char form_name[] =
"DW_FORM_GNU_str_index";
16927 if (str_section->
buffer == NULL)
16928 error (
_(
"%s used without .debug_str.dwo section"
16929 " in CU at offset 0x%lx [in module %s]"),
16931 if (str_offsets_section->
buffer == NULL)
16932 error (
_(
"%s used without .debug_str_offsets.dwo section"
16933 " in CU at offset 0x%lx [in module %s]"),
16936 error (
_(
"%s pointing outside of .debug_str_offsets.dwo"
16937 " section in CU at offset 0x%lx [in module %s]"),
16939 info_ptr = (str_offsets_section->
buffer
16942 str_offset = bfd_get_32 (abfd, info_ptr);
16944 str_offset = bfd_get_64 (abfd, info_ptr);
16945 if (str_offset >= str_section->
size)
16946 error (
_(
"Offset from %s pointing outside of"
16947 " .debug_str.dwo section in CU at offset 0x%lx [in module %s]"),
16949 return (
const char *) (str_section->
buffer + str_offset);
16963 if ((byte & 128) == 0)
16964 return buf - begin;
16980 case DW_LANG_C_plus_plus:
16981 case DW_LANG_C_plus_plus_11:
16982 case DW_LANG_C_plus_plus_14:
16988 case DW_LANG_Fortran77:
16989 case DW_LANG_Fortran90:
16990 case DW_LANG_Fortran95:
16991 case DW_LANG_Fortran03:
16992 case DW_LANG_Fortran08:
16998 case DW_LANG_Mips_Assembler:
17004 case DW_LANG_Ada83:
17005 case DW_LANG_Ada95:
17008 case DW_LANG_Modula2:
17011 case DW_LANG_Pascal83:
17017 case DW_LANG_Cobol74:
17018 case DW_LANG_Cobol85:
17039 return &die->
attrs[i];
17040 if (die->
attrs[i].
name == DW_AT_specification
17041 || die->
attrs[i].
name == DW_AT_abstract_origin)
17042 spec = &die->
attrs[i];
17067 return &die->
attrs[i];
17095 &&
dwarf2_attr (die, DW_AT_specification, cu) == NULL);
17110 if (spec_attr == NULL)
17111 spec_attr =
dwarf2_attr (die, DW_AT_abstract_origin, *spec_cu);
17113 if (spec_attr == NULL)
17156 if (dwarf_line_debug >= 2)
17183 unsigned int dir_index,
17184 unsigned int mod_time,
17185 unsigned int length)
17189 if (dwarf_line_debug >= 2)
17227 section = &cu->dwo_unit->dwo_file->sections.line;
17232 section = &dwz->
line;
17235 section = &dwarf2_per_objfile->
line;
17256 unsigned int bytes_read, offset_size;
17258 const char *cur_dir, *cur_file;
17264 if (section->
buffer == NULL)
17279 if (offset + 4 >= section->
size)
17286 memset (lh, 0,
sizeof (*lh));
17298 &bytes_read, &offset_size);
17299 line_ptr += bytes_read;
17314 _(
"unsupported version in .debug_line section"));
17318 line_ptr += offset_size;
17333 _(
"invalid maximum_ops_per_instruction "
17334 "in `.debug_line' section"));
17358 line_ptr += bytes_read;
17361 line_ptr += bytes_read;
17366 unsigned int dir_index, mod_time, length;
17368 line_ptr += bytes_read;
17370 line_ptr += bytes_read;
17372 line_ptr += bytes_read;
17374 line_ptr += bytes_read;
17378 line_ptr += bytes_read;
17381 if (line_ptr > (section->
buffer + section->
size))
17383 _(
"line number info header doesn't "
17384 "fit in `.debug_line' section"));
17399 static const char *
17402 const char *comp_dir)
17405 const char *include_name = fe.
name;
17406 const char *include_name_to_compare = include_name;
17407 const char *dir_name = NULL;
17408 const char *pst_filename;
17409 char *copied_name = NULL;
17415 if (!IS_ABSOLUTE_PATH (include_name)
17416 && (dir_name != NULL || comp_dir != NULL))
17439 if (dir_name != NULL)
17442 include_name, (
char *)NULL);
17445 include_name = tem;
17446 include_name_to_compare = include_name;
17448 if (!IS_ABSOLUTE_PATH (include_name) && comp_dir != NULL)
17451 include_name, (
char *)NULL);
17454 include_name_to_compare = tem;
17459 if (!IS_ABSOLUTE_PATH (pst_filename) && pst->
dirname != NULL)
17462 pst_filename, (
char *)NULL);
17463 pst_filename = copied_name;
17466 file_is_pst = FILENAME_CMP (include_name_to_compare, pst_filename) == 0;
17468 if (copied_name != NULL)
17469 xfree (copied_name);
17473 return include_name;
17564 int line_has_non_zero_discriminator,
17565 struct subfile *last_subfile)
17569 if (line != last_line)
17574 if (!line_has_non_zero_discriminator)
17589 if (dwarf_line_debug)
17592 "Recording line %u, file %s, address %s\n",
17593 line, lbasename (subfile->
name),
17597 (*p_record_line) (subfile,
line, addr);
17609 if (subfile == NULL)
17612 if (dwarf_line_debug)
17615 "Finishing current line, file %s, address %s\n",
17616 lbasename (subfile->
name),
17631 unsigned int file,
line, discriminator;
17634 file = state->
file;
17635 line = state->
line;
17639 if (dwarf_line_debug)
17642 "Processing actual line %u: file %u,"
17643 " address %s, is_stmt %u, discrim %u\n",
17646 is_stmt, discriminator);
17654 else if (state->
op_index == 0 || end_sequence)
17688 memset (state, 0,
sizeof (*state));
17725 if (address == 0 && address < lowpc)
17730 struct objfile *objfile = cu->
objfile;
17734 _(
".debug_line address at offset 0x%lx is 0 [in module %s]"),
17749 const int decode_for_pst_p,
CORE_ADDR lowpc)
17751 const gdb_byte *line_ptr, *extended_end;
17753 unsigned int bytes_read, extended_len;
17754 unsigned char op_code, extended_op;
17756 struct objfile *objfile = cu->
objfile;
17757 bfd *abfd = objfile->
obfd;
17761 int record_lines_p = !decode_for_pst_p;
17770 reader_state.
gdbarch = gdbarch;
17775 while (line_ptr < line_end)
17779 int end_sequence = 0;
17791 const char *dir = NULL;
17800 while (line_ptr < line_end && !end_sequence)
17808 unsigned char adj_opcode;
17813 addr_adj = (((state_machine.
op_index
17823 state_machine.
line += line_delta;
17824 if (line_delta != 0)
17831 else switch (op_code)
17833 case DW_LNS_extended_op:
17836 line_ptr += bytes_read;
17837 extended_end = line_ptr + extended_len;
17840 switch (extended_op)
17842 case DW_LNE_end_sequence:
17846 case DW_LNE_set_address:
17851 line_ptr += bytes_read;
17855 address += baseaddr;
17860 case DW_LNE_define_file:
17862 const char *cur_file;
17867 line_ptr += bytes_read;
17870 line_ptr += bytes_read;
17873 line_ptr += bytes_read;
17876 line_ptr += bytes_read;
17880 case DW_LNE_set_discriminator:
17890 line_ptr += bytes_read;
17894 _(
"mangled .debug_line section"));
17900 if (line_ptr != extended_end)
17903 _(
"mangled .debug_line section"));
17911 case DW_LNS_advance_pc:
17917 addr_adj = (((state_machine.
op_index + adjust)
17924 line_ptr += bytes_read;
17927 case DW_LNS_advance_line:
17932 state_machine.
line += line_delta;
17933 if (line_delta != 0)
17936 line_ptr += bytes_read;
17939 case DW_LNS_set_file:
17945 const char *dir = NULL;
17949 line_ptr += bytes_read;
17950 if (state_machine.
file == 0
17958 if (record_lines_p)
17968 case DW_LNS_set_column:
17970 line_ptr += bytes_read;
17972 case DW_LNS_negate_stmt:
17975 case DW_LNS_set_basic_block:
17982 case DW_LNS_const_add_pc:
17987 addr_adj = (((state_machine.
op_index + adjust)
17996 case DW_LNS_fixed_advance_pc:
18015 line_ptr += bytes_read;
18063 struct objfile *objfile = cu->
objfile;
18064 const int decode_for_pst_p = (pst != NULL);
18066 if (decode_mapping)
18069 if (decode_for_pst_p)
18075 for (file_index = 0; file_index < lh->
num_file_names; file_index++)
18078 const char *include_name =
18080 if (include_name != NULL)
18094 const char *dir = NULL;
18147 if (!IS_ABSOLUTE_PATH (filename) && dirname != NULL)
18149 copy = concat (dirname,
SLASH_STRING, filename, (
char *)NULL);
18164 const char *name,
const char *comp_dir,
CORE_ADDR low_pc)
18175 cu->processing_has_namespace_info = 0;
18184 struct objfile *objfile = cu->
objfile;
18211 && ((
DW_BLOCK (attr)->data[0] == DW_OP_addr
18213 || (
DW_BLOCK (attr)->data[0] == DW_OP_GNU_addr_index
18217 unsigned int dummy;
18219 if (
DW_BLOCK (attr)->data[0] == DW_OP_addr)
18242 cu->has_loclist = 1;
18257 struct objfile *objfile = cu->
objfile;
18259 struct symbol *sym = NULL;
18264 struct pending **list_to_add = NULL;
18266 int inlined_func = (die->
tag == DW_TAG_inlined_subroutine);
18273 const char *linkagename;
18274 int suppress_add = 0;
18304 inlined_func ? DW_AT_call_line : DW_AT_decl_line,
18312 inlined_func ? DW_AT_call_file : DW_AT_decl_file,
18321 _(
"file index out of range"));
18322 else if (file_index > 0)
18348 case DW_TAG_subprogram:
18353 if ((attr2 && (
DW_UNSND (attr2) != 0))
18369 case DW_TAG_inlined_subroutine:
18376 case DW_TAG_template_value_param:
18379 case DW_TAG_constant:
18380 case DW_TAG_variable:
18381 case DW_TAG_member:
18392 if (die->
tag == DW_TAG_member)
18405 if (attr2 && (
DW_UNSND (attr2) != 0))
18421 && die->
parent->
tag == DW_TAG_common_block)
18426 && !dwarf2_per_objfile->has_section_at_zero)
18433 else if (attr2 && (
DW_UNSND (attr2) != 0))
18470 && die->
parent->
tag == DW_TAG_common_block)
18477 else if (attr2 && (
DW_UNSND (attr2) != 0)
18496 case DW_TAG_formal_parameter:
18518 case DW_TAG_unspecified_parameters:
18523 case DW_TAG_template_type_param:
18526 case DW_TAG_class_type:
18527 case DW_TAG_interface_type:
18528 case DW_TAG_structure_type:
18529 case DW_TAG_union_type:
18530 case DW_TAG_set_type:
18531 case DW_TAG_enumeration_type:
18568 case DW_TAG_typedef:
18573 case DW_TAG_base_type:
18574 case DW_TAG_subrange_type:
18579 case DW_TAG_enumerator:
18595 case DW_TAG_imported_declaration:
18596 case DW_TAG_namespace:
18600 case DW_TAG_module:
18605 case DW_TAG_common_block:
18624 list_to_add = NULL;
18627 if (list_to_add != NULL)
18632 if (!cu->processing_has_namespace_info
18659 struct objfile *objfile = cu->
objfile;
18660 enum bfd_endian byte_order = bfd_big_endian (objfile->
obfd) ?
18661 BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
18664 if (bits <
sizeof (*value) * 8)
18666 l &= ((
LONGEST) 1 << bits) - 1;
18669 else if (bits ==
sizeof (*value) * 8)
18673 gdb_byte *bytes = obstack_alloc (obstack, bits / 8);
18689 const char *name,
struct obstack *obstack,
18694 struct objfile *objfile = cu->
objfile;
18697 enum bfd_endian byte_order = (bfd_big_endian (objfile->
obfd) ?
18698 BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE);
18704 switch (attr->
form)
18707 case DW_FORM_GNU_addr_index:
18719 (*baton)->per_cu = cu->
per_cu;
18722 (*baton)->size = 2 + cu_header->
addr_size;
18723 data = obstack_alloc (obstack, (*baton)->size);
18724 (*baton)->data =
data;
18726 data[0] = DW_OP_addr;
18729 data[cu_header->
addr_size + 1] = DW_OP_stack_value;
18732 case DW_FORM_string:
18734 case DW_FORM_GNU_str_index:
18735 case DW_FORM_GNU_strp_alt:
18740 case DW_FORM_block1:
18741 case DW_FORM_block2:
18742 case DW_FORM_block4:
18743 case DW_FORM_block:
18744 case DW_FORM_exprloc:
18749 *bytes = blk->
data;
18757 case DW_FORM_data1:
18760 case DW_FORM_data2:
18763 case DW_FORM_data4:
18766 case DW_FORM_data8:
18770 case DW_FORM_sdata:
18774 case DW_FORM_udata:
18780 _(
"unsupported const value attribute form: '%s'"),
18794 struct objfile *objfile = cu->
objfile;
18803 &value, &bytes, &baton);
18810 else if (bytes != NULL)
18824 static struct type *
18861 static struct type *
18866 type_attr =
dwarf2_attr (die, DW_AT_GNAT_descriptive_type, cu);
18882 if (descriptive_type)
18892 static struct type *
18897 type_attr =
dwarf2_attr (die, DW_AT_containing_type, cu);
18899 error (
_(
"Dwarf Error: Problem turning containing type into gdb type "
18907 static struct type *
18910 struct objfile *objfile = dwarf2_per_objfile->objfile;
18911 char *message, *saved;
18913 message =
xstrprintf (
_(
"<unknown type in %s, CU 0x%x, DIE 0x%x>"),
18918 message, strlen (message));
18929 static struct type *
18933 struct objfile *objfile = cu->
objfile;
18934 struct type *this_type;
18937 || attr->
name == DW_AT_GNAT_descriptive_type
18938 || attr->
name == DW_AT_containing_type);
18942 if (attr->
form == DW_FORM_GNU_ref_alt)
18956 else if (attr->
form == DW_FORM_ref_sig8)
18965 _(
"Dwarf Error: Bad type attribute %s in DIE"
18966 " at 0x%x [in module %s]"),
18974 if (this_type == NULL)
18981 if (type_die == NULL)
18991 if (this_type == NULL)
19005 static struct type *
19008 struct type *this_type;
19020 static struct type *
19023 struct type *this_type = NULL;
19027 case DW_TAG_class_type:
19028 case DW_TAG_interface_type:
19029 case DW_TAG_structure_type:
19030 case DW_TAG_union_type:
19033 case DW_TAG_enumeration_type:
19036 case DW_TAG_subprogram:
19037 case DW_TAG_subroutine_type:
19038 case DW_TAG_inlined_subroutine:
19041 case DW_TAG_array_type:
19044 case DW_TAG_set_type:
19047 case DW_TAG_pointer_type:
19050 case DW_TAG_ptr_to_member_type:
19053 case DW_TAG_reference_type:
19056 case DW_TAG_const_type:
19059 case DW_TAG_volatile_type:
19062 case DW_TAG_restrict_type:
19065 case DW_TAG_string_type:
19068 case DW_TAG_typedef:
19071 case DW_TAG_subrange_type:
19074 case DW_TAG_base_type:
19077 case DW_TAG_unspecified_type:
19080 case DW_TAG_namespace:
19083 case DW_TAG_module:
19086 case DW_TAG_atomic_type:
19091 _(
"unexpected tag in read_type_die: '%s'"),
19116 if (spec_die != NULL)
19122 for (child = die->
child;
19126 if (child->
tag == DW_TAG_subprogram)
19130 attr =
dwarf2_attr (child, DW_AT_linkage_name, cu);
19132 attr =
dwarf2_attr (child, DW_AT_MIPS_linkage_name, cu);
19140 if (actual_name != NULL)
19144 if (die_name != NULL
19145 && strcmp (die_name, actual_name) != 0)
19149 int die_name_len = strlen (die_name);
19150 int actual_name_len = strlen (actual_name);
19153 if (actual_name_len > die_name_len + 2
19154 && actual_name[actual_name_len
19155 - die_name_len - 1] ==
':')
19159 actual_name_len - die_name_len - 2);
19162 xfree (actual_name);
19181 if (die->
tag != DW_TAG_class_type && die->
tag != DW_TAG_interface_type
19182 && die->
tag != DW_TAG_structure_type && die->
tag != DW_TAG_union_type)
19186 if (attr != NULL &&
DW_STRING (attr) != NULL)
19189 attr =
dwarf2_attr (die, DW_AT_linkage_name, cu);
19191 attr =
dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
19192 if (attr == NULL ||
DW_STRING (attr) == NULL)
19199 base = strrchr (
DW_STRING (attr),
':');
19200 if (base == NULL || base ==
DW_STRING (attr) || base[-1] !=
':')
19222 static const char *
19227 struct type *parent_type;
19260 if (spec_die == NULL)
19264 parent = spec_die->
parent;
19268 if (parent == NULL)
19273 const char *parent_name;
19307 _(
"template param type '%s' defined within parent '%s'"),
19308 name ? name :
"<unknown>",
19309 parent_name ? parent_name :
"<unknown>");
19313 switch (parent->
tag)
19315 case DW_TAG_namespace:
19325 case DW_TAG_class_type:
19326 case DW_TAG_interface_type:
19327 case DW_TAG_structure_type:
19328 case DW_TAG_union_type:
19329 case DW_TAG_module:
19338 case DW_TAG_compile_unit:
19339 case DW_TAG_partial_unit:
19343 && die->
child != NULL
19344 && (die->
tag == DW_TAG_class_type
19345 || die->
tag == DW_TAG_structure_type
19346 || die->
tag == DW_TAG_union_type))
19353 case DW_TAG_enumeration_type:
19373 #define MAX_SEP_LEN 7
19379 const char *lead =
"";
19382 if (suffix == NULL || suffix[0] ==
'\0'
19383 || prefix == NULL || prefix[0] ==
'\0')
19398 if (prefix == NULL)
19400 if (suffix == NULL)
19408 strcpy (retval, lead);
19409 strcat (retval, prefix);
19410 strcat (retval, sep);
19411 strcat (retval, suffix);
19417 return obconcat (obs, lead, prefix, sep, suffix, (
char *) NULL);
19431 static const char *
19433 struct obstack *obstack)
19439 if (canon_name != NULL)
19441 if (strcmp (canon_name, name) != 0)
19442 name = obstack_copy0 (obstack, canon_name, strlen (canon_name));
19443 xfree (canon_name);
19453 static const char *
19460 && die->
tag != DW_TAG_namespace
19461 && die->
tag != DW_TAG_class_type
19462 && die->
tag != DW_TAG_interface_type
19463 && die->
tag != DW_TAG_structure_type
19464 && die->
tag != DW_TAG_union_type)
19469 case DW_TAG_compile_unit:
19470 case DW_TAG_partial_unit:
19473 case DW_TAG_enumeration_type:
19474 case DW_TAG_enumerator:
19479 case DW_TAG_namespace:
19480 if (attr != NULL &&
DW_STRING (attr) != NULL)
19484 case DW_TAG_subprogram:
19489 && strcmp (
DW_STRING (attr),
"<init>") == 0)
19500 if (spec_die != NULL)
19506 if (die->
tag == DW_TAG_class_type)
19509 while (die->
tag != DW_TAG_compile_unit
19510 && die->
tag != DW_TAG_partial_unit);
19514 case DW_TAG_class_type:
19515 case DW_TAG_interface_type:
19516 case DW_TAG_structure_type:
19517 case DW_TAG_union_type:
19531 char *demangled = NULL;
19533 attr =
dwarf2_attr (die, DW_AT_linkage_name, cu);
19535 attr =
dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
19537 if (attr == NULL ||
DW_STRING (attr) == NULL)
19552 demangled, strlen (demangled));
19558 base = strrchr (
DW_STRING (attr),
':');
19559 if (base && base >
DW_STRING (attr) && base[-1] ==
':')
19590 attr =
dwarf2_attr (die, DW_AT_extension, *ext_cu);
19599 static const char *
19602 const char *name = get_DW_TAG_name (tag);
19605 return "DW_TAG_<unknown>";
19612 static const char *
19618 if (attr == DW_AT_MIPS_fde)
19619 return "DW_AT_MIPS_fde";
19621 if (attr == DW_AT_HP_block_index)
19622 return "DW_AT_HP_block_index";
19625 name = get_DW_AT_name (attr);
19628 return "DW_AT_<unknown>";
19635 static const char *
19638 const char *name = get_DW_FORM_name (form);
19641 return "DW_FORM_<unknown>";
19657 static const char *
19660 const char *name = get_DW_ATE_name (enc);
19663 return "DW_ATE_<unknown>";
19677 if (die->
parent != NULL)
19701 case DW_FORM_GNU_addr_index:
19705 case DW_FORM_block2:
19706 case DW_FORM_block4:
19707 case DW_FORM_block:
19708 case DW_FORM_block1:
19712 case DW_FORM_exprloc:
19716 case DW_FORM_ref_addr:
19720 case DW_FORM_GNU_ref_alt:
19728 case DW_FORM_ref_udata:
19732 case DW_FORM_data1:
19733 case DW_FORM_data2:
19734 case DW_FORM_data4:
19735 case DW_FORM_data8:
19736 case DW_FORM_udata:
19737 case DW_FORM_sdata:
19741 case DW_FORM_sec_offset:
19745 case DW_FORM_ref_sig8:
19749 case DW_FORM_string:
19751 case DW_FORM_GNU_str_index:
19752 case DW_FORM_GNU_strp_alt:
19764 case DW_FORM_flag_present:
19767 case DW_FORM_indirect:
19771 "unexpected attribute form: DW_FORM_indirect");
19791 int indent = level * 4;
19795 if (level >= max_level)
19800 if (die->
child != NULL)
19804 if (level + 1 < max_level)
19812 " [not printed, max nesting level reached]\n");
19816 if (die->
sibling != NULL && level > 0)
19855 _(
"unsupported die ref attribute form: '%s'"),
19866 if (attr->
form == DW_FORM_sdata)
19868 else if (attr->
form == DW_FORM_udata
19869 || attr->
form == DW_FORM_data1
19870 || attr->
form == DW_FORM_data2
19871 || attr->
form == DW_FORM_data4
19872 || attr->
form == DW_FORM_data8)
19877 _(
"Attribute value is not a constant (%s)"),
19879 return default_value;
19895 else if (attr->
form == DW_FORM_ref_sig8)
19900 error (
_(
"Dwarf Error: Expected reference attribute [in module %s]"),
19917 struct dwarf2_cu *target_cu, *cu = *ref_cu;
19943 target_cu = per_cu->
cu;
19945 else if (cu->
dies == NULL)
19948 gdb_assert (dwarf2_per_objfile->reading_partial_symbols);
19952 *ref_cu = target_cu;
19954 return htab_find_with_hash (target_cu->
die_hash, &temp_die, offset.
sect_off);
19970 (attr->
form == DW_FORM_GNU_ref_alt
19974 error (
_(
"Dwarf Error: Cannot find DIE at 0x%x referenced from DIE "
19975 "at 0x%x [in module %s]"),
19999 if (per_cu->cu == NULL)
20005 error (
_(
"Dwarf Error: Cannot find DIE at 0x%x referenced in module %s"),
20014 retval.
data = NULL;
20020 CORE_ADDR pc = (*get_frame_pc) (baton);
20032 error (
_(
"Dwarf Error: DIE at 0x%x referenced in module %s "
20033 "is neither DW_FORM_block* nor DW_FORM_exprloc"),
20055 sect_offset offset = { per_cu->offset.sect_off + offset_in_cu.cu_off };
20065 enum bfd_endian byte_order,
20073 result = obstack_alloc (obstack, *len);
20087 struct obstack *obstack,
20096 enum bfd_endian byte_order;
20100 if (per_cu->
cu == NULL)
20106 error (
_(
"Dwarf Error: Cannot find DIE at 0x%x referenced in module %s"),
20114 byte_order = (bfd_big_endian (per_cu->
objfile->
obfd)
20115 ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE);
20117 switch (attr->
form)
20120 case DW_FORM_GNU_addr_index:
20125 tem = obstack_alloc (obstack, *len);
20130 case DW_FORM_string:
20132 case DW_FORM_GNU_str_index:
20133 case DW_FORM_GNU_strp_alt:
20139 case DW_FORM_block1:
20140 case DW_FORM_block2:
20141 case DW_FORM_block4:
20142 case DW_FORM_block:
20143 case DW_FORM_exprloc:
20153 case DW_FORM_data1:
20156 if (result == NULL)
20160 case DW_FORM_data2:
20163 if (result == NULL)
20167 case DW_FORM_data4:
20170 if (result == NULL)
20174 case DW_FORM_data8:
20177 if (result == NULL)
20182 case DW_FORM_sdata:
20185 type,
DW_SND (attr), len);
20188 case DW_FORM_udata:
20196 _(
"unsupported const value attribute form: '%s'"),
20228 struct objfile *objfile = (*ref_cu)->objfile;
20246 die = htab_find_with_hash (sig_cu->
die_hash, &temp_die,
20252 if (dwarf2_per_objfile->index_table != NULL
20253 && dwarf2_per_objfile->index_table->version <= 7)
20256 (*ref_cu)->per_cu->imported_symtabs,
20286 if (sig_type == NULL)
20288 error (
_(
"Dwarf Error: Cannot find signatured DIE %s referenced"
20289 " from DIE at 0x%x [in module %s]"),
20298 error (
_(
"Dwarf Error: Problem reading signatured DIE %s referenced"
20299 " from DIE at 0x%x [in module %s]"),
20310 static struct type *
20322 if (sig_type == NULL)
20325 _(
"Dwarf Error: Cannot find signatured DIE %s referenced"
20326 " from DIE at 0x%x [in module %s]"),
20333 if (sig_type->
type != NULL)
20334 return sig_type->
type;
20338 if (type_die != NULL)
20347 _(
"Dwarf Error: Cannot build signatured type %s"
20348 " referenced from DIE at 0x%x [in module %s]"),
20357 _(
"Dwarf Error: Problem reading signatured DIE %s referenced"
20358 " from DIE at 0x%x [in module %s]"),
20371 static struct type *
20383 else if (attr->
form == DW_FORM_ref_sig8)
20390 _(
"Dwarf Error: DW_AT_signature has bad form %s in DIE"
20391 " at 0x%x [in module %s]"),
20445 &info_ptr, comp_unit_die);
20446 cu->
dies = comp_unit_die;
20499 struct objfile *objfile = cu->
objfile;
20505 unsigned int bytes_read, unsnd;
20511 stack[++stacki] = 0;
20550 stack[++stacki] = op - DW_OP_lit0;
20585 stack[++stacki] = op - DW_OP_reg0;
20593 stack[++stacki] = unsnd;
20604 case DW_OP_const1u:
20609 case DW_OP_const1s:
20614 case DW_OP_const2u:
20619 case DW_OP_const2s:
20624 case DW_OP_const4u:
20629 case DW_OP_const4s:
20634 case DW_OP_const8u:
20651 stack[stacki + 1] = stack[stacki];
20656 stack[stacki - 1] += stack[stacki];
20660 case DW_OP_plus_uconst:
20667 stack[stacki - 1] -= stack[stacki];
20680 case DW_OP_GNU_push_tls_address:
20694 case DW_OP_GNU_uninit:
20697 case DW_OP_GNU_addr_index:
20698 case DW_OP_GNU_const_index:
20706 const char *name = get_DW_OP_name (op);
20716 return (stack[stacki]);
20721 if (stacki >= ARRAY_SIZE (stack) - 1)
20724 _(
"location description stack overflow"));
20731 _(
"location description stack underflow"));
20735 return (stack[stacki]);
20757 size += (num_attrs - 1) *
sizeof (
struct attribute);
20760 memset (die, 0,
sizeof (
struct die_info));
20776 if (1 <= file && file <= lh->num_file_names)
20782 return xstrdup (fe->
name);
20791 char fake_name[80];
20793 xsnprintf (fake_name,
sizeof (fake_name),
20794 "<bad macro file number %d>", file);
20797 _(
"bad file number in macro information (%d)"),
20800 return xstrdup (fake_name);
20813 if (1 <= file && file <= lh->num_file_names)
20817 if (IS_ABSOLUTE_PATH (relative) || comp_dir == NULL)
20819 return reconcat (relative, comp_dir,
SLASH_STRING, relative, NULL);
20834 if (! current_file)
20846 current_file =
macro_include (current_file, line, file_name);
20850 return current_file;
20861 memcpy (s, buf, len);
20867 static const char *
20873 _(
"macro definition contains spaces "
20874 "in formal argument list:\n`%s'"),
20918 for (p = body; *p; p++)
20919 if (*p ==
' ' || *p ==
'(')
20922 if (*p ==
' ' || *p ==
'\0')
20925 int name_len = p - body;
20927 const char *replacement;
20930 replacement = body + name_len + 1;
20934 replacement = body + name_len;
20941 else if (*p ==
'(')
20947 char **argv =
xmalloc (argv_size *
sizeof (*argv));
20954 while (*p && *p !=
')')
20957 const char *arg_start = p;
20959 while (*p && *p !=
',' && *p !=
')' && *p !=
' ')
20962 if (! *p || p == arg_start)
20967 if (argc >= argv_size)
20970 argv =
xrealloc (argv, argv_size *
sizeof (*argv));
20973 argv[argc++] =
copy_string (arg_start, p - arg_start);
20994 argc, (
const char **) argv,
20996 else if (*p ==
'\0')
21001 argc, (
const char **) argv,
21016 for (i = 0; i < argc; i++)
21030 enum dwarf_form form,
21031 unsigned int offset_size,
21034 unsigned int bytes_read;
21038 case DW_FORM_data1:
21043 case DW_FORM_data2:
21047 case DW_FORM_data4:
21051 case DW_FORM_data8:
21055 case DW_FORM_string:
21057 bytes += bytes_read;
21060 case DW_FORM_sec_offset:
21062 case DW_FORM_GNU_strp_alt:
21063 bytes += offset_size;
21066 case DW_FORM_block:
21068 bytes += bytes_read;
21071 case DW_FORM_block1:
21074 case DW_FORM_block2:
21077 case DW_FORM_block4:
21081 case DW_FORM_sdata:
21082 case DW_FORM_udata:
21083 case DW_FORM_GNU_addr_index:
21084 case DW_FORM_GNU_str_index:
21097 _(
"invalid form 0x%x in `%s'"),
21112 const gdb_byte **opcode_definitions,
21115 unsigned int offset_size,
21118 unsigned int bytes_read, i;
21122 if (opcode_definitions[opcode] == NULL)
21125 _(
"unrecognized DW_MACFINO opcode 0x%x"),
21130 defn = opcode_definitions[opcode];
21132 defn += bytes_read;
21134 for (i = 0; i < arg; ++i)
21136 mac_ptr =
skip_form_bytes (abfd, mac_ptr, mac_end, defn[i], offset_size,
21138 if (mac_ptr == NULL)
21157 unsigned int *offset_size,
21158 int section_is_gnu)
21160 memset (opcode_definitions, 0, 256 *
sizeof (
gdb_byte *));
21162 if (section_is_gnu)
21170 _(
"unrecognized version `%d' in .debug_macro section"),
21178 *offset_size = (flags & 1) ? 8 : 4;
21180 if ((flags & 2) != 0)
21182 mac_ptr += *offset_size;
21185 if ((flags & 4) != 0)
21187 unsigned int i, count;
21191 for (i = 0; i < count; ++i)
21193 unsigned int opcode, bytes_read;
21198 opcode_definitions[opcode] = mac_ptr;
21200 mac_ptr += bytes_read;
21218 int section_is_gnu,
int section_is_dwz,
21219 unsigned int offset_size,
21220 htab_t include_hash)
21222 struct objfile *objfile = dwarf2_per_objfile->objfile;
21223 enum dwarf_macro_record_type macinfo_type;
21224 int at_commandline;
21225 const gdb_byte *opcode_definitions[256];
21228 &offset_size, section_is_gnu);
21229 if (mac_ptr == NULL)
21242 at_commandline = 1;
21247 if (mac_ptr >= mac_end)
21258 switch (macinfo_type)
21265 case DW_MACRO_GNU_define:
21266 case DW_MACRO_GNU_undef:
21267 case DW_MACRO_GNU_define_indirect:
21268 case DW_MACRO_GNU_undef_indirect:
21269 case DW_MACRO_GNU_define_indirect_alt:
21270 case DW_MACRO_GNU_undef_indirect_alt:
21272 unsigned int bytes_read;
21278 mac_ptr += bytes_read;
21280 if (macinfo_type == DW_MACRO_GNU_define
21281 || macinfo_type == DW_MACRO_GNU_undef)
21284 mac_ptr += bytes_read;
21291 mac_ptr += offset_size;
21293 if (macinfo_type == DW_MACRO_GNU_define_indirect_alt
21294 || macinfo_type == DW_MACRO_GNU_undef_indirect_alt
21305 is_define = (macinfo_type == DW_MACRO_GNU_define
21306 || macinfo_type == DW_MACRO_GNU_define_indirect
21307 || macinfo_type == DW_MACRO_GNU_define_indirect_alt);
21308 if (! current_file)
21312 _(
"debug info with no main source gives macro %s "
21314 is_define ?
_(
"definition") :
_(
"undefinition"),
21318 if ((line == 0 && !at_commandline)
21319 || (line != 0 && at_commandline))
21321 _(
"debug info gives %s macro %s with %s line %d: %s"),
21322 at_commandline ?
_(
"command-line") :
_(
"in-file"),
21323 is_define ?
_(
"definition") :
_(
"undefinition"),
21324 line == 0 ?
_(
"zero") :
_(
"non-zero"), line, body);
21330 gdb_assert (macinfo_type == DW_MACRO_GNU_undef
21331 || macinfo_type == DW_MACRO_GNU_undef_indirect
21332 || macinfo_type == DW_MACRO_GNU_undef_indirect_alt);
21338 case DW_MACRO_GNU_start_file:
21340 unsigned int bytes_read;
21344 mac_ptr += bytes_read;
21346 mac_ptr += bytes_read;
21348 if ((line == 0 && !at_commandline)
21349 || (line != 0 && at_commandline))
21351 _(
"debug info gives source %d included "
21352 "from %s at %s line %d"),
21353 file, at_commandline ?
_(
"command-line") :
_(
"file"),
21354 line == 0 ?
_(
"zero") :
_(
"non-zero"), line);
21356 if (at_commandline)
21360 at_commandline = 0;
21367 case DW_MACRO_GNU_end_file:
21368 if (! current_file)
21370 _(
"macro debug info has an unmatched "
21371 "`close_file' directive"));
21375 if (! current_file)
21377 enum dwarf_macro_record_type next_type;
21385 if (mac_ptr >= mac_end)
21394 if (next_type != 0)
21396 _(
"no terminating 0-type entry for "
21397 "macros in `.debug_macinfo' section"));
21404 case DW_MACRO_GNU_transparent_include:
21405 case DW_MACRO_GNU_transparent_include_alt:
21409 bfd *include_bfd = abfd;
21412 const gdb_byte *include_mac_end = mac_end;
21413 int is_dwz = section_is_dwz;
21417 mac_ptr += offset_size;
21419 if (macinfo_type == DW_MACRO_GNU_transparent_include_alt)
21425 include_section = &dwz->
macro;
21432 slot = htab_find_slot (include_hash, new_mac_ptr, INSERT);
21439 _(
"recursive DW_MACRO_GNU_transparent_include in "
21440 ".debug_macro section"));
21444 *slot = (
void *) new_mac_ptr;
21447 include_mac_end, current_file, lh,
21448 section, section_is_gnu, is_dwz,
21449 offset_size, include_hash);
21451 htab_remove_elt (include_hash, (
void *) new_mac_ptr);
21456 case DW_MACINFO_vendor_ext:
21457 if (!section_is_gnu)
21459 unsigned int bytes_read;
21463 mac_ptr += bytes_read;
21465 mac_ptr += bytes_read;
21474 mac_ptr, mac_end, abfd, offset_size,
21476 if (mac_ptr == NULL)
21480 }
while (macinfo_type != 0);
21485 int section_is_gnu)
21487 struct objfile *objfile = dwarf2_per_objfile->objfile;
21490 const gdb_byte *mac_ptr, *mac_end;
21492 enum dwarf_macro_record_type macinfo_type;
21494 const gdb_byte *opcode_definitions[256];
21496 htab_t include_hash;
21499 const char *section_name;
21501 if (cu->dwo_unit != NULL)
21503 if (section_is_gnu)
21505 section = &cu->dwo_unit->dwo_file->sections.macro;
21506 section_name =
".debug_macro.dwo";
21510 section = &cu->dwo_unit->dwo_file->sections.macinfo;
21511 section_name =
".debug_macinfo.dwo";
21516 if (section_is_gnu)
21518 section = &dwarf2_per_objfile->
macro;
21519 section_name =
".debug_macro";
21523 section = &dwarf2_per_objfile->
macinfo;
21524 section_name =
".debug_macinfo";
21529 if (section->
buffer == NULL)
21551 &offset_size, section_is_gnu);
21552 if (mac_ptr == NULL)
21561 if (mac_ptr >= mac_end)
21574 switch (macinfo_type)
21581 case DW_MACRO_GNU_define:
21582 case DW_MACRO_GNU_undef:
21585 unsigned int bytes_read;
21588 mac_ptr += bytes_read;
21590 mac_ptr += bytes_read;
21594 case DW_MACRO_GNU_start_file:
21596 unsigned int bytes_read;
21600 mac_ptr += bytes_read;
21602 mac_ptr += bytes_read;
21608 case DW_MACRO_GNU_end_file:
21612 case DW_MACRO_GNU_define_indirect:
21613 case DW_MACRO_GNU_undef_indirect:
21614 case DW_MACRO_GNU_define_indirect_alt:
21615 case DW_MACRO_GNU_undef_indirect_alt:
21617 unsigned int bytes_read;
21620 mac_ptr += bytes_read;
21621 mac_ptr += offset_size;
21625 case DW_MACRO_GNU_transparent_include:
21626 case DW_MACRO_GNU_transparent_include_alt:
21630 mac_ptr += offset_size;
21633 case DW_MACINFO_vendor_ext:
21635 if (!section_is_gnu)
21637 unsigned int bytes_read;
21640 mac_ptr += bytes_read;
21642 mac_ptr += bytes_read;
21648 mac_ptr, mac_end, abfd, offset_size,
21650 if (mac_ptr == NULL)
21654 }
while (macinfo_type != 0 && current_file == NULL);
21662 include_hash = htab_create_alloc (1, htab_hash_pointer, htab_eq_pointer,
21666 slot = htab_find_slot (include_hash, mac_ptr, INSERT);
21667 *slot = (
void *) mac_ptr;
21669 current_file, lh, section,
21670 section_is_gnu, 0, offset_size, include_hash);
21680 return (attr == NULL ? 0 :
21681 attr->
form == DW_FORM_block1
21682 || attr->
form == DW_FORM_block2
21683 || attr->
form == DW_FORM_block4
21684 || attr->
form == DW_FORM_block
21685 || attr->
form == DW_FORM_exprloc);
21700 return (attr->
form == DW_FORM_data4
21701 || attr->
form == DW_FORM_data8
21702 || attr->
form == DW_FORM_sec_offset);
21721 switch (attr->
form)
21723 case DW_FORM_sdata:
21724 case DW_FORM_udata:
21725 case DW_FORM_data1:
21726 case DW_FORM_data2:
21727 case DW_FORM_data4:
21728 case DW_FORM_data8:
21742 switch (attr->
form)
21744 case DW_FORM_ref_addr:
21749 case DW_FORM_ref_udata:
21750 case DW_FORM_GNU_ref_alt:
21764 return &cu->dwo_unit->dwo_file->sections.loc;
21765 return &dwarf2_per_objfile->
loc;
21786 baton->
from_dwo = cu->dwo_unit != NULL;
21793 struct objfile *objfile = dwarf2_per_objfile->objfile;
21811 _(
"Location list used without "
21812 "specifying the CU base address."));
21815 ? dwarf2_loclist_block_index
21846 ? dwarf2_locexpr_block_index
21859 struct objfile *objfile = per_cu->
objfile;
21884 memset (cu_headerp, 0,
sizeof (*cu_headerp));
21926 if (cu_headerp->
version == 2)
21940 struct objfile *objfile = per_cu->
objfile;
21950 unsigned int offset_in_dwz,
21951 struct objfile *objfile)
21958 high = dwarf2_per_objfile->n_comp_units - 1;
21962 int mid = low + (high - low) / 2;
21964 mid_cu = dwarf2_per_objfile->all_comp_units[mid];
21965 cu_off = &mid_cu->offset;
21966 if (mid_cu->is_dwz > offset_in_dwz
21967 || (mid_cu->is_dwz == offset_in_dwz
21974 this_cu = dwarf2_per_objfile->all_comp_units[low];
21975 cu_off = &this_cu->
offset;
21978 if (low == 0 || this_cu->
is_dwz != offset_in_dwz)
21979 error (
_(
"Dwarf Error: could not find partial DIE containing "
21980 "offset 0x%lx [in module %s]"),
21981 (
long) offset.
sect_off, bfd_get_filename (objfile->
obfd));
21983 gdb_assert (dwarf2_per_objfile->all_comp_units[low-1]->offset.sect_off
21985 return dwarf2_per_objfile->all_comp_units[low-1];
21989 this_cu = dwarf2_per_objfile->all_comp_units[low];
21990 if (low == dwarf2_per_objfile->n_comp_units - 1
22003 memset (cu, 0,
sizeof (*cu));
22019 attr =
dwarf2_attr (comp_unit_die, DW_AT_language, cu);
22028 attr =
dwarf2_attr (comp_unit_die, DW_AT_producer, cu);
22077 per_cu = dwarf2_per_objfile->read_in_chain;
22078 last_chain = &dwarf2_per_objfile->read_in_chain;
22079 while (per_cu != NULL)
22086 *last_chain = next_cu;
22101 per_cu = dwarf2_per_objfile->read_in_chain;
22102 while (per_cu != NULL)
22105 if (per_cu->
cu->
last_used <= dwarf_max_cache_age)
22110 per_cu = dwarf2_per_objfile->read_in_chain;
22111 last_chain = &dwarf2_per_objfile->read_in_chain;
22112 while (per_cu != NULL)
22118 if (!per_cu->
cu->mark)
22121 *last_chain = next_cu;
22137 per_cu = dwarf2_per_objfile->read_in_chain;
22138 last_chain = &dwarf2_per_objfile->read_in_chain;
22139 while (per_cu != NULL)
22145 if (per_cu == target_per_cu)
22149 *last_chain = next_cu;
22164 dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
22166 if (dwarf2_per_objfile == NULL)
22172 if (dwarf2_per_objfile->quick_file_names_table)
22173 htab_delete (dwarf2_per_objfile->quick_file_names_table);
22175 if (dwarf2_per_objfile->line_header_hash)
22176 htab_delete (dwarf2_per_objfile->line_header_hash);
22242 static struct type *
22246 struct objfile *objfile = cu->
objfile;
22267 attr =
dwarf2_attr (die, DW_AT_data_location, cu);
22271 if (dwarf2_per_objfile->die_type_hash == NULL)
22273 dwarf2_per_objfile->die_type_hash =
22274 htab_create_alloc_ex (127,
22287 htab_find_slot (dwarf2_per_objfile->die_type_hash, &ofs, INSERT);
22290 _(
"A problem internal to GDB: DIE 0x%x has type already set"),
22300 static struct type *
22306 if (dwarf2_per_objfile->die_type_hash == NULL)
22311 slot = htab_find (dwarf2_per_objfile->die_type_hash, &ofs);
22321 static struct type *
22337 = htab_create_alloc_ex (5, htab_hash_pointer, htab_eq_pointer,
22342 slot = htab_find_slot (cu->
dependencies, ref_per_cu, INSERT);
22344 *slot = ref_per_cu;
22361 if (per_cu->
cu == NULL)
22364 if (per_cu->
cu->mark)
22366 per_cu->
cu->mark = 1;
22392 per_cu->
cu->mark = 0;
22441 struct dwarf2_per_objfile *data = d;
22446 dwarf2_per_objfile = NULL;
22448 for (ix = 0; ix < data->n_comp_units; ++ix)
22449 VEC_free (dwarf2_per_cu_ptr, data->all_comp_units[ix]->imported_symtabs);
22451 for (ix = 0; ix < data->n_type_units; ++ix)
22453 data->all_type_units[ix]->per_cu.imported_symtabs);
22454 xfree (data->all_type_units);
22458 if (data->dwo_files)
22460 if (data->dwp_file)
22463 if (data->dwz_file && data->dwz_file->dwz_bfd)
22497 return !strcmp (ea->
str, eb->
str);
22520 slot = htab_find_slot (table, &entry, INSERT);
22526 result->
offset = obstack_object_size (cpool);
22543 VEC (offset_type) *cu_indices;
22560 return iterative_hash (
VEC_address (offset_type, entry->cu_indices),
22561 sizeof (offset_type) *
VEC_length (offset_type,
22562 entry->cu_indices),
22574 if (len !=
VEC_length (offset_type, eb->cu_indices))
22576 return !memcmp (
VEC_address (offset_type, ea->cu_indices),
22578 sizeof (offset_type) * len);
22587 VEC_free (offset_type, entry->cu_indices);
22607 symtab->
size = 1024;
22635 index = hash & (symtab->
size - 1);
22636 step = ((hash * 17) & (symtab->
size - 1)) | 1;
22640 if (!symtab->
data[index] || !strcmp (name, symtab->
data[index]->
name))
22641 return &symtab->
data[index];
22642 index = (index + step) & (symtab->
size - 1);
22651 offset_type old_size = symtab->
size;
22658 for (i = 0; i < old_size; ++i)
22660 if (old_entries[i])
22663 old_entries[i]->name);
22664 *slot = old_entries[i];
22668 xfree (old_entries);
22677 int is_static, gdb_index_symbol_kind kind,
22678 offset_type cu_index)
22681 offset_type cu_index_and_attrs;
22691 (*slot)->name =
name;
22693 (*slot)->cu_indices = NULL;
22696 cu_index_and_attrs = 0;
22708 VEC_safe_push (offset_type, (*slot)->cu_indices, cu_index_and_attrs);
22716 offset_type a = *(offset_type *) ap;
22717 offset_type b = *(offset_type *) bp;
22719 return (a > b) - (b > a);
22729 for (i = 0; i < symtab->
size; ++i)
22734 && entry->cu_indices != NULL)
22736 unsigned int next_to_insert, next_to_check;
22737 offset_type last_value;
22740 VEC_length (offset_type, entry->cu_indices),
22743 last_value =
VEC_index (offset_type, entry->cu_indices, 0);
22744 next_to_insert = 1;
22745 for (next_to_check = 1;
22746 next_to_check <
VEC_length (offset_type, entry->cu_indices);
22749 if (
VEC_index (offset_type, entry->cu_indices, next_to_check)
22752 last_value =
VEC_index (offset_type, entry->cu_indices,
22754 VEC_replace (offset_type, entry->cu_indices, next_to_insert,
22759 VEC_truncate (offset_type, entry->cu_indices, next_to_insert);
22772 slot = htab_find_slot (symbol_hash_table, entry, INSERT);
22775 offset_type
len =
VEC_length (offset_type, entry->cu_indices);
22783 obstack_grow (cpool, &val,
sizeof (val));
22785 VEC_iterate (offset_type, entry->cu_indices, i, iter);
22789 obstack_grow (cpool, &val,
sizeof (val));
22806 struct obstack *output,
struct obstack *cpool)
22809 htab_t symbol_hash_table;
22817 for (i = 0; i < symtab->
size; ++i)
22819 if (symtab->
data[i])
22824 for (i = 0; i < symtab->
size; ++i)
22826 offset_type str_off, vec_off;
22828 if (symtab->
data[i])
22844 obstack_grow (output, &str_off,
sizeof (str_off));
22845 obstack_grow (output, &vec_off,
sizeof (vec_off));
22848 htab_delete (str_table);
22849 htab_delete (symbol_hash_table);
22864 return htab_hash_pointer (map->
psymtab);
22899 offset_type cu_index_to_write;
22906 obstack_grow (obstack, addr, 8);
22908 obstack_grow (obstack, addr, 8);
22910 obstack_grow (obstack, &cu_index_to_write,
sizeof (offset_type));
22948 htab_t cu_index_htab)
22962 &addrmap_index_data);
22977 static gdb_index_symbol_kind
22989 return GDB_INDEX_SYMBOL_KIND_FUNCTION;
22991 return GDB_INDEX_SYMBOL_KIND_TYPE;
22996 return GDB_INDEX_SYMBOL_KIND_VARIABLE;
23000 return GDB_INDEX_SYMBOL_KIND_VARIABLE;
23004 return GDB_INDEX_SYMBOL_KIND_OTHER;
23007 return GDB_INDEX_SYMBOL_KIND_TYPE;
23009 return GDB_INDEX_SYMBOL_KIND_OTHER;
23020 offset_type cu_index,
23023 for (; count-- > 0; ++psymp)
23029 error (
_(
"Ada is not currently supported by the index"));
23032 slot = htab_find_slot (psyms_seen, psym, INSERT);
23039 is_static, kind, cu_index);
23050 if (fwrite (obstack_base (obstack), 1, obstack_object_size (obstack),
23052 != obstack_object_size (obstack))
23053 error (
_(
"couldn't data write to file"));
23061 char **filename = p;
23063 unlink (*filename);
23122 offset_type cu_index)
23129 symtab, psyms_seen, cu_index);
23149 char *filename, *cleanup_filename;
23150 struct obstack contents, addr_obstack, constant_pool, symtab_obstack;
23151 struct obstack cu_list, types_cu_list;
23155 offset_type val, size_of_contents, total_len;
23158 htab_t cu_index_htab;
23161 if (dwarf2_per_objfile->using_index)
23162 error (
_(
"Cannot use an index to create the index"));
23165 error (
_(
"Cannot make an index when the file has multiple .debug_types sections"));
23179 error (
_(
"Can't open `%s' for writing"), filename);
23181 cleanup_filename = filename;
23187 obstack_init (&addr_obstack);
23190 obstack_init (&cu_list);
23193 obstack_init (&types_cu_list);
23196 psyms_seen = htab_create_alloc (100, htab_hash_pointer, htab_eq_pointer,
23204 cu_index_htab = htab_create_alloc (100,
23209 psymtab_cu_index_map = (
struct psymtab_cu_index_map *)
23210 xmalloc (
sizeof (
struct psymtab_cu_index_map)
23211 * dwarf2_per_objfile->n_comp_units);
23217 for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
23220 = dwarf2_per_objfile->all_comp_units[i];
23223 struct psymtab_cu_index_map *map;
23229 if (psymtab == NULL)
23232 if (psymtab->
user == NULL)
23235 map = &psymtab_cu_index_map[i];
23238 slot = htab_find_slot (cu_index_htab, map, INSERT);
23245 obstack_grow (&cu_list, val, 8);
23247 obstack_grow (&cu_list, val, 8);
23254 if (dwarf2_per_objfile->signatured_types)
23262 sig_data.
cu_index = dwarf2_per_objfile->n_comp_units;
23263 htab_traverse_noresize (dwarf2_per_objfile->signatured_types,
23271 obstack_init (&constant_pool);
23273 obstack_init (&symtab_obstack);
23277 obstack_init (&contents);
23280 total_len = size_of_contents;
23284 obstack_grow (&contents, &val,
sizeof (val));
23288 obstack_grow (&contents, &val,
sizeof (val));
23289 total_len += obstack_object_size (&cu_list);
23293 obstack_grow (&contents, &val,
sizeof (val));
23294 total_len += obstack_object_size (&types_cu_list);
23298 obstack_grow (&contents, &val,
sizeof (val));
23299 total_len += obstack_object_size (&addr_obstack);
23303 obstack_grow (&contents, &val,
sizeof (val));
23304 total_len += obstack_object_size (&symtab_obstack);
23308 obstack_grow (&contents, &val,
sizeof (val));
23309 total_len += obstack_object_size (&constant_pool);
23311 gdb_assert (obstack_object_size (&contents) == size_of_contents);
23324 cleanup_filename = NULL;
23337 struct objfile *objfile;
23340 error (
_(
"usage: save gdb-index DIRECTORY"));
23350 dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
23351 if (dwarf2_per_objfile)
23361 _(
"Error while writing index for `%s': "),
23378 _(
"Whether to always disassemble "
23379 "DWARF expressions is %s.\n"),
23388 _(
"Whether to check \"physname\" is %s.\n"),
23399 dwarf2_objfile_data_key
23403 Set DWARF specific variables.\n\
23404 Configure DWARF variables such as the cache size"),
23405 &set_dwarf_cmdlist,
"maintenance set dwarf ",
23409 Show DWARF specific variables\n\
23410 Show DWARF variables such as the cache size"),
23411 &show_dwarf_cmdlist,
"maintenance show dwarf ",
23415 &dwarf_max_cache_age,
_(
"\
23416 Set the upper bound on the age of cached DWARF compilation units."),
_(
"\
23417 Show the upper bound on the age of cached DWARF compilation units."),
_(
"\
23418 A higher limit means that cached compilation units will be stored\n\
23419 in memory longer, and more total memory will be used. Zero disables\n\
23420 caching, which can slow down startup."),
23423 &set_dwarf_cmdlist,
23424 &show_dwarf_cmdlist);
23427 &dwarf_always_disassemble,
_(
"\
23428 Set whether `info address' always disassembles DWARF expressions."),
_(
"\
23429 Show whether `info address' always disassembles DWARF expressions."),
_(
"\
23430 When enabled, DWARF expressions are always printed in an assembly-like\n\
23431 syntax. When disabled, expressions will be printed in a more\n\
23432 conversational style, when possible."),
23435 &set_dwarf_cmdlist,
23436 &show_dwarf_cmdlist);
23439 Set debugging of the DWARF reader."),
_(
"\
23440 Show debugging of the DWARF reader."),
_(
"\
23441 When enabled (non-zero), debugging messages are printed during DWARF\n\
23442 reading and symtab expansion. A value of 1 (one) provides basic\n\
23443 information. A value greater than 1 provides more verbose information."),
23449 Set debugging of the DWARF DIE reader."),
_(
"\
23450 Show debugging of the DWARF DIE reader."),
_(
"\
23451 When enabled (non-zero), DIEs are dumped after they are read in.\n\
23452 The value is the maximum depth to print."),
23458 Set debugging of the dwarf line reader."),
_(
"\
23459 Show debugging of the dwarf line reader."),
_(
"\
23460 When enabled (non-zero), line number entries are dumped as they are read in.\n\
23461 A value of 1 (one) provides basic information.\n\
23462 A value greater than 1 provides more verbose information."),
23468 Set cross-checking of \"physname\" code against demangler."),
_(
"\
23469 Show cross-checking of \"physname\" code against demangler."),
_(
"\
23470 When enabled, GDB's internal \"physname\" code is checked against\n\
23476 no_class, &use_deprecated_index_sections,
_(
"\
23477 Set whether to use deprecated gdb_index sections."),
_(
"\
23478 Show whether to use deprecated gdb_index sections."),
_(
"\
23479 When enabled, deprecated .gdb_index sections are used anyway.\n\
23480 Normally they are ignored either because of a missing feature or\n\
23481 performance issue.\n\
23482 Warning: This option must be enabled before gdb reads the file."),
23489 Save a gdb-index file.\n\
23490 Usage: save gdb-index DIRECTORY"),
static struct dwp_file * get_dwp_file(void)
struct dwarf2_section_info abbrev
bfd_size_type line_offset
static void free_cached_comp_units(void *)
void macro_define_function(struct macro_source_file *source, int line, const char *name, int argc, const char **argv, const char *replacement)
bfd_size_type macinfo_offset
static void unlink_if_set(void *p)
#define TYPE_HIGH_BOUND_KIND(range_type)
struct psymbol_allocation_list static_psymbols
void set_type_vptr_basetype(struct type *type, struct type *basetype)
static void save_gdb_index_command(char *arg, int from_tty)
static struct die_info * follow_die_offset(sect_offset offset, int offset_in_dwz, struct dwarf2_cu **ref_cu)
static struct dwarf2_section_info * get_debug_line_section(struct dwarf2_cu *cu)
struct dwarf2_per_cu_data * dwarf2_per_cu_ptr
struct partial_die_info * die_sibling
bfd_byte * symfile_relocate_debug_section(struct objfile *objfile, asection *sectp, bfd_byte *buf)
__extension__ enum dwarf_form form
static void free_delayed_list(void *ptr)
static struct type * read_set_type(struct die_info *die, struct dwarf2_cu *cu)
static struct dwarf_block * dwarf_alloc_block(struct dwarf2_cu *)
ULONGEST extract_unsigned_integer(const gdb_byte *, int, enum bfd_endian)
unsigned typedef_field_list_count
char * hex_string(LONGEST num)
static struct die_info * follow_die_sig(struct die_info *, const struct attribute *, struct dwarf2_cu **)
static struct dwo_unit * create_dwo_unit_in_dwp_v1(struct dwp_file *dwp_file, uint32_t unit_index, const char *comp_dir, ULONGEST signature, int is_debug_types)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
void cp_add_using_directive(const char *dest, const char *src, const char *alias, const char *declaration, VEC(const_char_ptr)*excludes, int copy_names, struct obstack *obstack)
const char * symtab_to_filename_for_display(struct symtab *symtab)
struct dwarf2_per_cu_data * per_cu
static struct dwarf2_queue_item * dwarf2_queue_tail
#define TYPE_RANGE_DATA(thistype)
static unsigned int get_cu_length(const struct comp_unit_head *header)
struct type * referenced_type
static struct die_info * read_die_and_siblings_1(const struct die_reader_specs *, const gdb_byte *, const gdb_byte **, struct die_info *)
static void free_line_header(struct line_header *lh)
struct dwarf_block * locdesc
char * gdb_realpath(const char *filename)
static int producer_is_gcc_lt_4_3(struct dwarf2_cu *cu)
bfd_size_type info_or_types_offset
static void dw2_map_matching_symbols(struct objfile *objfile, const char *name, domain_enum domain, int global, int(*callback)(struct block *, struct symbol *, void *), void *data, symbol_compare_ftype *match, symbol_compare_ftype *ordered_compare)
static struct die_info * sibling_die(struct die_info *)
static void psymtab_to_symtab_1(struct partial_symtab *)
static void process_psymtab_comp_unit(struct dwarf2_per_cu_data *this_cu, int want_partial_unit, enum language pretend_language)
static void fixup_go_packaging(struct dwarf2_cu *cu)
int dwarf2_has_info(struct objfile *objfile, const struct dwarf2_debug_sections *names)
static void process_structure_scope(struct die_info *, struct dwarf2_cu *)
static void show_dwarf_always_disassemble(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
#define OBSTACK_CALLOC(OBSTACK, NUMBER, TYPE)
#define DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE(cu_index, value)
static void scan_partial_symbols(struct partial_die_info *, CORE_ADDR *, CORE_ADDR *, int, struct dwarf2_cu *)
static CORE_ADDR read_addr_index_from_leb128(struct dwarf2_cu *, const gdb_byte *, unsigned int *)
const struct dwp_hash_table * tus
struct dwarf2_per_cu_data * per_cu
__extension__ enum dwarf_tag tag
struct using_direct * using_directives
static void delete_file_name_entry(void *e)
int dwarf_always_disassemble
#define SECT_OFF_TEXT(objfile)
struct type * copy_type(const struct type *type)
union dynamic_prop_data data
struct attr_abbrev * attrs
static struct type * read_unspecified_type(struct die_info *die, struct dwarf2_cu *cu)
static void dw2_map_symbol_filenames(struct objfile *objfile, symbol_filename_ftype *fun, void *data, int need_fullname)
static struct type * read_subroutine_type(struct die_info *die, struct dwarf2_cu *cu)
struct template_symbol * allocate_template_symbol(struct objfile *objfile)
struct type * create_static_range_type(struct type *result_type, struct type *index_type, LONGEST low_bound, LONGEST high_bound)
#define VEC_replace(T, V, I, O)
struct dwarf2_section_info str
static struct symtab * dw2_find_last_source_symtab(struct objfile *objfile)
int block_find_non_opaque_type_preferred(struct symbol *sym, void *data)
CORE_ADDR get_frame_pc(struct frame_info *frame)
hashval_t core_addr_hash(const void *ap)
#define SYMBOL_PRINT_NAME(symbol)
struct partial_die_info * die_parent
static bfd_size_type dwarf2_section_size(struct objfile *objfile, struct dwarf2_section_info *info)
static int dw2_map_expand_apply(struct objfile *objfile, struct dwarf2_per_cu_data *per_cu, const char *name, const char *real_path, int(*callback)(struct symtab *, void *), void *data)
static struct die_info * follow_die_sig_1(struct die_info *src_die, struct signatured_type *sig_type, struct dwarf2_cu **ref_cu)
struct dwarf2_section_names macro_dwo
static const char * psymtab_include_file_name(const struct line_header *lh, int file_index, const struct partial_symtab *pst, const char *comp_dir)
void value_print(struct value *val, struct ui_file *stream, const struct value_print_options *options)
void 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_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
unsigned int has_children
void 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_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
void symbol_set_symtab(struct symbol *symbol, struct symtab *symtab)
int dwarf2_per_cu_ref_addr_size(struct dwarf2_per_cu_data *per_cu)
struct obstack storage_obstack
struct dwarf2_section_names types
#define TYPE_FIELD_PRIVATE_BITS(thistype)
static int leb128_size(const gdb_byte *buf)
unsigned int has_specification
struct dwarf2_section_names str_offsets_dwo
static struct type * set_die_type(struct die_info *, struct type *, struct dwarf2_cu *)
static void free_line_header_voidp(void *arg)
static void create_all_comp_units(struct objfile *)
struct type * builtin_void
enum language pretend_language
struct dwarf2_section_info ranges
void record_block_range(struct block *block, CORE_ADDR start, CORE_ADDR end_inclusive)
struct fn_field * fn_fields
int nr_stmt_less_type_units
static void reset_die_in_process(void *arg)
#define TYPE_FIELD_NAME(thistype, n)
#define TYPE_N_BASECLASSES(thistype)
static const char * dwarf2_name(struct die_info *die, struct dwarf2_cu *)
static void init_cutu_and_read_dies_no_follow(struct dwarf2_per_cu_data *this_cu, struct dwo_file *dwo_file, die_reader_func_ftype *die_reader_func, void *data)
static struct type * read_enumeration_type(struct die_info *die, struct dwarf2_cu *cu)
void fputs_unfiltered(const char *buf, struct ui_file *file)
static struct type * get_signatured_type(struct die_info *, ULONGEST, struct dwarf2_cu *)
struct dwarf2_section_info macro
int producer_is_gcc_ge_4(const char *producer)
static struct dwz_file * dwarf2_get_dwz_file(void)
static const struct comp_unit_head * per_cu_header_read_in(struct comp_unit_head *cu_headerp, struct dwarf2_per_cu_data *per_cu)
unsigned is_cplus_template_function
CORE_ADDR dwarf2_read_addr_index(struct dwarf2_per_cu_data *per_cu, unsigned int addr_index)
static LONGEST read_offset_1(bfd *, const gdb_byte *, unsigned int)
struct dwarf2_section_info * containing_section
struct dwarf2_section_names macinfo
struct objfile * separate_debug_objfile_backlink
struct dwarf2_section_info macro
#define HAVE_GNAT_AUX_INFO(type)
static const struct dwarf2_debug_sections dwarf2_elf_names
int strcmp_iw(const char *string1, const char *string2)
static CORE_ADDR read_addr_index(struct dwarf2_cu *cu, unsigned int addr_index)
#define TYPE_NFN_FIELDS(thistype)
struct dwarf2_section_info eh_frame
static void compute_delayed_physnames(struct dwarf2_cu *cu)
void dummy_obstack_deallocate(void *object, void *data)
static struct partial_die_info * find_partial_die_in_comp_unit(sect_offset offset, struct dwarf2_cu *cu)
static int dwarf2_is_constructor(struct die_info *die, struct dwarf2_cu *cu)
static enum dwarf_access_attribute dwarf2_default_access_attribute(struct die_info *die, struct dwarf2_cu *cu)
struct dwarf2_section_names tu_index
void add_symbol_to_list(struct symbol *symbol, struct pending **listhead)
static const gdb_byte * skip_form_bytes(bfd *abfd, const gdb_byte *bytes, const gdb_byte *buffer_end, enum dwarf_form form, unsigned int offset_size, struct dwarf2_section_info *section)
struct nextfnfield * head
struct symbol * hash_next
EXTERN unsigned char processing_gcc_compilation
static int section_is_p(const char *section_name, const struct dwarf2_section_names *names)
bfd_size_type abbrev_size
static const gdb_byte * read_attribute_value(const struct die_reader_specs *reader, struct attribute *attr, unsigned form, const gdb_byte *info_ptr)
cu_offset first_die_offset
__extension__ enum dwarf_attribute name
void warning(const char *fmt,...)
struct dwarf2_section_info str_offsets
static void read_common_block(struct die_info *, struct dwarf2_cu *)
static void create_dwo_cu_reader(const struct die_reader_specs *reader, const gdb_byte *info_ptr, struct die_info *comp_unit_die, int has_children, void *datap)
struct psymbol_allocation_list global_psymbols
static hashval_t hash_file_name_entry(const void *e)
static void dwarf2_build_psymtabs_hard(struct objfile *)
struct type ** const(pascal_builtin_types[])
static int attr_form_is_constant(const struct attribute *)
void set_type_vptr_fieldno(struct type *type, int fieldno)
#define TYPE_NAME(thistype)
static struct cmd_list_element * set_dwarf_cmdlist
struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_cu_off(cu_offset offset_in_cu, struct dwarf2_per_cu_data *per_cu, CORE_ADDR(*get_frame_pc)(void *baton), void *baton)
#define TYPE_FIELD_ARTIFICIAL(thistype, n)
struct macro_source_file * included_by
int nr_uniq_abbrev_tables
void gdbarch_make_symbol_special(struct gdbarch *gdbarch, struct symbol *sym, struct objfile *objfile)
static void guess_partial_die_structure_name(struct partial_die_info *struct_pdi, struct dwarf2_cu *cu)
const gdb_byte * hash_table
static void dump_die_shallow(struct ui_file *, int indent, struct die_info *)
static unsigned int peek_abbrev_code(bfd *, const gdb_byte *)
#define INIT_CPLUS_SPECIFIC(type)
struct line_header * line_header
record_line_ftype * record_line
char * ui_file_xstrdup(struct ui_file *file, long *length)
static int eq_type_unit_group(const void *item_lhs, const void *item_rhs)
struct dwarf2_section_names gdb_index
unsigned int discriminator
#define TYPE_FN_FIELDLIST(thistype, n)
static hashval_t hash_symtab_entry(const void *e)
struct dwarf2_section_info abbrev
struct dwarf2_section_info macinfo
unsigned int epilogue_unwind_valid
offset_type symbol_table_slots
void ui_file_delete(struct ui_file *file)
static struct quick_file_names * dw2_get_file_names(struct dwarf2_per_cu_data *this_cu)
static struct die_info * follow_die_ref(struct die_info *, const struct attribute *, struct dwarf2_cu **)
static int read_1_signed_byte(bfd *, const gdb_byte *)
void( record_line_ftype)(struct subfile *subfile, int line, CORE_ADDR pc)
void ui_file_put(struct ui_file *file, ui_file_put_method_ftype *write, void *dest)
const struct dwarf2_per_cu_data * per_cu
static void prepare_one_comp_unit(struct dwarf2_cu *cu, struct die_info *comp_unit_die, enum language pretend_language)
static void add_index_entry(struct mapped_symtab *symtab, const char *name, int is_static, gdb_index_symbol_kind kind, offset_type cu_index)
struct type * language_string_char_type(const struct language_defn *la, struct gdbarch *gdbarch)
#define FIELD_ARTIFICIAL(thisfld)
void get_formatted_print_options(struct value_print_options *opts, char format)
enum domain_enum_tag domain_enum
int gdbarch_address_class_type_flags_p(struct gdbarch *gdbarch)
#define TYPE_FIELD_VIRTUAL_BITS(thistype)
int compare_filenames_for_search(const char *filename, const char *search_name)
#define ALLOCATE_GNAT_AUX_TYPE(type)
struct ui_file * gdb_stdout
static struct type * read_tag_ptr_to_member_type(struct die_info *die, struct dwarf2_cu *cu)
static void set_partial_user(struct objfile *objfile)
static void write_psymtabs_to_index(struct objfile *objfile, const char *dir)
union dwarf2_section_info::@58 s
#define PSYMBOL_DOMAIN(psymbol)
const struct type_print_options type_print_raw_options
static int eq_stmt_list_entry(const struct stmt_list_hash *lhs, const struct stmt_list_hash *rhs)
const struct objfile_type * objfile_type(struct objfile *objfile)
struct dwarf2_per_cu_data * read_in_chain
static void abbrev_table_free(struct abbrev_table *)
char * ldirname(const char *filename)
static htab_t create_debug_types_hash_table(struct dwo_file *dwo_file, VEC(dwarf2_section_info_def)*types)
static char * file_full_name(int file, struct line_header *lh, const char *comp_dir)
struct dwarf2_section_names abbrev_dwo
static void write_psymbols(struct mapped_symtab *symtab, htab_t psyms_seen, struct partial_symbol **psymp, int count, offset_type cu_index, int is_static)
#define SYMBOL_CLASS(symbol)
int dwarf2_per_cu_offset_size(struct dwarf2_per_cu_data *per_cu)
struct dwarf2_per_cu_data per_cu
void( expand_symtabs_exp_notify_ftype)(struct compunit_symtab *symtab, void *data)
void internal_error(const char *file, int line, const char *fmt,...)
static int locate_v1_virtual_dwo_sections(asection *sectp, struct virtual_v1_dwo_sections *sections)
static void build_type_psymtabs(struct objfile *objfile)
static int eq_symtab_entry(const void *a, const void *b)
static void load_full_comp_unit_reader(const struct die_reader_specs *reader, const gdb_byte *info_ptr, struct die_info *comp_unit_die, int has_children, void *data)
const struct language_defn * language_def(enum language lang)
void print_spaces(int n, struct ui_file *file)
struct objfile * dwarf2_per_cu_objfile(struct dwarf2_per_cu_data *per_cu)
EXTERN struct pending * file_symbols
static void setup_type_unit_groups(struct die_info *die, struct dwarf2_cu *cu)
#define TYPE_FIELD_PROTECTED_BITS(thistype)
static void build_type_psymtabs_reader(const struct die_reader_specs *reader, const gdb_byte *info_ptr, struct die_info *type_unit_die, int has_children, void *data)
static unsigned int read_4_bytes(bfd *, const gdb_byte *)
void smash_to_method_type(struct type *type, struct type *self_type, struct type *to_type, struct field *args, int nargs, int varargs)
static unsigned int dwarf_line_debug
struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_sect_off(sect_offset offset, struct dwarf2_per_cu_data *per_cu, CORE_ADDR(*get_frame_pc)(void *baton), void *baton)
struct symbol ** template_arguments
void value_free(struct value *val)
static const gdb_byte * read_full_die_1(const struct die_reader_specs *, struct die_info **, const gdb_byte *, int *, int)
static void update_enumeration_type_from_children(struct die_info *die, struct type *type, struct dwarf2_cu *cu)
static struct type * read_module_type(struct die_info *die, struct dwarf2_cu *cu)
struct dwarf2_queue_item * next
static bfd * open_dwp_file(const char *file_name)
struct dwarf2_section_names line_dwo
struct dwp_sections sections
#define DIRNAME_SEPARATOR
struct symbol * symbol[PENDINGSIZE]
void augment_type_symtab(void)
static void queue_comp_unit(struct dwarf2_per_cu_data *per_cu, enum language pretend_language)
static void set_cu_language(unsigned int, struct dwarf2_cu *)
void set_objfile_main_name(struct objfile *objfile, const char *name, enum language lang)
static hashval_t die_hash(const void *item)
static void dwarf2_read_section(struct objfile *objfile, struct dwarf2_section_info *info)
static char * dwarf_bool_name(unsigned int)
static void dw2_setup(struct objfile *objfile)
#define SYMBOL_VALUE_COMMON_BLOCK(symbol)
int addrmap_foreach(struct addrmap *map, addrmap_foreach_fn fn, void *data)
static void dw2_symtab_iter_init(struct dw2_symtab_iterator *iter, struct mapped_index *index, int want_specific_block, int block_index, domain_enum domain, const char *name)
static struct type * read_tag_const_type(struct die_info *die, struct dwarf2_cu *cu)
static void load_full_type_unit(struct dwarf2_per_cu_data *per_cu)
#define TYPE_NO_RETURN(thistype)
static int dwarf2_mark_helper(void **slot, void *data)
#define NO_STMT_LIST_TYPE_UNIT_PSYMTAB_SIZE
enum language la_language
static char * partial_die_full_name(struct partial_die_info *pdi, struct dwarf2_cu *cu)
static void dwarf2_free_abbrev_table(void *)
static void dw2_expand_symtabs_matching(struct objfile *objfile, expand_symtabs_file_matcher_ftype *file_matcher, expand_symtabs_symbol_matcher_ftype *symbol_matcher, expand_symtabs_exp_notify_ftype *expansion_notify, enum search_domain kind, void *data)
struct dwarf2_section_info str
int gdbarch_address_class_type_flags(struct gdbarch *gdbarch, int byte_size, int dwarf2_addr_class)
static struct attribute * dwarf2_attr(struct die_info *, unsigned int, struct dwarf2_cu *)
void dwarf2_build_psymtabs(struct objfile *objfile)
#define SET_FIELD_PHYSADDR(thisfld, addr)
struct partial_symtab * psymtab
#define IS_TYPE_UNIT_GROUP(per_cu)
static int sort_tu_by_abbrev_offset(const void *ap, const void *bp)
struct type * nodebug_data_symbol
static int dwarf2_loclist_index
#define VEC_safe_push(T, V, O)
#define BLOCKVECTOR_BLOCK(blocklist, n)
union partial_die_info::@63 d
static offset_type add_indices_to_cpool(htab_t symbol_hash_table, struct obstack *cpool, struct symtab_index_entry *entry)
static void read_file_scope(struct die_info *, struct dwarf2_cu *)
struct type * init_type(enum type_code code, int length, int flags, const char *name, struct objfile *objfile)
FILE * gdb_fopen_cloexec(const char *filename, const char *opentype)
static void check_producer(struct dwarf2_cu *cu)
static htab_t create_quick_file_names_table(unsigned int nr_initial_entries)
static void psymtabs_addrmap_cleanup(void *o)
static void uniquify_cu_indices(struct mapped_symtab *symtab)
static const gdb_byte * gdb_skip_leb128(const gdb_byte *buf, const gdb_byte *buf_end)
static hashval_t hash_type_unit_group(const void *item)
struct type * builtin_core_addr
static struct type * read_tag_restrict_type(struct die_info *die, struct dwarf2_cu *cu)
struct dwarf2_section_info info
static CORE_ADDR read_addr_index_1(unsigned int addr_index, ULONGEST addr_base, int addr_size)
bfd_size_type virtual_offset
struct dwarf2_section_info abbrev
static struct die_info * follow_die_ref_or_sig(struct die_info *, const struct attribute *, struct dwarf2_cu **)
static int producer_is_icc(struct dwarf2_cu *cu)
static int dwarf2_locexpr_block_index
#define TYPE_FIELD_IGNORE_BITS(thistype)
struct type * builtin_long_long
const gdb_byte * address_table
EXTERN int context_stack_depth
void java_print_type(struct type *, const char *, struct ui_file *, int, int, const struct type_print_options *)
static int dw2_free_cached_file_names(void **slot, void *info)
static int read_cutu_die_from_dwo(struct dwarf2_per_cu_data *this_cu, struct dwo_unit *dwo_unit, int abbrev_table_provided, 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, int *result_has_children)
const struct symbol_block_ops dwarf2_block_frame_base_locexpr_funcs
#define SET_FIELD_BITPOS(thisfld, bitpos)
struct bfd * gdb_bfd_open(const char *name, const char *target, int fd)
struct signatured_type * sig_type
static gdb_byte * dwarf2_const_value_data(const struct attribute *attr, struct obstack *obstack, struct dwarf2_cu *cu, LONGEST *value, int bits)
#define outermost_context_p()
struct dwarf2_section_info line
struct type * builtin_long
#define TYPE_FIELD(thistype, n)
static void dwarf2_read_abbrevs(struct dwarf2_cu *, struct dwarf2_section_info *)
static int die_is_declaration(struct die_info *, struct dwarf2_cu *cu)
static struct dwarf2_per_cu_data * dw2_get_cu(int index)
#define bits(obj, st, fn)
char * go_symbol_package_name(const struct symbol *sym)
static void dwarf2_section_buffer_overflow_complaint(struct dwarf2_section_info *section)
struct dwarf2_section_info macro
#define OPF_SEARCH_IN_PATH
struct dwarf2_section_info line
static struct dwo_unit * lookup_dwo_unit(struct dwarf2_per_cu_data *this_cu, struct die_info *comp_unit_die)
const struct symbol_computed_ops dwarf2_locexpr_funcs
static bfd * try_open_dwop_file(const char *file_name, int is_dwp, int search_cwd)
static int add_address_entry_worker(void *datap, CORE_ADDR start_addr, void *obj)
bfd_size_type macro_offset
const gdb_byte * dwarf2_find_location_expression(struct dwarf2_loclist_baton *baton, size_t *locexpr_length, CORE_ADDR pc)
static struct compunit_symtab * get_compunit_symtab(struct dwarf2_per_cu_data *per_cu)
#define TYPE_PROTOTYPED(t)
int producer_is_realview(const char *producer)
static void read_type_unit_scope(struct die_info *, struct dwarf2_cu *)
static char * anonymous_struct_prefix(struct die_info *die, struct dwarf2_cu *cu)
#define TYPE_FIELD_TYPE(thistype, n)
static struct dwarf2_per_objfile * dwarf2_per_objfile
static struct pending * common_block
int register_symbol_computed_impl(enum address_class aclass, const struct symbol_computed_ops *ops)
int register_symbol_block_impl(enum address_class aclass, const struct symbol_block_ops *ops)
static int dw2_map_symtabs_matching_filename(struct objfile *objfile, const char *name, const char *real_path, int(*callback)(struct symtab *, void *), void *data)
struct objfile_per_bfd_storage * per_bfd
struct value * allocate_value(struct type *type)
struct dwarf2_section_info * section
struct partial_symtab * psymtab
char * debug_file_directory
enum language pretend_language
struct symbol * template_symbols
struct cmd_list_element * maintenance_set_cmdlist
static void process_enumeration_scope(struct die_info *, struct dwarf2_cu *)
static void show_check_physname(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
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)
struct macro_table * get_macro_table(void)
unsigned int num_file_names
static const gdb_byte * read_and_check_comp_unit_head(struct comp_unit_head *header, struct dwarf2_section_info *section, struct dwarf2_section_info *abbrev_section, const gdb_byte *info_ptr, int is_debug_types_section)
struct dwarf2_section_names abbrev
void store_unsigned_integer(gdb_byte *, int, enum bfd_endian, ULONGEST)
struct compunit_symtab * buildsym_compunit_symtab(void)
void restart_symtab(struct compunit_symtab *cust, const char *name, CORE_ADDR start_addr)
void printf_filtered(const char *format,...)
static void dwarf2_locate_common_dwp_sections(bfd *abfd, asection *sectp, void *dwp_file_ptr)
void gdb_bfd_record_inclusion(bfd *includer, bfd *includee)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
static gdb_index_symbol_kind symbol_kind(struct partial_symbol *psym)
static struct type * new_type(char *)
void c_type_print_args(struct type *type, struct ui_file *stream, int linkage_name, enum language language, const struct type_print_options *flags)
static struct type * die_type(struct die_info *, struct dwarf2_cu *)
static void dwarf2_read_addr_index_reader(const struct die_reader_specs *reader, const gdb_byte *info_ptr, struct die_info *comp_unit_die, int has_children, void *data)
static struct type * read_tag_reference_type(struct die_info *die, struct dwarf2_cu *cu)
struct block * end_symtab_get_static_block(CORE_ADDR end_addr, int expandable, int required)
void macro_define_object(struct macro_source_file *source, int line, const char *name, const char *replacement)
static void dwarf2_const_value_length_mismatch_complaint(const char *arg1, int arg2, int arg3)
EXTERN struct subfile * current_subfile
static void create_addrmap_from_index(struct objfile *objfile, struct mapped_index *index)
static struct line_header * dwarf_decode_line_header(unsigned int offset, struct dwarf2_cu *cu)
static void dwarf2_record_block_ranges(struct die_info *, struct block *, CORE_ADDR, struct dwarf2_cu *)
struct obstack objfile_obstack
struct stmt_list_hash hash
mach_port_t kern_return_t mach_port_t msgports 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
#define TYPE_N_TEMPLATE_ARGUMENTS(thistype)
void null_cleanup(void *arg)
struct dwarf2_section_info * section
__extension__ enum dwarf_form form
struct type * create_string_type(struct type *result_type, struct type *string_char_type, struct type *range_type)
static void dw2_expand_symtabs_with_fullname(struct objfile *objfile, const char *fullname)
static struct type_unit_group * create_type_unit_group(struct dwarf2_cu *cu, sect_offset line_offset_struct)
struct fnfieldlist * fnfieldlists
#define TYPE_VPTR_FIELDNO(thistype)
static int is_vtable_name(const char *name, struct dwarf2_cu *cu)
static void dwarf2_locate_v2_dwp_sections(bfd *abfd, asection *sectp, void *dwp_file_ptr)
static void add_partial_module(struct partial_die_info *pdi, CORE_ADDR *lowpc, CORE_ADDR *highpc, int set_addrmap, struct dwarf2_cu *cu)
struct value * dwarf2_evaluate_loc_desc(struct type *type, struct frame_info *frame, const gdb_byte *data, size_t size, struct dwarf2_per_cu_data *per_cu)
static void set_type(type_object *obj, struct type *type)
struct dwp_hash_table::@60::@61 v1
struct typedef_field_list * next
struct dwarf2_section_info line
struct cmd_list_element * setlist
static LONGEST read_signed_leb128(bfd *, const gdb_byte *, unsigned int *)
int is_cplus_marker(int c)
static void dwarf2_locate_dwo_sections(bfd *abfd, asection *sectp, void *dwo_sections_ptr)
static void fixup_partial_die(struct partial_die_info *, struct dwarf2_cu *)
const gdb_byte * safe_skip_leb128(const gdb_byte *buf, const gdb_byte *buf_end)
struct compunit_symtab ** includes
struct obstack comp_unit_obstack
#define TYPE_TYPEDEF_FIELD_ARRAY(thistype)
char * gdb_demangle(const char *name, int options)
#define ALL_OBJFILES(obj)
static struct mapped_symtab * create_mapped_symtab(void)
static void age_cached_comp_units(void)
EXTERN struct using_direct * using_directives
struct signatured_type * sig_type_ptr
static int read_2_signed_bytes(bfd *abfd, const gdb_byte *buf)
static struct type * get_die_type_at_offset(sect_offset, struct dwarf2_per_cu_data *)
static void check_line_address(struct dwarf2_cu *cu, lnp_state_machine *state, const gdb_byte *line_ptr, CORE_ADDR lowpc, CORE_ADDR address)
#define TYPE_FN_FIELD_PHYSNAME(thisfn, n)
static const char * dwarf_tag_name(unsigned int)
struct dwarf2_section_info addr
struct dwarf2_section_info gdb_index
static struct dwarf2_per_cu_data * dw2_symtab_iter_next(struct dw2_symtab_iterator *iter)
static struct signatured_type * lookup_signatured_type(struct dwarf2_cu *cu, ULONGEST sig)
#define VEC_iterate(T, V, I, P)
#define PSYMBOL_CLASS(psymbol)
static void delete_symtab_entry(void *p)
static void hash_expand(struct mapped_symtab *symtab)
struct partial_die_info * die_child
enum array_ordering la_array_ordering
static struct type_unit_group * get_type_unit_group(struct dwarf2_cu *cu, const struct attribute *stmt_list)
static const gdb_byte * skip_one_die(const struct die_reader_specs *reader, const gdb_byte *info_ptr, struct abbrev_info *abbrev)
#define SYMBOL_ACLASS_INDEX(symbol)
struct type * check_typedef(struct type *type)
static void get_scope_pc_bounds(struct die_info *, CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *)
static struct type * read_structure_type(struct die_info *die, struct dwarf2_cu *cu)
bfd_size_type info_or_types_size
#define SYMBOL_VALUE_ADDRESS(symbol)
struct symbol * contents[1]
int build_id_verify(bfd *abfd, size_t check_len, const bfd_byte *check)
static int write_one_signatured_type(void **slot, void *d)
static struct compunit_symtab * dwarf2_start_symtab(struct dwarf2_cu *, const char *, const char *, CORE_ADDR)
static const struct objfile_data * dwarf2_objfile_data_key
static void add_partial_enumeration(struct partial_die_info *enum_pdi, struct dwarf2_cu *cu)
#define CATCH(EXCEPTION, MASK)
int dwarf2_initialize_objfile(struct objfile *objfile)
static void free_dwo_file_cleanup(void *)
static int eq_psymtab_cu_index(const void *item_lhs, const void *item_rhs)
static const char * consume_improper_spaces(const char *p, const char *body)
struct dwarf2_section_info abbrev
static void read_import_statement(struct die_info *die, struct dwarf2_cu *)
const gdb_byte * buffer_end
struct type * create_set_type(struct type *result_type, struct type *domain_type)
struct abbrev_table * abbrev_table
void block_set_scope(struct block *block, const char *scope, struct obstack *obstack)
struct type * create_range_type(struct type *result_type, struct type *index_type, const struct dynamic_prop *low_bound, const struct dynamic_prop *high_bound)
static const struct dwop_section_names dwop_section_names
static void dwarf2_macro_malformed_definition_complaint(const char *arg1)
static int dwarf2_flag_true_p(struct die_info *die, unsigned name, struct dwarf2_cu *cu)
static const char * dwarf_attr_name(unsigned int)
struct type * make_restrict_type(struct type *type)
static hashval_t hash_dwp_loaded_cutus(const void *item)
void dwarf2_free_objfile(struct objfile *objfile)
int section_ids[MAX_NR_V2_DWO_SECTIONS]
struct dwarf2_section_info frame
struct type * lookup_memberptr_type(struct type *type, struct type *domain)
static void dw2_expand_all_symtabs(struct objfile *objfile)
struct dwarf2_section_info loc
void gdb_bfd_unref(struct bfd *abfd)
static void dwarf_decode_lines(struct line_header *, const char *, struct dwarf2_cu *, struct partial_symtab *, CORE_ADDR, int decode_mapping)
CORE_ADDR gdbarch_addr_bits_remove(struct gdbarch *gdbarch, CORE_ADDR addr)
#define SYMBOL_DOMAIN(symbol)
int core_addr_eq(const void *ap, const void *bp)
EXTERN struct pending * global_symbols
static struct abbrev_info * abbrev_table_alloc_abbrev(struct abbrev_table *abbrev_table)
struct pending_block * old_blocks
static hashval_t hash_signatured_type(const void *item)
const struct symbol_block_ops dwarf2_block_frame_base_loclist_funcs
static void write_address_map(struct objfile *objfile, struct obstack *obstack, htab_t cu_index_htab)
char * cp_remove_params(const char *demangled_name)
struct dwarf2_section_info info_or_types
static void read_module(struct die_info *die, struct dwarf2_cu *cu)
static htab_t create_strtab(void)
struct compunit_symtab * end_symtab_from_static_block(struct block *static_block, int section, int expandable)
__extension__ enum dwarf_attribute name
const char * linkage_name
static void dwarf2_release_queue(void *dummy)
unsigned int load_all_dies
void fprintf_filtered(struct ui_file *stream, const char *format,...)
static void process_full_comp_unit(struct dwarf2_per_cu_data *, enum language)
int openp(const char *, int, const char *, int, char **)
const char * const_char_ptr
#define SYMBOL_SET_LANGUAGE(symbol, language, obstack)
void * xzalloc(size_t size)
struct partial_symbol ** next
struct dwarf2_section_names cu_index
void set_cmd_completer(struct cmd_list_element *cmd, completer_ftype *completer)
static struct partial_die_info * find_partial_die(sect_offset, int, struct dwarf2_cu *)
static void set_dwarf_cmd(char *args, int from_tty)
int nr_all_type_units_reallocs
static void dwarf2_debug_line_missing_file_complaint(void)
static void dwarf2_get_subprogram_pc_bounds(struct die_info *die, CORE_ADDR *lowpc, CORE_ADDR *highpc, struct dwarf2_cu *cu)
const char * symbol_get_demangled_name(const struct general_symbol_info *gsymbol)
struct nextfnfield * next
static void dw2_relocate(struct objfile *objfile, const struct section_offsets *new_offsets, const struct section_offsets *delta)
#define DW_FIELD_ALLOC_CHUNK
static struct type * read_base_type(struct die_info *die, struct dwarf2_cu *cu)
static void dwarf2_find_base_address(struct die_info *die, struct dwarf2_cu *cu)
static hashval_t hash_dwo_unit(const void *item)
void init_psymbol_list(struct objfile *, int)
struct dwarf2_per_cu_data * per_cu
static int get_section_id(const struct dwarf2_section_info *section)
static struct die_info * die_specification(struct die_info *die, struct dwarf2_cu **)
static void write_obstack(FILE *file, struct obstack *obstack)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
static struct abbrev_info * peek_die_abbrev(const gdb_byte *info_ptr, unsigned int *bytes_read, struct dwarf2_cu *cu)
static hashval_t partial_die_hash(const void *item)
struct symtab * compunit_primary_filetab(const struct compunit_symtab *cust)
struct partial_symtab * start_psymtab_common(struct objfile *, const char *, CORE_ADDR, struct partial_symbol **, struct partial_symbol **)
static int dwarf_max_cache_age
#define MAX_NESTED_IMPORTED_DECLARATIONS
static int die_needs_namespace(struct die_info *die, struct dwarf2_cu *cu)
char * obconcat(struct obstack *obstackp,...)
struct cmd_list_element * showlist
void exception_print(struct ui_file *file, struct gdb_exception e)
static struct type * get_DW_AT_signature_type(struct die_info *, const struct attribute *, struct dwarf2_cu *)
static const char * dwarf2_full_name(const char *name, struct die_info *die, struct dwarf2_cu *cu)
int line_has_non_zero_discriminator
static int handle_data_member_location(struct die_info *die, struct dwarf2_cu *cu, LONGEST *offset)
void fputs_filtered(const char *linebuffer, struct ui_file *stream)
static struct dwarf2_section_info create_dwp_v2_section(struct dwarf2_section_info *section, bfd_size_type offset, bfd_size_type size)
static struct macro_source_file * macro_start_file(int file, int line, struct macro_source_file *current_file, struct line_header *lh)
static struct dwo_unit * create_dwo_unit_in_dwp_v2(struct dwp_file *dwp_file, uint32_t unit_index, const char *comp_dir, ULONGEST signature, int is_debug_types)
static void read_signatured_type_reader(const struct die_reader_specs *reader, const gdb_byte *info_ptr, struct die_info *comp_unit_die, int has_children, void *data)
struct dwarf2_section_info loc
static void dwarf_decode_lines_1(struct line_header *lh, struct dwarf2_cu *cu, const int decode_for_pst_p, CORE_ADDR lowpc)
#define gdb_assert_not_reached(message)
static struct type * read_type_die_1(struct die_info *, struct dwarf2_cu *)
struct cleanup * make_cleanup_discard_psymtabs(struct objfile *)
#define ALLOCATE_CPLUS_STRUCT_TYPE(type)
#define DW2_GDB_INDEX_CU_SET_VALUE(cu_index, value)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **list)
void free_current_contents(void *ptr)
static void queue_and_load_all_dwo_tus(struct dwarf2_per_cu_data *)
void dwarf2_get_section_info(struct objfile *objfile, enum dwarf2_section_enum sect, asection **sectp, const gdb_byte **bufp, bfd_size_type *sizep)
static void read_func_scope(struct die_info *, struct dwarf2_cu *)
struct abbrev_info ** abbrevs
#define SYMBOL_COMPUTED_OPS(symbol)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
unsigned int has_byte_size
static const gdb_byte * skip_children(const struct die_reader_specs *reader, const gdb_byte *info_ptr)
void complaint(struct complaints **complaints, const char *fmt,...)
struct dwarf2_section_info types
int( expand_symtabs_symbol_matcher_ftype)(const char *name, void *data)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
bfd_size_type abbrev_offset
struct dwarf2_per_cu_data * per_cu
static ULONGEST read_8_bytes(bfd *, const gdb_byte *)
const struct language_defn * language_defn
static void dwarf2_read_symtab(struct partial_symtab *, struct objfile *)
static hashval_t line_header_hash_voidp(const void *item)
#define ANOFFSET(secoff, whichone)
struct gdbarch * get_objfile_arch(const struct objfile *objfile)
char * pulongest(ULONGEST u)
static void dump_die_for_error(struct die_info *)
struct dwarf2_section_info macro
static const char * get_section_name(const struct dwarf2_section_info *)
static int queue_and_load_dwo_tu(void **slot, void *info)
unsigned int previous_cu_index
EXTERN struct pending * local_symbols
struct addrmap * addrmap_create_mutable(struct obstack *obstack)
static int dwarf2_section_empty_p(const struct dwarf2_section_info *section)
unsigned int locations_valid
struct dwarf2_section_info info
static struct compunit_symtab * dw2_lookup_symbol(struct objfile *objfile, int block_index, const char *name, domain_enum domain)
static struct symtab_index_entry ** find_slot(struct mapped_symtab *symtab, const char *name)
struct compunit_symtab * end_expandable_symtab(CORE_ADDR end_addr, int section)
static struct type * get_die_type(struct die_info *die, struct dwarf2_cu *cu)
static int build_type_psymtab_dependencies(void **slot, void *info)
static int producer_is_gxx_lt_4_6(struct dwarf2_cu *cu)
void( die_reader_func_ftype)(const struct die_reader_specs *reader, const gdb_byte *info_ptr, struct die_info *comp_unit_die, int has_children, void *data)
static int process_dwo_file_for_skeletonless_type_units(void **slot, void *info)
unsigned char signed_addr_p
#define VEC_index(T, V, I)
static struct signatured_type * lookup_dwo_signatured_type(struct dwarf2_cu *cu, ULONGEST sig)
struct dwarf2_section_names line
struct macro_source_file * macro_include(struct macro_source_file *source, int line, const char *included)
#define TYPE_CPLUS_DYNAMIC(thistype)
#define SET_TYPE_FIELD_PRIVATE(thistype, n)
static void dwarf2_complex_location_expr_complaint(void)
static void dump_die_1(struct ui_file *, int level, int max_level, struct die_info *)
static void build_type_psymtabs_1(void)
static asection * get_section_bfd_section(const struct dwarf2_section_info *section)
static LONGEST read_checked_initial_length_and_offset(bfd *, const gdb_byte *, const struct comp_unit_head *, unsigned int *, unsigned int *)
static void dw2_do_instantiate_symtab(struct dwarf2_per_cu_data *per_cu)
struct context_stack * pop_context(void)
#define NO_STMT_LIST_TYPE_UNIT_PSYMTAB
gdb_byte * value_contents_writeable(struct value *value)
union dwp_hash_table::@60 section_pool
struct type * alloc_type(struct objfile *objfile)
struct dwarf2_locexpr_baton locexpr
#define CP_ANONYMOUS_NAMESPACE_STR
static int line_header_eq_voidp(const void *item_lhs, const void *item_rhs)
struct dwarf2_section_info line
static unsigned int read_2_bytes(bfd *, const gdb_byte *)
static int dwarf2_locexpr_index
static int attr_form_is_block(const struct attribute *)
struct value * value_from_longest(struct type *type, LONGEST num)
#define SYMBOL_LINE(symbol)
static struct signatured_type * lookup_dwp_signatured_type(struct dwarf2_cu *cu, ULONGEST sig)
#define SYMBOL_LINKAGE_NAME(symbol)
struct dwarf2_per_cu_quick_data * quick
CORE_ADDR gdbarch_adjust_dwarf2_addr(struct gdbarch *gdbarch, CORE_ADDR pc)
void exception_fprintf(struct ui_file *file, struct gdb_exception e, const char *prefix,...)
struct compunit_symtab * compunit_symtabs
static const char * read_indirect_string(bfd *, const gdb_byte *, const struct comp_unit_head *, unsigned int *)
static int startswith(const char *string, const char *pattern)
static void noop_record_line(struct subfile *subfile, int line, CORE_ADDR pc)
static void dwarf_decode_macros(struct dwarf2_cu *, unsigned int, int)
void dump_die(struct die_info *, int max_level)
void add_dyn_prop(enum dynamic_prop_node_kind prop_kind, struct dynamic_prop prop, struct type *type, struct objfile *objfile)
static htab_t allocate_dwo_unit_table(struct objfile *objfile)
int iterate_over_some_symtabs(const char *name, const char *real_path, int(*callback)(struct symtab *symtab, void *data), void *data, struct compunit_symtab *first, struct compunit_symtab *after_last)
#define SET_FIELD_ENUMVAL(thisfld, enumval)
static int maybe_queue_comp_unit(struct dwarf2_cu *dependent_cu, struct dwarf2_per_cu_data *per_cu, enum language pretend_language)
struct dwarf2_section_names info_dwo
struct dwarf2_section_names info
static const char * dwarf2_physname(const char *name, struct die_info *die, struct dwarf2_cu *cu)
int gdbarch_addr_bit(struct gdbarch *gdbarch)
static struct symbol * new_symbol(struct die_info *, struct type *, struct dwarf2_cu *)
void macro_define_special(struct macro_table *table)
unsigned char building_fullname
static struct dwo_unit * lookup_dwo_type_unit(struct signatured_type *, const char *, const char *)
static void error_check_comp_unit_head(struct comp_unit_head *header, struct dwarf2_section_info *section, struct dwarf2_section_info *abbrev_section)
static int need_gnat_info(struct dwarf2_cu *)
static void dwarf_decode_macro_bytes(bfd *abfd, const gdb_byte *mac_ptr, const gdb_byte *mac_end, struct macro_source_file *current_file, struct line_header *lh, struct dwarf2_section_info *section, int section_is_gnu, int section_is_dwz, unsigned int offset_size, htab_t include_hash)
static void handle_DW_AT_stmt_list(struct die_info *die, struct dwarf2_cu *cu, const char *comp_dir, CORE_ADDR lowpc)
static int find_slot_in_mapped_hash(struct mapped_index *index, const char *name, offset_type **vec_out)
struct dwarf2_section_names frame
struct dwarf2_section_names loc
static void init_cutu_and_read_dies_simple(struct dwarf2_per_cu_data *this_cu, die_reader_func_ftype *die_reader_func, void *data)
static int attr_form_is_section_offset(const struct attribute *)
char * xstrprintf(const char *format,...)
static const gdb_byte * write_constant_as_bytes(struct obstack *obstack, enum bfd_endian byte_order, struct type *type, ULONGEST value, LONGEST *len)
struct nextfield * fields
void wrap_here(char *indent)
struct dwarf2_section_info str_offsets
struct symtab_index_entry ** data
static struct type * die_descriptive_type(struct die_info *, struct dwarf2_cu *)
static unsigned int dwarf_die_debug
static void dwarf2_mark(struct dwarf2_cu *)
int number_of_dependencies
static struct partial_die_info * load_partial_dies(const struct die_reader_specs *, const gdb_byte *, int)
struct cmd_list_element * setdebuglist
#define TYPE_FIELDS(thistype)
static struct type * die_containing_type(struct die_info *, struct dwarf2_cu *)
static int dwarf_record_line_p(unsigned int line, unsigned int last_line, int line_has_non_zero_discriminator, struct subfile *last_subfile)
char * cp_canonicalize_string(const char *string)
void addrmap_set_empty(struct addrmap *map, CORE_ADDR start, CORE_ADDR end_inclusive, void *obj)
static const gdb_byte * read_n_bytes(bfd *, const gdb_byte *, unsigned int)
static struct type * lookup_die_type(struct die_info *, const struct attribute *, struct dwarf2_cu *)
static int offset_type_compare(const void *ap, const void *bp)
unsigned int has_const_value
static void free_stack_comp_unit(void *)
bfd_size_type str_offsets_size
struct dwarf2_per_cu_data per_cu
static void add_partial_symbol(struct partial_die_info *, struct dwarf2_cu *)
unsigned char psymtabs_addrmap_supported
const char * objfile_name(const struct objfile *objfile)
#define FIELD_BITSIZE(thisfld)
struct dwarf2_section_names macro
static void init_lnp_state_machine(lnp_state_machine *state, const lnp_reader_state *reader)
struct compunit_symtab * start_symtab(struct objfile *objfile, const char *name, const char *comp_dir, CORE_ADDR start_addr)
#define TYPE_TAIL_CALL_LIST(thistype)
static CORE_ADDR decode_locdesc(struct dwarf_block *, struct dwarf2_cu *)
struct ui_file * gdb_stdlog
static void add_address_entry(struct objfile *objfile, struct obstack *obstack, CORE_ADDR start, CORE_ADDR end, unsigned int cu_index)
static const char * namespace_name(struct die_info *die, int *is_anonymous, struct dwarf2_cu *)
struct ui_file * mem_fileopen(void)
void symbol_set_demangled_name(struct general_symbol_info *gsymbol, const char *name, struct obstack *obstack)
static int use_deprecated_index_sections
static void dwarf2_const_value(const struct attribute *, struct symbol *, struct dwarf2_cu *)
static void process_die(struct die_info *, struct dwarf2_cu *)
struct partial_symtab * user
unsigned int reading_dwo_directly
char * language_class_name_from_physname(const struct language_defn *lang, const char *physname)
void * read_symtab_private
struct dwarf2_section_info str
bfd_size_type str_offsets_offset
DEF_VEC_O(dwarf2_section_info_def)
void cmd_show_list(struct cmd_list_element *list, int from_tty, const char *prefix)
static const char * read_str_index(const struct die_reader_specs *reader, ULONGEST str_index)
static void find_file_and_directory(struct die_info *die, struct dwarf2_cu *cu, const char **name, const char **comp_dir)
static struct bfd * get_section_bfd_owner(const struct dwarf2_section_info *section)
struct dwarf2_section_names macinfo_dwo
static htab_t allocate_signatured_type_table(struct objfile *objfile)
static void load_partial_comp_unit(struct dwarf2_per_cu_data *this_cu)
#define SYMBOL_VALUE(symbol)
static void free_dwo_file(struct dwo_file *dwo_file, struct objfile *objfile)
unsigned int no_file_data
static struct dwarf2_queue_item * dwarf2_queue
struct partial_symtab * allocate_psymtab(const char *, struct objfile *) ATTRIBUTE_NONNULL(1)
#define TYPE_STUB_SUPPORTED(t)
static int attr_form_is_ref(const struct attribute *)
static void dwarf2_add_member_fn(struct field_info *, struct die_info *, struct type *, struct dwarf2_cu *)
void add_psymbol_to_list(const char *, int, int, domain_enum, enum address_class, struct psymbol_allocation_list *, long, CORE_ADDR, enum language, struct objfile *)
static const char * dwarf2_canonicalize_name(const char *, struct dwarf2_cu *, struct obstack *)
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)
struct type * builtin_int
unsigned long hash(const void *addr, int length)
struct dwarf2_section_names loc_dwo
static void read_lexical_block_scope(struct die_info *, struct dwarf2_cu *)
static struct type * add_array_cv_type(struct die_info *die, struct dwarf2_cu *cu, struct type *base_type, int cnst, int voltl)
static void dwarf_record_line_1(struct gdbarch *gdbarch, struct subfile *subfile, unsigned int line, CORE_ADDR address, record_line_ftype p_record_line)
static void abbrev_table_add_abbrev(struct abbrev_table *abbrev_table, unsigned int abbrev_number, struct abbrev_info *abbrev)
static void dw2_get_file_names_reader(const struct die_reader_specs *reader, const gdb_byte *info_ptr, struct die_info *comp_unit_die, int has_children, void *data)
static struct type * read_tag_atomic_type(struct die_info *die, struct dwarf2_cu *cu)
static const char * read_direct_string(bfd *, const gdb_byte *, unsigned int *)
static void recursively_write_psymbols(struct objfile *objfile, struct partial_symtab *psymtab, struct mapped_symtab *symtab, htab_t psyms_seen, offset_type cu_index)
int blockvector_contains_pc(const struct blockvector *bv, CORE_ADDR pc)
struct dwarf2_offset_baton offset_info
static struct dwarf2_per_cu_data * dwarf2_find_containing_comp_unit(sect_offset offset, unsigned int offset_in_dwz, struct objfile *objfile)
cu_offset type_offset_in_tu
static ULONGEST read_unsigned_leb128(bfd *, const gdb_byte *, unsigned int *)
void * hashtab_obstack_allocate(void *data, size_t size, size_t count)
struct type * create_array_type_with_stride(struct type *result_type, struct type *element_type, struct type *range_type, unsigned int bit_stride)
PTR xrealloc(PTR ptr, size_t size)
static bfd * open_dwo_file(const char *file_name, const char *comp_dir)
#define TYPE_TEMPLATE_ARGUMENTS(thistype)
struct dwarf2_section_names eh_frame
offset_type address_table_size
int dwarf_block_to_dwarf_reg(const gdb_byte *buf, const gdb_byte *buf_end)
#define VEC_truncate(T, V, I)
static int eq_signatured_type(const void *item_lhs, const void *item_rhs)
static void read_comp_units_from_section(struct objfile *objfile, struct dwarf2_section_info *section, unsigned int is_dwz, int *n_allocated, int *n_comp_units, struct dwarf2_per_cu_data ***all_comp_units)
struct dwarf2_section_info tu_index
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)
#define gdb_static_assert(expr)
#define COMPUNIT_BLOCKVECTOR(cust)
static void dwarf2_statement_list_fits_in_line_number_section_complaint(void)
struct symbol * fixup_symbol_section(struct symbol *sym, struct objfile *objfile)
struct dwarf2_section_info macinfo
static const char * dwarf_form_name(unsigned int)
static struct dwo_unit * lookup_dwo_cutu(struct dwarf2_per_cu_data *this_unit, const char *dwo_name, const char *comp_dir, ULONGEST signature, int is_debug_types)
static const gdb_byte * read_and_check_type_unit_head(struct comp_unit_head *header, struct dwarf2_section_info *section, struct dwarf2_section_info *abbrev_section, const gdb_byte *info_ptr, ULONGEST *signature, cu_offset *type_offset_in_tu)
const char const char int
void cp_scan_for_anonymous_namespaces(const struct symbol *const symbol, struct objfile *const objfile)
struct comp_unit_head header
unsigned int may_be_inlined
static int dwarf2_loclist_block_index
void smash_to_methodptr_type(struct type *type, struct type *to_type)
void sort_pst_symbols(struct objfile *, struct partial_symtab *)
static const char * get_section_file_name(const struct dwarf2_section_info *)
int( symbol_compare_ftype)(const char *string1, const char *string2)
#define SYMBOL_SET_NAMES(symbol, linkage_name, len, copy_name, objfile)
struct dwarf2_section_info info
struct dwarf2_section_names addr
struct dwarf2_loclist_baton loclist
unsigned int is_constructor
static const gdb_byte * read_attribute(const struct die_reader_specs *, struct attribute *, struct attr_abbrev *, const gdb_byte *)
static int read_4_signed_bytes(bfd *abfd, const gdb_byte *buf)
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
static LONGEST read_offset(bfd *, const gdb_byte *, const struct comp_unit_head *, unsigned int *)
static char * file_file_name(int file, struct line_header *lh)
struct type * make_cv_type(int cnst, int voltl, struct type *type, struct type **typeptr)
#define SET_TYPE_FIELD_VIRTUAL(thistype, n)
__extension__ enum call_site_parameter_kind kind
void discard_cleanups(struct cleanup *old_chain)
static CORE_ADDR read_address(bfd *, const gdb_byte *ptr, struct dwarf2_cu *, unsigned int *)
struct dwo_file * dwo_file
struct symbol * block_find_symbol(const struct block *block, const char *name, const domain_enum domain, block_symbol_matcher_ftype *matcher, void *data)
static int per_cu_offset_and_type_eq(const void *item_lhs, const void *item_rhs)
static void do_ui_file_peek_last(void *object, const char *buffer, long length)
static int add_signatured_type_cu_to_table(void **slot, void *datum)
static void dw2_forget_cached_source_info(struct objfile *objfile)
const struct language_defn * current_language
#define TYPE_TARGET_TYPE(thistype)
#define DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE(cu_index, value)
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
struct dwarf2_section_info macinfo
__extension__ enum dwarf_tag tag
struct symbol * allocate_symbol(struct objfile *objfile)
static struct type * read_tag_pointer_type(struct die_info *die, struct dwarf2_cu *cu)
struct attribute attrs[1]
static const char * read_indirect_string_at_offset(bfd *abfd, LONGEST str_offset)
static void abbrev_table_free_cleanup(void *)
static struct compunit_symtab * dw2_find_pc_sect_compunit_symtab(struct objfile *objfile, struct bound_minimal_symbol msymbol, CORE_ADDR pc, struct obj_section *section, int warn_if_readin)
static const gdb_byte * read_full_die(const struct die_reader_specs *, struct die_info **, const gdb_byte *, int *)
static void dw2_expand_symtabs_for_function(struct objfile *objfile, const char *func_name)
struct mapped_index * index
static void cleanup_mapped_symtab(void *p)
static int eq_dwp_loaded_cutus(const void *a, const void *b)
struct dwarf2_section_info info
struct mapped_symtab * symtab
static struct type * read_typedef(struct die_info *die, struct dwarf2_cu *cu)
static htab_t allocate_type_unit_groups_table(void)
static struct symbol * new_symbol_full(struct die_info *, struct type *, struct dwarf2_cu *, struct symbol *)
int( expand_symtabs_file_matcher_ftype)(const char *filename, void *data, int basenames)
struct dwarf2_section_names ranges
int xsnprintf(char *str, size_t size, const char *format,...)
static struct compunit_symtab * dw2_instantiate_symtab(struct dwarf2_per_cu_data *per_cu)
static const char * dw2_get_real_path(struct objfile *objfile, struct quick_file_names *qfn, int index)
#define TYPE_CODE(thistype)
static htab_t create_symbol_hash_table(void)
const char * constant_pool
union dwarf2_per_cu_data::@59 v
static void read_call_site_scope(struct die_info *die, struct dwarf2_cu *cu)
static sect_offset dwarf2_get_ref_die_offset(const struct attribute *)
struct partial_symtab ** dependencies
static void dwarf2_attach_fn_fields_to_type(struct field_info *, struct type *, struct dwarf2_cu *)
struct ui_file * gdb_stderr
const offset_type * symbol_table
struct dwarf2_section_info gdb_index
int dwarf2_per_cu_addr_size(struct dwarf2_per_cu_data *per_cu)
struct dwarf2_per_cu_data * per_cu
struct dwo_file * dwo_file
void record_debugformat(const char *format)
static struct type * read_type_die(struct die_info *, struct dwarf2_cu *)
#define TYPE_CALLING_CONVENTION(thistype)
struct complaints * symfile_complaints
static struct type * read_tag_volatile_type(struct die_info *die, struct dwarf2_cu *cu)
static int dwarf2_get_pc_bounds(struct die_info *, CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *, struct partial_symtab *)
const gdb_byte * data_value
static void process_queue(void)
void( make_cleanup_ftype)(void *)
#define DW_SIGNATURE(attr)
void c_print_type(struct type *, const char *, struct ui_file *, int, int, const struct type_print_options *)
static int dwarf2_ranges_read(unsigned, CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *, struct partial_symtab *)
const gdb_byte * dwarf2_fetch_constant_bytes(sect_offset offset, struct dwarf2_per_cu_data *per_cu, struct obstack *obstack, LONGEST *len)
struct call_site_parameter parameter[1]
static void compute_compunit_symtab_includes(struct dwarf2_per_cu_data *per_cu)
static void dwarf_record_line(lnp_reader_state *reader, lnp_state_machine *state, int end_sequence)
const char * host_address_to_string(const void *addr)
struct dwo_sections sections
static CORE_ADDR attr_value_as_address(struct attribute *attr)
void really_free_pendings(void *dummy)
static char * guess_full_die_structure_name(struct die_info *die, struct dwarf2_cu *cu)
#define OBJSTAT(objfile, expr)
static sect_offset read_abbrev_offset(struct dwarf2_section_info *, sect_offset)
static struct type * read_subrange_type(struct die_info *die, struct dwarf2_cu *cu)
static void dwarf_finish_line(struct gdbarch *gdbarch, struct subfile *subfile, CORE_ADDR address, record_line_ftype p_record_line)
static void dwarf2_debug_line_missing_end_sequence_complaint(void)
void _initialize_dwarf2_read(void)
static unsigned int read_1_byte(bfd *, const gdb_byte *)
const struct quick_symbol_functions dwarf2_gdb_index_functions
static void process_psymtab_comp_unit_reader(const struct die_reader_specs *reader, const gdb_byte *info_ptr, struct die_info *comp_unit_die, int has_children, void *data)
static void store_in_ref_table(struct die_info *, struct dwarf2_cu *)
#define HAVE_CPLUS_STRUCT(type)
struct dwarf2_section_info macro
static void free_dwo_files(htab_t dwo_files, struct objfile *objfile)
cu_offset type_offset_in_tu
static void dwarf2_create_include_psymtab(const char *name, struct partial_symtab *pst, struct objfile *objfile)
#define INIT_GNAT_SPECIFIC(type)
#define MAX_NR_V1_DWO_SECTIONS
struct symtab * allocate_symtab(struct compunit_symtab *cust, const char *filename)
#define TYPE_NFIELDS(thistype)
unsigned int is_debug_types
static void process_full_type_unit(struct dwarf2_per_cu_data *, enum language)
#define OPF_RETURN_REALPATH
struct general_symbol_info ginfo
record_line_ftype record_line
struct die_info * sibling
static void add_file_name(struct line_header *lh, const char *name, unsigned int dir_index, unsigned int mod_time, unsigned int length)
struct type * make_type_with_address_space(struct type *type, int space_flag)
static void locate_dwz_sections(bfd *abfd, asection *sectp, void *arg)
static void free_heap_comp_unit(void *)
static int eq_file_name_entry(const void *a, const void *b)
static char * typename_concat(struct obstack *obs, const char *prefix, const char *suffix, int physname, struct dwarf2_cu *cu)
struct dwarf2_section_info loc
#define SYMBOL_LANGUAGE(symbol)
static void parse_macro_definition(struct macro_source_file *file, int line, const char *body)
static int eq_dwo_file(const void *item_lhs, const void *item_rhs)
struct addrmap * addrmap_create_fixed(struct addrmap *original, struct obstack *obstack)
static void dwarf2_locate_sections(bfd *, asection *, void *)
bfd_size_type macinfo_size
CORE_ADDR gdbarch_adjust_dwarf2_line(struct gdbarch *gdbarch, CORE_ADDR addr, int rel)
static const char * read_indirect_string_from_dwz(struct dwz_file *, LONGEST)
#define COMPUNIT_FILETABS(cust)
unsigned short has_children
static void ** lookup_dwo_file_slot(const char *dwo_name, const char *comp_dir)
struct dwo_unit * dwo_unit
static void dwarf2_per_objfile_free(struct objfile *objfile, void *d)
#define VEC_address(T, V)
static struct type * read_namespace_type(struct die_info *die, struct dwarf2_cu *cu)
static void var_decode_location(struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu)
static int attr_to_dynamic_prop(const struct attribute *attr, struct die_info *die, struct dwarf2_cu *cu, struct dynamic_prop *prop)
static hashval_t hash_dwo_file(const void *item)
void start_subfile(const char *name)
struct pending ** list_in_scope
#define SET_TYPE_FIELD_PROTECTED(thistype, n)
#define DW_STRING_IS_CANONICAL(attr)
struct cleanup * make_cleanup_htab_delete(htab_t htab)
const gdb_byte * unit_table
struct dwarf2_section_names types_dwo
static int partial_die_eq(const void *item_lhs, const void *item_rhs)
static struct dwp_file * open_and_init_dwp_file(void)
static void dwarf2_build_include_psymtabs(struct dwarf2_cu *cu, struct die_info *die, struct partial_symtab *pst)
static unsigned int dwarf_read_debug
#define TYPE_TAG_NAME(type)
static struct die_info * dwarf_alloc_die(struct dwarf2_cu *, int)
static void init_cutu_and_read_dies(struct dwarf2_per_cu_data *this_cu, struct abbrev_table *abbrev_table, int use_existing_cu, int keep, die_reader_func_ftype *die_reader_func, void *data)
struct cmd_list_element * save_cmdlist
static void fill_in_loclist_baton(struct dwarf2_cu *cu, struct dwarf2_loclist_baton *baton, const struct attribute *attr)
#define TYPE_TYPEDEF_FIELD(thistype, n)
struct compunit_symtab * compunit_symtab
static int unsigned_int_compar(const void *ap, const void *bp)
static struct signatured_type * add_type_unit(ULONGEST sig, void **slot)
static hashval_t hash_psymtab_cu_index(const void *item)
struct dwarf2_section_info str
struct dwarf2_section_info macinfo
struct partial_symbol ** list
static htab_t allocate_dwp_loaded_cutus_table(struct objfile *objfile)
#define TYPE_FLAG_ENUM(t)
enum dynamic_prop_kind kind
int producer_is_gcc(const char *producer, int *major, int *minor)
struct type_unit_group * type_unit_group
#define SYMBOL_NATURAL_NAME(symbol)
static void create_cus_from_index_list(struct objfile *objfile, const gdb_byte *cu_list, offset_type n_elements, struct dwarf2_section_info *section, int is_dwz, int base_offset)
#define FIELD_NAME(thisfld)
void(* read_symtab)(struct partial_symtab *, struct objfile *)
struct dwarf2_section_names str_dwo
static int die_eq(const void *item_lhs, const void *item_rhs)
static struct dwarf2_section_info * cu_debug_loc_section(struct dwarf2_cu *cu)
static int eq_strtab_entry(const void *a, const void *b)
int gdbarch_bits_big_endian(struct gdbarch *gdbarch)
#define SET_FIELD_DWARF_BLOCK(thisfld, addr)
static struct dwarf2_section_info * get_abbrev_section_for_cu(struct dwarf2_per_cu_data *this_cu)
static const gdb_byte * read_partial_die(const struct die_reader_specs *, struct partial_die_info *, struct abbrev_info *, unsigned int, const gdb_byte *)
unsigned long long ULONGEST
struct dwarf2_section_info loc
unsigned int num_sections
#define TYPE_TYPEDEF_FIELD_COUNT(thistype)
static void load_partial_comp_unit_reader(const struct die_reader_specs *reader, const gdb_byte *info_ptr, struct die_info *comp_unit_die, int has_children, void *data)
struct cleanup * increment_reading_symtab(void)
struct addrmap * psymtabs_addrmap
unsigned int has_template_arguments
#define SYMBOL_SEARCH_NAME(symbol)
void release_value(struct value *val)
struct dwarf2_section_info cu_index
static void dwarf2_clear_marks(struct dwarf2_per_cu_data *)
static void print_tu_stats(void)
static void fill_in_sig_entry_from_dwo_entry(struct objfile *objfile, struct signatured_type *sig_entry, struct dwo_unit *dwo_entry)
static struct compunit_symtab * recursively_find_pc_sect_compunit_symtab(struct compunit_symtab *cust, CORE_ADDR pc)
static void recursively_compute_inclusions(VEC(compunit_symtab_ptr)**result, htab_t all_children, htab_t all_type_symtabs, struct dwarf2_per_cu_data *per_cu, struct compunit_symtab *immediate_parent)
static void write_hash_table(struct mapped_symtab *symtab, struct obstack *output, struct obstack *cpool)
static const char * partial_die_parent_scope(struct partial_die_info *pdi, struct dwarf2_cu *cu)
static void dwarf2_symbol_mark_computed(const struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu, int is_block)
static void set_descriptive_type(struct type *, struct die_info *, struct dwarf2_cu *)
static const gdb_byte * read_comp_unit_head(struct comp_unit_head *cu_header, const gdb_byte *info_ptr, bfd *abfd)
static const gdb_byte * skip_unknown_opcode(unsigned int opcode, const gdb_byte **opcode_definitions, const gdb_byte *mac_ptr, const gdb_byte *mac_end, bfd *abfd, unsigned int offset_size, struct dwarf2_section_info *section)
static void free_cu_line_header(void *arg)
#define obstack_grow_str0(OBSTACK, STRING)
struct macro_source_file * macro_set_main(struct macro_table *t, const char *filename)
static void add_partial_subprogram(struct partial_die_info *pdi, CORE_ADDR *lowpc, CORE_ADDR *highpc, int need_pc, struct dwarf2_cu *cu)
#define SYMBOL_INLINED(symbol)
void c_printchar(int c, struct type *type, struct ui_file *stream)
static struct type * build_error_marker_type(struct dwarf2_cu *cu, struct die_info *die)
static struct attribute * dwarf2_attr_no_follow(struct die_info *, unsigned int)
static void dwarf2_add_typedef(struct field_info *fip, struct die_info *die, struct dwarf2_cu *cu)
#define TYPE_ALLOC(t, size)
static void dwarf2_attach_fields_to_type(struct field_info *, struct type *, struct dwarf2_cu *)
#define SYMBOL_TYPE(symbol)
static void add_include_dir(struct line_header *lh, const char *include_dir)
static struct dwarf2_section_info * get_containing_section(const struct dwarf2_section_info *section)
struct call_site * tail_call_next
static enum dwarf_array_dim_ordering read_array_order(struct die_info *, struct dwarf2_cu *)
struct type * lookup_reference_type(struct type *type)
static int free_dwo_file_from_slot(void **slot, void *info)
static int offset_in_cu_p(const struct comp_unit_head *cu_header, sect_offset offset)
struct cmd_list_element * showdebuglist
static const char * determine_prefix(struct die_info *die, struct dwarf2_cu *)
#define TYPE_CPLUS_REALLY_JAVA(thistype)
static struct cmd_list_element * show_dwarf_cmdlist
static int eq_dwo_unit(const void *item_lhs, const void *item_rhs)
struct type * dwarf2_get_die_type(cu_offset die_offset, struct dwarf2_per_cu_data *per_cu)
static struct die_info * dwarf2_extension(struct die_info *die, struct dwarf2_cu **)
struct typedef_field field
static int check_physname
struct context_stack * push_context(int desc, CORE_ADDR valu)
static int dwarf2_read_index(struct objfile *objfile)
const gdb_byte * gdb_bfd_map_section(asection *sectp, bfd_size_type *size)
#define TYPE_FN_FIELDLISTS(thistype)
static void dwarf2_add_field(struct field_info *, struct die_info *, struct dwarf2_cu *)
struct type * lookup_methodptr_type(struct type *to_type)
void * addrmap_find(struct addrmap *map, CORE_ADDR addr)
bfd * build_id_to_debug_bfd(size_t build_id_len, const bfd_byte *build_id)
struct quick_file_names * file_names
#define TYPE_FN_FIELDLIST_NAME(thistype, n)
#define OBSTACK_ZALLOC(OBSTACK, TYPE)
CORE_ADDR dwarf2_per_cu_text_offset(struct dwarf2_per_cu_data *per_cu)
const char * type_name_no_tag(const struct type *type)
struct abbrev_info * next
#define TYPE_LENGTH(thistype)
#define MAX_NR_V2_DWO_SECTIONS
struct typedef_field_list * typedef_field_list
struct type * make_atomic_type(struct type *type)
struct subfile * last_subfile
#define SYMBOL_SECTION(symbol)
static void dwarf2_add_dependence(struct dwarf2_cu *, struct dwarf2_per_cu_data *)
static void show_dwarf_cmd(char *args, int from_tty)
unsigned int is_artificial
#define TYPE_ZALLOC(t, size)
static struct partial_symtab * create_partial_symtab(struct dwarf2_per_cu_data *per_cu, const char *name)
struct dwarf2_section_info * die_section
static void show_dwarf_max_cache_age(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static LONGEST dwarf2_get_attr_constant_value(const struct attribute *, int)
struct compunit_symtab * compunit_symtab
static void load_cu(struct dwarf2_per_cu_data *per_cu)
struct nextfield * baseclasses
struct dwo_file * dwo_file
struct nextfnfield * fnfields
#define TYPE_FN_FIELDLIST_LENGTH(thistype, n)
static int is_type_tag_for_partial(int tag)
struct section_offsets * section_offsets
#define FIELD_BITPOS(thisfld)
static struct dwo_file * open_and_init_dwo_file(struct dwarf2_per_cu_data *per_cu, const char *dwo_name, const char *comp_dir)
void gdb_flush(struct ui_file *file)
#define SYMBOL_VALUE_BYTES(symbol)
struct line_header * line_header
const struct dwp_hash_table * cus
const struct symbol_computed_ops dwarf2_loclist_funcs
static void dw2_dump(struct objfile *objfile)
static struct dwo_unit * create_dwo_cu(struct dwo_file *dwo_file)
static void free_one_cached_comp_unit(struct dwarf2_per_cu_data *)
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 dwo_unit * lookup_dwo_comp_unit(struct dwarf2_per_cu_data *, const char *, const char *, ULONGEST)
static hashval_t hash_stmt_list_entry(const struct stmt_list_hash *stmt_list_hash)
struct cleanup * make_cleanup_obstack_free(struct obstack *obstack)
sect_offset type_offset_in_section
static void dwarf2_start_subfile(const char *, const char *)
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 void init_tu_and_read_dwo_dies(struct dwarf2_per_cu_data *this_cu, int use_existing_cu, int keep, die_reader_func_ftype *die_reader_func, void *data)
struct compunit_symtab * user
unsigned int initial_length_size
#define TYPE_DECLARED_CLASS(t)
static void dwarf2_invalid_attrib_class_complaint(const char *arg1, const char *arg2)
#define TYPE_DESCRIPTIVE_TYPE(thistype)
static int process_skeletonless_type_unit(void **slot, void *info)
unsigned int is_protected
#define TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL
static const char * dwarf2_compute_name(const char *name, struct die_info *die, struct dwarf2_cu *cu, int physname)
static int get_section_flags(const struct dwarf2_section_info *section)
PTR xcalloc(size_t number, size_t size)
unsigned int fixup_called
struct symtab * symbol_symtab(const struct symbol *symbol)
struct dwarf2_section_info str_offsets
void record_producer(const char *producer)
struct obstack * addr_obstack
struct cmd_list_element * maintenance_show_cmdlist
struct call_site_target target
static void load_full_comp_unit(struct dwarf2_per_cu_data *, enum language)
static void inherit_abstract_dies(struct die_info *die, struct dwarf2_cu *cu)
static int dw2_has_symbols(struct objfile *objfile)
struct obstack abbrev_obstack
static hashval_t hash_strtab_entry(const void *e)
sect_offset abbrev_offset
struct dwo_unit * dwo_unit
static int read_index_from_section(struct objfile *objfile, const char *filename, int deprecated_ok, struct dwarf2_section_info *section, struct mapped_index *map, const gdb_byte **cu_list, offset_type *cu_list_elements, const gdb_byte **types_list, offset_type *types_list_elements)
static struct abbrev_table * abbrev_table_read_table(struct dwarf2_section_info *, sect_offset)
static char * copy_string(const char *buf, int len)
struct dwarf2_section_names str
static struct dwp_hash_table * create_dwp_hash_table(struct dwp_file *dwp_file, int is_debug_types)
static struct dwarf2_per_cu_data * dw2_get_cutu(int index)
int dwarf_block_to_sp_offset(struct gdbarch *gdbarch, const gdb_byte *buf, const gdb_byte *buf_end, CORE_ADDR *sp_offset_return)
static struct type * read_array_type(struct die_info *die, struct dwarf2_cu *cu)
static void quirk_gcc_member_function_pointer(struct type *type, struct objfile *objfile)
struct dwarf2_section_info line
void make_vector_type(struct type *array_type)
void error(const char *fmt,...)
static int prototyped_function_p(struct die_info *die, struct dwarf2_cu *cu)
static hashval_t line_header_hash(const struct line_header *ofs)
static LONGEST read_initial_length(bfd *, const gdb_byte *, unsigned int *)
void macro_undef(struct macro_source_file *source, int line, const char *name)
static int read_namespace_alias(struct die_info *die, struct dwarf2_cu *cu)
static hashval_t per_cu_offset_and_type_hash(const void *item)
static void dw2_print_stats(struct objfile *objfile)
static struct dwo_unit * lookup_dwo_unit_in_dwp(struct dwp_file *dwp_file, const char *comp_dir, ULONGEST signature, int is_debug_types)
CORE_ADDR previous_cu_start
static const gdb_byte * locate_pdi_sibling(const struct die_reader_specs *reader, struct partial_die_info *orig_pdi, const gdb_byte *info_ptr)
union call_site_parameter_u u
struct type * lookup_pointer_type(struct type *type)
struct dwarf2_section_info abbrev
unsigned int is_declaration
void( symbol_filename_ftype)(const char *filename, const char *fullname, void *data)
sect_offset abbrev_offset
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 void process_skeletonless_type_units(struct objfile *objfile)
struct obstack * types_list
static void read_namespace(struct die_info *die, struct dwarf2_cu *)
static struct type * read_tag_string_type(struct die_info *die, struct dwarf2_cu *cu)
static const gdb_byte * dwarf_parse_macro_header(const gdb_byte **opcode_definitions, bfd *abfd, const gdb_byte *mac_ptr, unsigned int *offset_size, int section_is_gnu)
static void init_one_comp_unit(struct dwarf2_cu *cu, struct dwarf2_per_cu_data *per_cu)
static const char * dwarf_type_encoding_name(unsigned int)
void do_cleanups(struct cleanup *old_chain)
void add_setshow_boolean_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
#define FIELD_TYPE(thisfld)
static void create_cus_from_index(struct objfile *objfile, const gdb_byte *cu_list, offset_type cu_list_elements, const gdb_byte *dwz_list, offset_type dwz_elements)
#define SYMBOL_LOCATION_BATON(symbol)
static int create_all_type_units(struct objfile *)
struct type * lookup_function_type(struct type *type)
static htab_t allocate_dwo_file_hash_table(void)
#define SYMBOL_IS_ARGUMENT(symbol)
struct partial_symtab * psymtabs
static hashval_t mapped_index_string_hash(int index_version, const void *p)
static void read_signatured_type(struct signatured_type *)
static void process_imported_unit_die(struct die_info *die, struct dwarf2_cu *cu)
static void create_signatured_type_table_from_index(struct objfile *objfile, struct dwarf2_section_info *section, const gdb_byte *bytes, offset_type elements)
#define SET_FIELD_PHYSNAME(thisfld, name)
struct block * finish_block(struct symbol *symbol, struct pending **listhead, struct pending_block *old_blocks, CORE_ADDR start, CORE_ADDR end)
static struct abbrev_info * abbrev_table_lookup_abbrev(const struct abbrev_table *, unsigned int)
struct dwp_hash_table::@60::@62 v2
static offset_type add_string(htab_t table, struct obstack *cpool, const char *str)
static void process_cu_includes(void)
const ULONGEST const LONGEST len
static void add_partial_namespace(struct partial_die_info *pdi, CORE_ADDR *lowpc, CORE_ADDR *highpc, int set_addrmap, struct dwarf2_cu *cu)