Lines Matching refs:die

242     /* Pointer to the first die of this compilatio unit.  This will
332 /* A hash table of die offsets for following references. */
512 /* This data structure holds a complete die structure. */
515 enum dwarf_tag tag; /* Tag indicating type of die */
520 struct die_info *next_ref; /* Next die in ref hash table */
523 points to this die's parent; CHILD points to the first child of
525 together via their SIBLING fields, terminated by a die whose
582 /* A zeroed version of a partial die for initialization purposes. */
823 static int dwarf2_flag_true_p (struct die_info *die, unsigned name,
828 static struct die_info *die_specification (struct die_info *die,
864 static char *determine_prefix (struct die_info *die, struct dwarf2_cu *);
873 static void read_subrange_type (struct die_info *die, struct dwarf2_cu *cu);
905 static char *determine_class_name (struct die_info *die, struct dwarf2_cu *cu);
909 static void read_namespace (struct die_info *die, struct dwarf2_cu *);
911 static const char *namespace_name (struct die_info *die,
960 static char *dwarf2_name (struct die_info *die, struct dwarf2_cu *);
962 static struct die_info *dwarf2_extension (struct die_info *die,
1453 /* Read the compilation unit die */
1586 /* Read the compilation unit die. */
1749 /* If the die has a sibling, skip to the sibling. */
2012 /* Determine whether a die of type TAG living in a C++ class or
2014 name listed in the die. */
2034 /* Read a partial die corresponding to a namespace; also, add a symbol
2111 /* Read a partial die corresponding to an enumeration type. */
2135 /* Read the initial uleb128 in the die at INFO_PTR in compilation unit CU.
2615 /* Process a die and its children. */
2618 process_die (struct die_info *die, struct dwarf2_cu *cu)
2620 switch (die->tag)
2625 read_file_scope (die, cu);
2628 read_subroutine_type (die, cu);
2629 read_func_scope (die, cu);
2639 read_lexical_block_scope (die, cu);
2644 read_structure_type (die, cu);
2645 process_structure_scope (die, cu);
2648 read_enumeration_type (die, cu);
2649 process_enumeration_scope (die, cu);
2652 /* FIXME drow/2004-03-14: These initialize die->type, but do not create
2656 read_subroutine_type (die, cu);
2659 read_array_type (die, cu);
2662 read_tag_pointer_type (die, cu);
2665 read_tag_ptr_to_member_type (die, cu);
2668 read_tag_reference_type (die, cu);
2671 read_tag_string_type (die, cu);
2676 read_base_type (die, cu);
2679 new_symbol (die, die->type, cu);
2682 read_subrange_type (die, cu);
2685 new_symbol (die, die->type, cu);
2688 read_common_block (die, cu);
2694 read_namespace (die, cu);
2705 gdb_assert (die->child == NULL);
2708 new_symbol (die, NULL, cu);
2720 read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
2737 get_scope_pc_bounds (die, &lowpc, &highpc, cu);
2746 attr = dwarf2_attr (die, DW_AT_name, cu);
2751 attr = dwarf2_attr (die, DW_AT_comp_dir, cu);
2766 attr = dwarf2_attr (die, DW_AT_language, cu);
2772 attr = dwarf2_attr (die, DW_AT_producer, cu);
2796 if (die->child != NULL)
2798 child_die = die->child;
2807 attr = dwarf2_attr (die, DW_AT_stmt_list, cu);
2824 attr = dwarf2_attr (die, DW_AT_macro_info, cu);
2857 read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
2872 name = dwarf2_linkage_name (die, cu);
2876 if (name == NULL || !dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu))
2882 struct die_info *spec_die = die_specification (die, cu);
2900 DW_AT_specification // refers to die #3
2902 Thus, when processing die #4, we have to pretend that we're
2904 of die #3. */
2921 new->name = new_symbol (die, die->type, cu);
2925 attr = dwarf2_attr (die, DW_AT_frame_base, cu);
2940 if (die->child != NULL)
2942 child_die = die->child;
2976 read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
2991 if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu))
2997 if (die->child != NULL)
2999 child_die = die->child;
3016 /* Get low and high pc attributes from a die. Return 1 if the attributes
3020 dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
3031 attr = dwarf2_attr (die, DW_AT_high_pc, cu);
3035 attr = dwarf2_attr (die, DW_AT_low_pc, cu);
3047 attr = dwarf2_attr (die, DW_AT_ranges, cu);
3180 get_scope_pc_bounds (struct die_info *die,
3188 if (dwarf2_get_pc_bounds (die, &current_low, &current_high, cu))
3195 struct die_info *child = die->child;
3240 dwarf2_add_field (struct field_info *fip, struct die_info *die,
3260 if (die->tag != DW_TAG_inheritance)
3266 attr = dwarf2_attr (die, DW_AT_accessibility, cu);
3271 attr = dwarf2_attr (die, DW_AT_virtuality, cu);
3277 if (die->tag == DW_TAG_member && ! die_is_declaration (die, cu))
3282 fp->type = die_type (die, cu);
3287 attr = dwarf2_attr (die, DW_AT_bit_size, cu);
3298 attr = dwarf2_attr (die, DW_AT_data_member_location, cu);
3306 attr = dwarf2_attr (die, DW_AT_bit_offset, cu);
3329 attr = dwarf2_attr (die, DW_AT_byte_size, cu);
3351 attr = dwarf2_attr (die, DW_AT_name, cu);
3361 if (dwarf2_attr (die, DW_AT_artificial, cu))
3367 else if (die->tag == DW_TAG_member || die->tag == DW_TAG_variable)
3379 attr = dwarf2_attr (die, DW_AT_name, cu);
3386 physname = dwarf2_linkage_name (die, cu);
3391 FIELD_TYPE (*fp) = die_type (die, cu);
3394 else if (die->tag == DW_TAG_inheritance)
3397 attr = dwarf2_attr (die, DW_AT_data_member_location, cu);
3403 FIELD_TYPE (*fp) = die_type (die, cu);
3499 dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
3512 attr = dwarf2_attr (die, DW_AT_name, cu);
3519 physname = dwarf2_linkage_name (die, cu);
3564 if (die->type && TYPE_CODE (die->type) == TYPE_CODE_FUNC)
3566 int nparams = TYPE_NFIELDS (die->type);
3571 TYPE_TARGET_TYPE (die->type),
3572 TYPE_FIELDS (die->type),
3573 TYPE_NFIELDS (die->type),
3574 TYPE_VARARGS (die->type));
3582 if (nparams == 0 || TYPE_FIELD_ARTIFICIAL (die->type, 0) == 0)
3590 if (dwarf2_attr (die, DW_AT_containing_type, cu) != NULL)
3591 fnp->fcontext = die_containing_type (die, cu);
3597 attr = dwarf2_attr (die, DW_AT_accessibility, cu);
3612 attr = dwarf2_attr (die, DW_AT_artificial, cu);
3617 attr = dwarf2_attr (die, DW_AT_vtable_elem_location, cu);
3708 read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
3716 if (die->type)
3722 attr = dwarf2_attr (die, DW_AT_name, cu);
3728 char *new_prefix = determine_class_name (die, cu);
3743 if (die->tag == DW_TAG_structure_type)
3747 else if (die->tag == DW_TAG_union_type)
3758 attr = dwarf2_attr (die, DW_AT_byte_size, cu);
3768 if (die_is_declaration (die, cu))
3771 /* We need to add the type field to the die immediately so we don't
3774 set_die_type (die, type, cu);
3776 if (die->child != NULL && ! die_is_declaration (die, cu))
3784 child_die = die->child;
3823 if (dwarf2_attr (die, DW_AT_containing_type, cu) != NULL)
3825 struct type *t = die_containing_type (die, cu);
3869 process_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
3873 struct die_info *child_die = die->child;
3875 if (TYPE_TAG_NAME (die->type) != NULL)
3876 processing_current_prefix = TYPE_TAG_NAME (die->type);
3879 snapshots) has been known to create a die giving a declaration
3880 for a class that has, as a child, a die giving a definition for a
3882 current die is a declaration. Normally, of course, a declaration
3899 if (die->child != NULL && ! die_is_declaration (die, cu))
3900 new_symbol (die, die->type, cu);
3905 /* Given a DW_AT_enumeration_type die, set its type. We do not
3909 read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu)
3915 if (die->type)
3921 attr = dwarf2_attr (die, DW_AT_name, cu);
3940 attr = dwarf2_attr (die, DW_AT_byte_size, cu);
3950 set_die_type (die, type, cu);
3958 determine_class_name (struct die_info *die, struct dwarf2_cu *cu)
3961 struct die_info *spec_die = die_specification (die, cu);
3965 die, then processing_current_prefix may not be accurate; see
3981 for (child = die->child;
4000 const char *name = dwarf2_name (die, cu);
4012 /* Given a pointer to a die which begins an enumeration, process all
4019 process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
4031 if (die->child != NULL)
4033 child_die = die->child;
4045 sym = new_symbol (child_die, die->type, cu);
4072 TYPE_NFIELDS (die->type) = num_fields;
4073 TYPE_FIELDS (die->type) = (struct field *)
4074 TYPE_ALLOC (die->type, sizeof (struct field) * num_fields);
4075 memcpy (TYPE_FIELDS (die->type), fields,
4080 TYPE_FLAGS (die->type) |= TYPE_FLAG_UNSIGNED;
4083 new_symbol (die, die->type, cu);
4091 read_array_type (struct die_info *die, struct dwarf2_cu *cu)
4103 if (die->type)
4108 element_type = die_type (die, cu);
4112 if (die->child == NULL)
4116 set_die_type (die, create_array_type (NULL, element_type, range_type),
4122 child_die = die->child;
4152 if (read_array_order (die, cu) == DW_ORD_col_major)
4170 attr = dwarf2_attr (die, DW_AT_GNU_vector, cu);
4176 /* Install the type in the die. */
4177 set_die_type (die, type, cu);
4181 read_array_order (struct die_info *die, struct dwarf2_cu *cu)
4185 attr = dwarf2_attr (die, DW_AT_ordering, cu);
4218 read_common_block (struct die_info *die, struct dwarf2_cu *cu)
4225 attr = dwarf2_attr (die, DW_AT_location, cu);
4243 if (die->child != NULL)
4245 child_die = die->child;
4264 read_namespace (struct die_info *die, struct dwarf2_cu *cu)
4273 name = namespace_name (die, &is_anonymous, cu);
4292 if (dwarf2_extension (die, cu) == NULL)
4303 new_symbol (die, type, cu);
4304 set_die_type (die, type, cu);
4312 if (die->child != NULL)
4314 struct die_info *child_die = die->child;
4332 namespace_name (struct die_info *die, int *is_anonymous, struct dwarf2_cu *cu)
4339 for (current_die = die;
4341 current_die = dwarf2_extension (die, cu))
4361 read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu)
4369 if (die->type)
4374 type = lookup_pointer_type (die_type (die, cu));
4376 attr_byte_size = dwarf2_attr (die, DW_AT_byte_size, cu);
4382 attr_address_class = dwarf2_attr (die, DW_AT_address_class, cu);
4411 set_die_type (die, type, cu);
4418 read_tag_ptr_to_member_type (struct die_info *die, struct dwarf2_cu *cu)
4425 if (die->type)
4431 to_type = die_type (die, cu);
4432 domain = die_containing_type (die, cu);
4435 set_die_type (die, type, cu);
4442 read_tag_reference_type (struct die_info *die, struct dwarf2_cu *cu)
4448 if (die->type)
4453 type = lookup_reference_type (die_type (die, cu));
4454 attr = dwarf2_attr (die, DW_AT_byte_size, cu);
4463 set_die_type (die, type, cu);
4467 read_tag_const_type (struct die_info *die, struct dwarf2_cu *cu)
4471 if (die->type)
4476 base_type = die_type (die, cu);
4477 set_die_type (die, make_cv_type (1, TYPE_VOLATILE (base_type), base_type, 0),
4482 read_tag_volatile_type (struct die_info *die, struct dwarf2_cu *cu)
4486 if (die->type)
4491 base_type = die_type (die, cu);
4492 set_die_type (die, make_cv_type (TYPE_CONST (base_type), 1, base_type, 0),
4502 read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
4509 if (die->type)
4514 attr = dwarf2_attr (die, DW_AT_string_length, cu);
4522 attr = dwarf2_attr (die, DW_AT_byte_size, cu);
4545 set_die_type (die, type, cu);
4560 read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
4567 if (die->type)
4571 type = die_type (die, cu);
4575 attr = dwarf2_attr (die, DW_AT_prototyped, cu);
4581 if (die->child != NULL)
4590 child_die = die->child;
4605 child_die = die->child;
4627 set_die_type (die, ftype, cu);
4631 read_typedef (struct die_info *die, struct dwarf2_cu *cu)
4637 if (!die->type)
4639 attr = dwarf2_attr (die, DW_AT_name, cu);
4644 set_die_type (die, init_type (TYPE_CODE_TYPEDEF, 0,
4647 TYPE_TARGET_TYPE (die->type) = die_type (die, cu);
4652 it in the TYPE field of the die. */
4655 read_base_type (struct die_info *die, struct dwarf2_cu *cu)
4662 /* If we've already decoded this die, this is a no-op. */
4663 if (die->type)
4668 attr = dwarf2_attr (die, DW_AT_encoding, cu);
4673 attr = dwarf2_attr (die, DW_AT_byte_size, cu);
4678 attr = dwarf2_attr (die, DW_AT_name, cu);
4734 set_die_type (die, type, cu);
4740 read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
4748 /* If we have already decoded this die, then nothing more to do. */
4749 if (die->type)
4752 base_type = die_type (die, cu);
4772 attr = dwarf2_attr (die, DW_AT_lower_bound, cu);
4776 attr = dwarf2_attr (die, DW_AT_upper_bound, cu);
4800 attr = dwarf2_attr (die, DW_AT_name, cu);
4804 attr = dwarf2_attr (die, DW_AT_byte_size, cu);
4808 set_die_type (die, range_type, cu);
4820 /* Read a single die and all its descendents. Set the die's sibling
4821 field to NULL; set other fields in the die correctly, and set all
4824 is the parent of the die in question. */
4832 struct die_info *die;
4836 cur_ptr = read_full_die (&die, abfd, info_ptr, cu, &has_children);
4837 store_in_ref_table (die->offset, die, cu);
4841 die->child = read_die_and_siblings (cur_ptr, abfd, cu,
4842 new_info_ptr, die);
4846 die->child = NULL;
4850 die->sibling = NULL;
4851 die->parent = parent;
4852 return die;
4855 /* Read a die, all of its descendents, and all of its siblings; set
4873 struct die_info *die
4878 first_die = die;
4882 last_sibling->sibling = die;
4885 if (die->tag == 0)
4892 last_sibling = die;
4902 struct die_info *die, *next;
4904 die = dies;
4905 while (die)
4907 if (die->child != NULL)
4908 free_die_list (die->child);
4909 next = die->sibling;
4910 xfree (die->attrs);
4911 xfree (die);
4912 die = next;
5312 /* Read a minimal amount of information into the minimal die structure. */
5518 /* Read the die from the .debug_info section buffer. Set DIEP to
5519 point to a newly allocated die with its information, except for its
5521 whether the die has children or not. */
5529 struct die_info *die;
5536 die = dwarf_alloc_die ();
5537 die->tag = 0;
5538 die->abbrev = abbrev_number;
5539 die->type = NULL;
5540 *diep = die;
5552 die = dwarf_alloc_die ();
5553 die->offset = offset;
5554 die->tag = abbrev->tag;
5555 die->abbrev = abbrev_number;
5556 die->type = NULL;
5558 die->num_attrs = abbrev->num_attrs;
5559 die->attrs = (struct attribute *)
5560 xmalloc (die->num_attrs * sizeof (struct attribute));
5564 info_ptr = read_attribute (&die->attrs[i], &abbrev->attrs[i],
5570 if (die->attrs[i].form == DW_FORM_ref_addr
5571 && (DW_ADDR (&die->attrs[i]) < cu->header.offset
5572 || (DW_ADDR (&die->attrs[i])
5576 per_cu = dwarf2_find_containing_comp_unit (DW_ADDR (&die->attrs[i]),
5600 *diep = die;
6113 dwarf2_attr (struct die_info *die, unsigned int name, struct dwarf2_cu *cu)
6118 for (i = 0; i < die->num_attrs; ++i)
6120 if (die->attrs[i].name == name)
6121 return &die->attrs[i];
6122 if (die->attrs[i].name == DW_AT_specification
6123 || die->attrs[i].name == DW_AT_abstract_origin)
6124 spec = &die->attrs[i];
6128 return dwarf2_attr (follow_die_ref (die, spec, cu), name, cu);
6138 dwarf2_flag_true_p (struct die_info *die, unsigned name, struct dwarf2_cu *cu)
6140 struct attribute *attr = dwarf2_attr (die, name, cu);
6146 die_is_declaration (struct die_info *die, struct dwarf2_cu *cu)
6155 return (dwarf2_flag_true_p (die, DW_AT_declaration, cu)
6156 && dwarf2_attr (die, DW_AT_specification, cu) == NULL);
6159 /* Return the die giving the specification for DIE, if there is
6163 die_specification (struct die_info *die, struct dwarf2_cu *cu)
6165 struct attribute *spec_attr = dwarf2_attr (die, DW_AT_specification, cu);
6170 return follow_die_ref (die, spec_attr, cu);
6724 If TYPE is NULL, determine symbol type from the die, otherwise
6728 new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
6739 if (die->tag != DW_TAG_namespace)
6740 name = dwarf2_linkage_name (die, cu);
6756 Use the passed type or decode it from the die. */
6762 SYMBOL_TYPE (sym) = die_type (die, cu);
6763 attr = dwarf2_attr (die, DW_AT_decl_line, cu);
6768 switch (die->tag)
6771 attr = dwarf2_attr (die, DW_AT_low_pc, cu);
6782 attr2 = dwarf2_attr (die, DW_AT_external, cu);
6801 attr = dwarf2_attr (die, DW_AT_const_value, cu);
6805 attr2 = dwarf2_attr (die, DW_AT_external, cu);
6812 attr = dwarf2_attr (die, DW_AT_location, cu);
6816 attr2 = dwarf2_attr (die, DW_AT_external, cu);
6830 attr2 = dwarf2_attr (die, DW_AT_external, cu);
6832 && dwarf2_attr (die, DW_AT_type, cu) != NULL)
6840 attr = dwarf2_attr (die, DW_AT_location, cu);
6848 attr = dwarf2_attr (die, DW_AT_const_value, cu);
6954 attr = dwarf2_attr (die, DW_AT_const_value, cu);
6983 dwarf_tag_name (die->tag));
7093 /* Return the type of the die in question using its DW_AT_type attribute. */
7096 die_type (struct die_info *die, struct dwarf2_cu *cu)
7102 type_attr = dwarf2_attr (die, DW_AT_type, cu);
7109 type_die = follow_die_ref (die, type_attr, cu);
7115 error ("Dwarf Error: Problem turning type die at offset into gdb type [in module %s]",
7121 /* Return the containing type of the die in question using its
7125 die_containing_type (struct die_info *die, struct dwarf2_cu *cu)
7131 type_attr = dwarf2_attr (die, DW_AT_containing_type, cu);
7134 type_die = follow_die_ref (die, type_attr, cu);
7148 tag_type_to_type (struct die_info *die, struct dwarf2_cu *cu)
7150 if (die->type)
7152 return die->type;
7156 read_type_die (die, cu);
7157 if (!die->type)
7159 dump_die (die);
7160 error ("Dwarf Error: Cannot find type of die [in module %s]",
7163 return die->type;
7168 read_type_die (struct die_info *die, struct dwarf2_cu *cu)
7170 char *prefix = determine_prefix (die, cu);
7175 switch (die->tag)
7180 read_structure_type (die, cu);
7183 read_enumeration_type (die, cu);
7187 read_subroutine_type (die, cu);
7190 read_array_type (die, cu);
7193 read_tag_pointer_type (die, cu);
7196 read_tag_ptr_to_member_type (die, cu);
7199 read_tag_reference_type (die, cu);
7202 read_tag_const_type (die, cu);
7205 read_tag_volatile_type (die, cu);
7208 read_tag_string_type (die, cu);
7211 read_typedef (die, cu);
7214 read_subrange_type (die, cu);
7217 read_base_type (die, cu);
7221 dwarf_tag_name (die->tag));
7237 determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
7245 parent = die->parent;
7456 /* Return sibling of die, NULL if no sibling. */
7459 sibling_die (struct die_info *die)
7461 return die->sibling;
7464 /* Get linkage name of a die, return NULL if not found. */
7467 dwarf2_linkage_name (struct die_info *die, struct dwarf2_cu *cu)
7471 attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu);
7474 attr = dwarf2_attr (die, DW_AT_name, cu);
7480 /* Get name of a die, return NULL if not found. */
7483 dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
7487 attr = dwarf2_attr (die, DW_AT_name, cu);
7493 /* Return the die that this die in an extension of, or NULL if there
7497 dwarf2_extension (struct die_info *die, struct dwarf2_cu *cu)
7501 attr = dwarf2_attr (die, DW_AT_extension, cu);
7505 return follow_die_ref (die, attr, cu);
8314 dump_die (struct die_info *die)
8319 dwarf_tag_name (die->tag), die->abbrev, die->offset);
8321 dwarf_bool_name (die->child != NULL));
8324 for (i = 0; i < die->num_attrs; ++i)
8327 dwarf_attr_name (die->attrs[i].name),
8328 dwarf_form_name (die->attrs[i].form));
8329 switch (die->attrs[i].form)
8334 print_address_numeric (DW_ADDR (&die->attrs[i]), 1, gdb_stderr);
8340 fprintf_unfiltered (gdb_stderr, "block: size %d", DW_BLOCK (&die->attrs[i])->size);
8346 (long) (DW_ADDR (&die->attrs[i])));
8354 fprintf_unfiltered (gdb_stderr, "constant: %ld", DW_UNSND (&die->attrs[i]));
8359 DW_STRING (&die->attrs[i])
8360 ? DW_STRING (&die->attrs[i]) : "");
8363 if (DW_UNSND (&die->attrs[i]))
8375 die->attrs[i].form);
8382 dump_die_list (struct die_info *die)
8384 while (die)
8386 dump_die (die);
8387 if (die->child != NULL)
8388 dump_die_list (die->child);
8389 if (die->sibling != NULL)
8390 dump_die_list (die->sibling);
8395 store_in_ref_table (unsigned int offset, struct die_info *die,
8403 die->next_ref = old;
8404 cu->die_ref_table[h] = die;
8424 "unsupported die ref attribute form: '%s'",
8456 struct die_info *die;
8476 die = target_cu->die_ref_table[h];
8477 while (die)
8479 if (die->offset == offset)
8480 return die;
8481 die = die->next_ref;
8765 struct die_info *die;
8767 die = (struct die_info *) xmalloc (sizeof (struct die_info));
8768 memset (die, 0, sizeof (struct die_info));
8769 return (die);
9441 set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
9445 die->type = type;
9460 ofs.offset = die->offset;
9472 get_die_type (struct die_info *die, htab_t type_hash)
9476 ofs.offset = die->offset;
9490 struct die_info *die;
9495 for (die = start_die; die != NULL; die = die->sibling)
9497 die->type = get_die_type (die, cu->per_cu->type_hash);
9498 if (die->child != NULL)
9499 reset_die_and_siblings_types (die->child, cu);