From 7853d9342541e5d4e125304b6bcc595e55698811 Mon Sep 17 00:00:00 2001 From: Javier Miranda Date: Wed, 6 Jun 2007 12:26:28 +0200 Subject: [PATCH] exp_dbug.adb (Get_Encoded_Name): Modified to continue providing its functionality when... 2007-04-20 Javier Miranda Nicolas Setton * exp_dbug.adb (Get_Encoded_Name): Modified to continue providing its functionality when the backend is generating code. Otherwise any serious error reported by the backend calling the frontend routine Error_Msg changes the Compilation_Mode to Check_Semantics, disables the functionality of this routine and causes the generation of spureous additional errors. * exp_dbug.ads (Pointers to Unconstrained Arrays): Document the debugging information now generated by the compiler for fat-pointer types. Document the contents of DW_AT_producer in the GNAT Vendor extensions to DWARF2/3. Document GNAT Vendor extensions to DWARF 2/3 and the "-gdwarf+" switch. From-SVN: r125402 --- gcc/ada/exp_dbug.adb | 23 ++++++++++----- gcc/ada/exp_dbug.ads | 67 +++++++++++++++++++++++++++++++++++++------- 2 files changed, 73 insertions(+), 17 deletions(-) diff --git a/gcc/ada/exp_dbug.adb b/gcc/ada/exp_dbug.adb index babdef20daf..367ed2d6775 100644 --- a/gcc/ada/exp_dbug.adb +++ b/gcc/ada/exp_dbug.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2007, 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- -- @@ -28,7 +28,6 @@ with Alloc; use Alloc; with Atree; use Atree; with Debug; use Debug; with Einfo; use Einfo; -with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; @@ -492,12 +491,22 @@ package body Exp_Dbug is Has_Suffix : Boolean; begin - -- If not generating code, there is no need to create encoded - -- names, and problems when the back-end is called to annotate - -- types without full code generation. See comments at beginning - -- of Get_External_Name_With_Suffix for additional details. + -- If not generating code, there is no need to create encoded names, and + -- problems when the back-end is called to annotate types without full + -- code generation. See comments in Get_External_Name_With_Suffix for + -- additional details. - if Operating_Mode /= Generate_Code then + -- However we do create encoded names if the back end is active, even + -- if Operating_Mode got reset. Otherwise any serious error reported + -- by the backend calling Error_Msg changes the Compilation_Mode to + -- Check_Semantics, which disables the functionality of this routine, + -- causing the generation of spurious additional errors. + + -- Couldn't we just test Original_Operating_Mode here? ??? + + if Operating_Mode /= Generate_Code + and then not Generating_Code + then return; end if; diff --git a/gcc/ada/exp_dbug.ads b/gcc/ada/exp_dbug.ads index 49979e30b8d..3e3e992707a 100644 --- a/gcc/ada/exp_dbug.ads +++ b/gcc/ada/exp_dbug.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1996-2006, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2007, 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- -- @@ -28,6 +28,7 @@ -- debugger. In accordance with the Dwarf 2.2 specification, certain -- type names are encoded to provide information to the debugger. +with Namet; use Namet; with Types; use Types; with Uintp; use Uintp; @@ -44,11 +45,11 @@ package Exp_Dbug is -- are the enclosing scopes (not including Standard at the start). -- The encoding of the name follows this basic qualified naming scheme, - -- where the encoding of individual entity names is as described in - -- Namet (i.e. in particular names present in the original source are - -- folded to all lower case, with upper half and wide characters encoded - -- as described in Namet). Upper case letters are used only for entities - -- generated by the compiler. + -- where the encoding of individual entity names is as described in Namet + -- (i.e. in particular names present in the original source are folded to + -- all lower case, with upper half and wide characters encoded as described + -- in Namet). Upper case letters are used only for entities generated by + -- the compiler. -- There are two cases, global entities, and local entities. In more formal -- terms, local entities are those which have a dynamic enclosing scope, @@ -1247,10 +1248,19 @@ package Exp_Dbug is -- The bounds may be any integral type. In the case of an enumeration -- type, Enum_Rep values are used. - -- The debugging information will sometimes reference an anonymous fat - -- pointer type. Such types are given the name xxx___XUP, where xxx is - -- the name of the designated type. If the debugger is asked to output - -- such a type name, the appropriate form is "access xxx". + -- For a given unconstrained array type, the compiler will generate one + -- fat-pointer type whose name is "arr___XUP", where "arr" is the name + -- of the array type, and use it to represent the array type itself in + -- the debugging information. + -- For each pointer to this unconstrained array type, the compiler will + -- generate a typedef that points to the above "arr___XUP" fat-pointer + -- type. As a consequence, when it comes to fat-pointer types: + + -- 1. The type name is given by the typedef + + -- 2. If the debugger is asked to output the type, the appropriate + -- form is "access arr", except if the type name is "arr___XUP" + -- for which it is the array definition. -- Thin Pointers @@ -1501,4 +1511,41 @@ package Exp_Dbug is -- are missing and deal as best as it can with the limited information -- available. + --------------------------------- + -- GNAT Extensions to DWARF2/3 -- + --------------------------------- + + -- If the compiler switch "-gdwarf+" is specified, GNAT Vendor extensions + -- to DWARF2/3 are generated, with the following variations from the above + -- specification. + + -- Change in the contents of the DW_AT_name attribute. + -- The operators are represented in their natural form. (Ie, the addition + -- operator is written as "+" instead of "Oadd"). + -- The component separation string is "." instead of "__" + + -- Introduction of DW_AT_GNAT_encoding, encoded with value 0x2301. + -- Any debugging information entry representing a program entity, named + -- or implicit, may have a DW_AT_GNAT_encoding attribute. The value of + -- this attribute is a string representing the suffix internally added + -- by GNAT for various purposes, mainly for representing debug + -- information compatible with other formats. + + -- If a debugging information entry has multiple encodings, all of them + -- will be listed in DW_AT_GNAT_encoding. The separator for this list + -- is ':'. + + -- Introduction of DW_AT_GNAT_descriptive_type, encoded with value 0x2302 + -- Any debugging information entry representing a type may have a + -- DW_AT_GNAT_descriptive_type attribute whose value is a reference, + -- pointing to a debugging information entry representing another type + -- associated to the type. + + -- Modification of the contents of the DW_AT_producer string. + -- When emitting full GNAT Vendor extensions to DWARF2/3, "-gdwarf+" + -- is appended to the DW_AT_producer string. + -- + -- When emitting only DW_AT_GNAT_descriptive_type, "-gdwarf+-" is + -- appended to the DW_AT_producer string. + end Exp_Dbug; -- 2.30.2