* dwarf2out.c (dwarf_attr_name): Map DW_AT_GNAT_descriptive_type.
(add_gnat_descriptive_type_attribute): New function.
(gen_array_type_die): Call it.
(gen_enumeration_type_die): Likewise.
(gen_struct_or_union_type_die): Likewise.
(modified_type_die): Likewise.
* langhooks.h (lang_hooks_for_types): New descriptive_type hook.
* langhooks-def.h (LANG_HOOKS_DESCRIPTIVE_TYPE): Default to NULL.
(LANG_HOOKS_FOR_TYPES_INITIALIZER): Add LANG_HOOKS_DESCRIPTIVE_TYPE.
ada/
* gcc-interface/misc.c (gnat_descriptive_type): New function.
(LANG_HOOKS_DESCRIPTIVE_TYPE): Redefine to gnat_descriptive_type.
Co-Authored-By: Eric Botcazou <ebotcazou@adacore.com>
Co-Authored-By: Nicolas Setton <setton@adacore.com>
From-SVN: r171862
+2011-04-01 Olivier Hainque <hainque@adacore.com>
+ Nicolas Setton <setton@adacore.com>
+ Eric Botcazou <ebotcazou@adacore.com>
+
+ * dwarf2out.c (dwarf_attr_name): Map DW_AT_GNAT_descriptive_type.
+ (add_gnat_descriptive_type_attribute): New function.
+ (gen_array_type_die): Call it.
+ (gen_enumeration_type_die): Likewise.
+ (gen_struct_or_union_type_die): Likewise.
+ (modified_type_die): Likewise.
+ * langhooks.h (lang_hooks_for_types): New descriptive_type hook.
+ * langhooks-def.h (LANG_HOOKS_DESCRIPTIVE_TYPE): Default to NULL.
+ (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add LANG_HOOKS_DESCRIPTIVE_TYPE.
+
2011-04-01 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/48148
+2011-04-01 Olivier Hainque <hainque@adacore.com>
+ Nicolas Setton <setton@adacore.com>
+ Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/misc.c (gnat_descriptive_type): New function.
+ (LANG_HOOKS_DESCRIPTIVE_TYPE): Redefine to gnat_descriptive_type.
+
2011-03-28 Kai Tietz <ktietz@redhat.com>
* gcc-interface/Makefile.in (SO_LIB): Handle multilib build for native
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2010, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2011, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
return (const char *) IDENTIFIER_POINTER (DECL_NAME (decl));
}
+/* Return the descriptive type associated with TYPE, if any. */
+
+static tree
+gnat_descriptive_type (const_tree type)
+{
+ if (TYPE_STUB_DECL (type))
+ return DECL_PARALLEL_TYPE (TYPE_STUB_DECL (type));
+ else
+ return NULL_TREE;
+}
+
/* Return true if types T1 and T2 are identical for type hashing purposes.
Called only after doing all language independent checks. At present,
this function is only called when both types are FUNCTION_TYPE. */
#define LANG_HOOKS_TYPES_COMPATIBLE_P gnat_types_compatible_p
#undef LANG_HOOKS_GET_SUBRANGE_BOUNDS
#define LANG_HOOKS_GET_SUBRANGE_BOUNDS gnat_get_subrange_bounds
+#undef LANG_HOOKS_DESCRIPTIVE_TYPE
+#define LANG_HOOKS_DESCRIPTIVE_TYPE gnat_descriptive_type
#undef LANG_HOOKS_ATTRIBUTE_TABLE
#define LANG_HOOKS_ATTRIBUTE_TABLE gnat_internal_attribute_table
#undef LANG_HOOKS_BUILTIN_FUNCTION
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_gnat_descriptive_type_attribute (dw_die_ref, tree, dw_die_ref);
static void add_comp_dir_attribute (dw_die_ref);
static void add_bound_info (dw_die_ref, enum dwarf_attribute, tree);
static void add_subscript_info (dw_die_ref, tree, bool);
return "DW_AT_body_begin";
case DW_AT_body_end:
return "DW_AT_body_end";
+
case DW_AT_GNU_vector:
return "DW_AT_GNU_vector";
case DW_AT_GNU_guarded_by:
case DW_AT_GNU_all_source_call_sites:
return "DW_AT_GNU_all_source_call_sites";
+ case DW_AT_GNAT_descriptive_type:
+ return "DW_AT_GNAT_descriptive_type";
+
case DW_AT_VMS_rtnbeg_pd_address:
return "DW_AT_VMS_rtnbeg_pd_address";
useful source coordinates anyway. */
name = DECL_NAME (name);
add_name_attribute (mod_type_die, IDENTIFIER_POINTER (name));
+ add_gnat_descriptive_type_attribute (mod_type_die, type, context_die);
}
/* This probably indicates a bug. */
else if (mod_type_die && mod_type_die->die_tag == DW_TAG_base_type)
}
}
+/* Retrieve the descriptive type of TYPE, if any, make sure it has a
+ DIE and attach a DW_AT_GNAT_descriptive_type attribute to the DIE
+ of TYPE accordingly.
+
+ ??? This is a temporary measure until after we're able to generate
+ regular DWARF for the complex Ada type system. */
+
+static void
+add_gnat_descriptive_type_attribute (dw_die_ref die, tree type,
+ dw_die_ref context_die)
+{
+ tree dtype;
+ dw_die_ref dtype_die;
+
+ if (!lang_hooks.types.descriptive_type)
+ return;
+
+ dtype = lang_hooks.types.descriptive_type (type);
+ if (!dtype)
+ return;
+
+ dtype_die = lookup_type_die (dtype);
+ if (!dtype_die)
+ {
+ gen_type_die (dtype, context_die);
+ dtype_die = lookup_type_die (dtype);
+ gcc_assert (dtype_die);
+ }
+
+ add_AT_die_ref (die, DW_AT_GNAT_descriptive_type, dtype_die);
+}
+
/* Generate a DW_AT_comp_dir attribute for DIE. */
static void
array_die = new_die (DW_TAG_array_type, scope_die, type);
add_name_attribute (array_die, type_tag (type));
+ add_gnat_descriptive_type_attribute (array_die, type, context_die);
equate_type_number_to_die (type, array_die);
if (TREE_CODE (type) == VECTOR_TYPE)
scope_die_for (type, context_die), type);
equate_type_number_to_die (type, type_die);
add_name_attribute (type_die, type_tag (type));
+ add_gnat_descriptive_type_attribute (type_die, type, context_die);
if (dwarf_version >= 4 || !dwarf_strict)
{
if (ENUM_IS_SCOPED (type))
if (old_die)
add_AT_specification (type_die, old_die);
else
- add_name_attribute (type_die, type_tag (type));
+ {
+ add_name_attribute (type_die, type_tag (type));
+ add_gnat_descriptive_type_attribute (type_die, type, context_die);
+ }
}
else
remove_AT (type_die, DW_AT_declaration);
/* Default macros to initialize the lang_hooks data structure.
- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
- Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+ 2011 Free Software Foundation, Inc.
Contributed by Alexandre Oliva <aoliva@redhat.com>
This file is part of GCC.
#define LANG_HOOKS_TYPE_HASH_EQ NULL
#define LANG_HOOKS_GET_ARRAY_DESCR_INFO NULL
#define LANG_HOOKS_GET_SUBRANGE_BOUNDS NULL
+#define LANG_HOOKS_DESCRIPTIVE_TYPE NULL
#define LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE reconstruct_complex_type
#define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
LANG_HOOKS_TYPE_HASH_EQ, \
LANG_HOOKS_GET_ARRAY_DESCR_INFO, \
LANG_HOOKS_GET_SUBRANGE_BOUNDS, \
+ LANG_HOOKS_DESCRIPTIVE_TYPE, \
LANG_HOOKS_RECONSTRUCT_COMPLEX_TYPE \
}
/* The lang_hooks data structure.
- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
- Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+ 2011 Free Software Foundation, Inc.
This file is part of GCC.
/* Fill in information for the debugger about the bounds of TYPE. */
void (*get_subrange_bounds) (const_tree, tree *, tree *);
+ /* A type descriptive of TYPE's complex layout generated to help the
+ debugger to decode variable-length or self-referential constructs.
+ This is only used for the AT_GNAT_descriptive_type DWARF attribute. */
+ tree (*descriptive_type) (const_tree);
+
/* If we requested a pointer to a vector, build up the pointers that
we stripped off while looking for the inner type. Similarly for
return values from functions. The argument TYPE is the top of the