From 081a52ed5221b9fe0280f80b3646c6118eb3ed1c Mon Sep 17 00:00:00 2001 From: Nicolas Setton Date: Fri, 6 Jun 2008 21:36:28 +0000 Subject: ada-tree.h (DECL_PARALLEL_TYPE): New language specific attribute... 2008-06-06 Nicolas Setton Olivier Hainque * ada-tree.h (DECL_PARALLEL_TYPE): New language specific attribute, parallel descriptive type attached to another type for debug info generation purposes. * utils.c (add_parallel_type): New function, register parallel type to be attached to a type. (get_parallel_type): New function, fetch a registered parallel type, if any. (rest_of_record_type_compilation): Register the parallel type we make for variable size records. * gigi.h (add_parallel_type, get_parallel_type): Declare. * decl.c (gnat_to_gnu_entity, maybe_pad_type): Register the parallel debug types we make. * trans.c (extract_encoding, decode_name): New functions. (gigi): If the DWARF attribute extensions are available, setup to use them. * lang.opt: Register language specific processing request for -gdwarf+. * misc.c (gnat_dwarf_extensions): New global variable. How much do we want of our DWARF extensions. 0 by default. (gnat_handle_option) : Increment gnat_dwarf_extensions. (gnat_post_options): Map gnat_dwarf_extensions to the common use_gnu_debug_info_extensions for later processing. Co-Authored-By: Olivier Hainque From-SVN: r136506 --- gcc/ada/trans.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'gcc/ada/trans.c') diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index dda85c5..fd69b3e 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -56,6 +56,10 @@ #include "einfo.h" #include "ada-tree.h" #include "gigi.h" +#include "adadecode.h" + +#include "dwarf2.h" +#include "dwarf2out.h" /* We should avoid allocating more than ALLOCA_THRESHOLD bytes via alloca, for fear of running out of stack space. If we need more, we use xmalloc @@ -211,6 +215,11 @@ static tree gnat_stabilize_reference (tree, bool); static tree gnat_stabilize_reference_1 (tree, bool); static void set_expr_location_from_node (tree, Node_Id); static int lvalue_required_p (Node_Id, tree, int); + +/* Hooks for debug info back-ends, only supported and used in a restricted set + of configurations. */ +static const char *extract_encoding (const char *) ATTRIBUTE_UNUSED; +static const char *decode_name (const char *) ATTRIBUTE_UNUSED; /* This is the main program of the back-end. It sets up all the table structures and then generates code. */ @@ -282,6 +291,18 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name, TYPE_SIZE_UNIT (void_type_node) = size_zero_node; } + /* If the GNU type extensions to DWARF are available, setup the hooks. */ +#if defined (DWARF2_DEBUGGING_INFO) && defined (DWARF2_GNU_TYPE_EXTENSIONS) + /* We condition the name demangling and the generation of type encoding + strings on -gdwarf+ and always set descriptive types on. */ + if (use_gnu_debug_info_extensions) + { + dwarf2out_set_type_encoding_func (extract_encoding); + dwarf2out_set_demangle_name_func (decode_name); + } + dwarf2out_set_descriptive_type_func (get_parallel_type); +#endif + /* Enable GNAT stack checking method if needed */ if (!Stack_Check_Probes_On_Target) set_stack_check_libfunc (gen_rtx_SYMBOL_REF (Pmode, "_gnat_stack_check")); @@ -6895,6 +6916,31 @@ set_expr_location_from_node (tree node, Node_Id gnat_node) set_expr_location (node, locus); } +/* Return a colon-separated list of encodings contained in encoded Ada + name. */ + +static const char * +extract_encoding (const char *name) +{ + char *encoding = ggc_alloc (strlen (name)); + + get_encoding (name, encoding); + + return encoding; +} + +/* Extract the Ada name from an encoded name. */ + +static const char * +decode_name (const char *name) +{ + char *decoded = ggc_alloc (strlen (name) * 2 + 60); + + __gnat_decode (name, decoded, 0); + + return decoded; +} + /* Post an error message. MSG is the error message, properly annotated. NODE is the node at which to post the error and the node to use for the "&" substitution. */ -- cgit v1.1