aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/dwarf2out.c81
-rw-r--r--gcc/dwarf2out.h44
2 files changed, 82 insertions, 43 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 9a91981..e10006c 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -1332,12 +1332,6 @@ dwarf2out_switch_text_section (void)
/* And now, the subset of the debugging information support code necessary
for emitting location expressions. */
-/* Data about a single source file. */
-struct GTY((for_user)) dwarf_file_data {
- const char * filename;
- int emitted_number;
-};
-
/* Describe an entry into the .debug_addr section. */
enum ate_kind {
@@ -3123,17 +3117,6 @@ maybe_reset_location_view (rtx_insn *insn, dw_line_info_table *table)
RESET_NEXT_VIEW (table->view);
}
-/* Each DIE attribute has a field specifying the attribute kind,
- a link to the next attribute in the chain, and an attribute value.
- Attributes are typically linked below the DIE they modify. */
-
-typedef struct GTY(()) dw_attr_struct {
- enum dwarf_attribute dw_attr;
- dw_val_node dw_attr_val;
-}
-dw_attr_node;
-
-
/* The Debugging Information Entry (DIE) structure. DIEs form a tree.
The children of each node form a circular list linked by
die_sib. die_child points to the node *before* the "first" child node. */
@@ -3711,14 +3694,11 @@ static const char *dwarf_form_name (unsigned);
static tree decl_ultimate_origin (const_tree);
static tree decl_class_context (tree);
static void add_dwarf_attr (dw_die_ref, dw_attr_node *);
-static inline enum dw_val_class AT_class (dw_attr_node *);
static inline unsigned int AT_index (dw_attr_node *);
static void add_AT_flag (dw_die_ref, enum dwarf_attribute, unsigned);
static inline unsigned AT_flag (dw_attr_node *);
static void add_AT_int (dw_die_ref, enum dwarf_attribute, HOST_WIDE_INT);
-static inline HOST_WIDE_INT AT_int (dw_attr_node *);
static void add_AT_unsigned (dw_die_ref, enum dwarf_attribute, unsigned HOST_WIDE_INT);
-static inline unsigned HOST_WIDE_INT AT_unsigned (dw_attr_node *);
static void add_AT_double (dw_die_ref, enum dwarf_attribute,
HOST_WIDE_INT, unsigned HOST_WIDE_INT);
static inline void add_AT_vec (dw_die_ref, enum dwarf_attribute, unsigned int,
@@ -3733,7 +3713,6 @@ static inline dw_die_ref AT_ref (dw_attr_node *);
static inline int AT_ref_external (dw_attr_node *);
static inline void set_AT_ref_external (dw_attr_node *, int);
static void add_AT_loc (dw_die_ref, enum dwarf_attribute, dw_loc_descr_ref);
-static inline dw_loc_descr_ref AT_loc (dw_attr_node *);
static void add_AT_loc_list (dw_die_ref, enum dwarf_attribute,
dw_loc_list_ref);
static inline dw_loc_list_ref AT_loc_list (dw_attr_node *);
@@ -3750,12 +3729,7 @@ static void add_AT_macptr (dw_die_ref, enum dwarf_attribute, const char *);
static void add_AT_range_list (dw_die_ref, enum dwarf_attribute,
unsigned long, bool);
static inline const char *AT_lbl (dw_attr_node *);
-static dw_attr_node *get_AT (dw_die_ref, enum dwarf_attribute);
static const char *get_AT_low_pc (dw_die_ref);
-static const char *get_AT_string (dw_die_ref, enum dwarf_attribute);
-static int get_AT_flag (dw_die_ref, enum dwarf_attribute);
-static unsigned get_AT_unsigned (dw_die_ref, enum dwarf_attribute);
-static inline dw_die_ref get_AT_ref (dw_die_ref, enum dwarf_attribute);
static bool is_c (void);
static bool is_cxx (void);
static bool is_cxx (const_tree);
@@ -3769,7 +3743,6 @@ static dw_die_ref lookup_type_die (tree);
static dw_die_ref strip_naming_typedef (tree, dw_die_ref);
static dw_die_ref lookup_type_die_strip_naming_typedef (tree);
static void equate_type_number_to_die (tree, dw_die_ref);
-static dw_die_ref lookup_decl_die (tree);
static var_loc_list *lookup_decl_loc (const_tree);
static void equate_decl_number_to_die (tree, dw_die_ref);
static struct var_loc_node *add_var_loc_to_decl (tree, rtx, const char *, var_loc_view);
@@ -3842,7 +3815,6 @@ static void output_ranges (void);
static dw_line_info_table *new_line_info_table (void);
static void output_line_info (bool);
static void output_file_names (void);
-static dw_die_ref base_type_die (tree, bool);
static int is_base_type (tree);
static dw_die_ref subrange_type_die (tree, tree, tree, tree, dw_die_ref);
static int decl_quals (const_tree);
@@ -3890,7 +3862,6 @@ static rtx rtl_for_decl_location (tree);
static bool add_location_or_const_value_attribute (dw_die_ref, tree, bool);
static bool tree_add_const_value_attribute (dw_die_ref, tree);
static bool tree_add_const_value_attribute_for_decl (dw_die_ref, tree);
-static void add_name_attribute (dw_die_ref, const char *);
static void add_desc_attribute (dw_die_ref, tree);
static void add_gnat_descriptive_type_attribute (dw_die_ref, tree, dw_die_ref);
static void add_comp_dir_attribute (dw_die_ref);
@@ -4497,7 +4468,7 @@ add_dwarf_attr (dw_die_ref die, dw_attr_node *attr)
vec_safe_push (die->die_attr, *attr);
}
-static inline enum dw_val_class
+enum dw_val_class
AT_class (dw_attr_node *a)
{
return a->dw_attr_val.val_class;
@@ -4553,7 +4524,7 @@ add_AT_int (dw_die_ref die, enum dwarf_attribute attr_kind, HOST_WIDE_INT int_va
add_dwarf_attr (die, &attr);
}
-static inline HOST_WIDE_INT
+HOST_WIDE_INT
AT_int (dw_attr_node *a)
{
gcc_assert (a && (AT_class (a) == dw_val_class_const
@@ -4576,7 +4547,7 @@ add_AT_unsigned (dw_die_ref die, enum dwarf_attribute attr_kind,
add_dwarf_attr (die, &attr);
}
-static inline unsigned HOST_WIDE_INT
+unsigned HOST_WIDE_INT
AT_unsigned (dw_attr_node *a)
{
gcc_assert (a && (AT_class (a) == dw_val_class_unsigned_const
@@ -4960,7 +4931,7 @@ add_AT_loc (dw_die_ref die, enum dwarf_attribute attr_kind, dw_loc_descr_ref loc
add_dwarf_attr (die, &attr);
}
-static inline dw_loc_descr_ref
+dw_loc_descr_ref
AT_loc (dw_attr_node *a)
{
gcc_assert (a && AT_class (a) == dw_val_class_loc);
@@ -5201,6 +5172,30 @@ index_addr_table_entry (addr_table_entry **h, unsigned int *index)
return 1;
}
+/* Return the tag of a given DIE. */
+
+enum dwarf_tag
+dw_get_die_tag (dw_die_ref die)
+{
+ return die->die_tag;
+}
+
+/* Return a reference to the children list of a given DIE. */
+
+dw_die_ref
+dw_get_die_child (dw_die_ref die)
+{
+ return die->die_child;
+}
+
+/* Return a reference to the sibling of a given DIE. */
+
+dw_die_ref
+dw_get_die_sib (dw_die_ref die)
+{
+ return die->die_sib;
+}
+
/* Add an address constant attribute value to a DIE. When using
dwarf_split_debug_info, address attributes in dies destined for the
final executable should be direct references--setting the parameter
@@ -5398,7 +5393,7 @@ AT_lbl (dw_attr_node *a)
/* Get the attribute of type attr_kind. */
-static dw_attr_node *
+dw_attr_node *
get_AT (dw_die_ref die, enum dwarf_attribute attr_kind)
{
dw_attr_node *a;
@@ -5453,7 +5448,7 @@ get_AT_low_pc (dw_die_ref die)
/* Return the value of the string attribute designated by ATTR_KIND, or
NULL if it is not present. */
-static inline const char *
+const char *
get_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind)
{
dw_attr_node *a = get_AT (die, attr_kind);
@@ -5464,7 +5459,7 @@ get_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind)
/* Return the value of the flag attribute designated by ATTR_KIND, or -1
if it is not present. */
-static inline int
+int
get_AT_flag (dw_die_ref die, enum dwarf_attribute attr_kind)
{
dw_attr_node *a = get_AT (die, attr_kind);
@@ -5475,7 +5470,7 @@ get_AT_flag (dw_die_ref die, enum dwarf_attribute attr_kind)
/* Return the value of the unsigned attribute designated by ATTR_KIND, or 0
if it is not present. */
-static inline unsigned
+unsigned
get_AT_unsigned (dw_die_ref die, enum dwarf_attribute attr_kind)
{
dw_attr_node *a = get_AT (die, attr_kind);
@@ -5483,7 +5478,7 @@ get_AT_unsigned (dw_die_ref die, enum dwarf_attribute attr_kind)
return a ? AT_unsigned (a) : 0;
}
-static inline dw_die_ref
+dw_die_ref
get_AT_ref (dw_die_ref die, enum dwarf_attribute attr_kind)
{
dw_attr_node *a = get_AT (die, attr_kind);
@@ -5491,7 +5486,7 @@ get_AT_ref (dw_die_ref die, enum dwarf_attribute attr_kind)
return a ? AT_ref (a) : NULL;
}
-static inline struct dwarf_file_data *
+struct dwarf_file_data *
get_AT_file (dw_die_ref die, enum dwarf_attribute attr_kind)
{
dw_attr_node *a = get_AT (die, attr_kind);
@@ -5776,7 +5771,7 @@ splice_child_die (dw_die_ref parent, dw_die_ref child)
/* Create and return a new die with TAG_VALUE as tag. */
-static inline dw_die_ref
+dw_die_ref
new_die_raw (enum dwarf_tag tag_value)
{
dw_die_ref die = ggc_cleared_alloc<die_node> ();
@@ -5921,7 +5916,7 @@ decl_die_hasher::equal (die_node *x, tree y)
/* Return the DIE associated with a given declaration. */
-static inline dw_die_ref
+dw_die_ref
lookup_decl_die (tree decl)
{
dw_die_ref *die = decl_die_table->find_slot_with_hash (decl, DECL_UID (decl),
@@ -13150,7 +13145,7 @@ need_endianity_attribute_p (bool reverse)
This routine must only be called for GCC type nodes that correspond to
Dwarf base (fundamental) types. */
-static dw_die_ref
+dw_die_ref
base_type_die (tree type, bool reverse)
{
dw_die_ref base_type_result;
@@ -20994,7 +20989,7 @@ compute_frame_pointer_to_fb_displacement (poly_int64 offset)
/* Generate a DW_AT_name attribute given some string value to be included as
the value of the attribute. */
-static void
+void
add_name_attribute (dw_die_ref die, const char *name_string)
{
if (name_string != NULL && *name_string != 0)
diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h
index 54b6343..057afdb 100644
--- a/gcc/dwarf2out.h
+++ b/gcc/dwarf2out.h
@@ -387,4 +387,48 @@ struct fixed_point_type_info
void dwarf2out_c_finalize (void);
+/* Some DWARF internals are exposed for the needs of DWARF-based debug
+ formats. */
+
+/* Each DIE attribute has a field specifying the attribute kind,
+ a link to the next attribute in the chain, and an attribute value.
+ Attributes are typically linked below the DIE they modify. */
+
+typedef struct GTY(()) dw_attr_struct {
+ enum dwarf_attribute dw_attr;
+ dw_val_node dw_attr_val;
+}
+dw_attr_node;
+
+extern dw_attr_node *get_AT (dw_die_ref, enum dwarf_attribute);
+extern HOST_WIDE_INT AT_int (dw_attr_node *);
+extern unsigned HOST_WIDE_INT AT_unsigned (dw_attr_node *a);
+extern dw_loc_descr_ref AT_loc (dw_attr_node *);
+extern dw_die_ref get_AT_ref (dw_die_ref, enum dwarf_attribute);
+extern const char *get_AT_string (dw_die_ref, enum dwarf_attribute);
+extern enum dw_val_class AT_class (dw_attr_node *);
+extern unsigned HOST_WIDE_INT AT_unsigned (dw_attr_node *);
+extern unsigned get_AT_unsigned (dw_die_ref, enum dwarf_attribute);
+extern int get_AT_flag (dw_die_ref, enum dwarf_attribute);
+
+extern void add_name_attribute (dw_die_ref, const char *);
+
+extern dw_die_ref new_die_raw (enum dwarf_tag);
+extern dw_die_ref base_type_die (tree, bool);
+
+extern dw_die_ref lookup_decl_die (tree);
+
+extern dw_die_ref dw_get_die_child (dw_die_ref);
+extern dw_die_ref dw_get_die_sib (dw_die_ref);
+extern enum dwarf_tag dw_get_die_tag (dw_die_ref);
+
+/* Data about a single source file. */
+struct GTY((for_user)) dwarf_file_data {
+ const char * filename;
+ int emitted_number;
+};
+
+extern struct dwarf_file_data *get_AT_file (dw_die_ref,
+ enum dwarf_attribute);
+
#endif /* GCC_DWARF2OUT_H */