diff options
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/exp_ch8.adb | 8 | ||||
-rw-r--r-- | gcc/ada/exp_dbug.adb | 30 | ||||
-rw-r--r-- | gcc/ada/exp_dbug.ads | 84 |
3 files changed, 71 insertions, 51 deletions
diff --git a/gcc/ada/exp_ch8.adb b/gcc/ada/exp_ch8.adb index 6a00a3b..3185f7d 100644 --- a/gcc/ada/exp_ch8.adb +++ b/gcc/ada/exp_ch8.adb @@ -319,6 +319,14 @@ package body Exp_Ch8 is end if; Analyze (Decl); + + -- Enter the debug variable in the qualification list, which + -- must be done at this point because auxiliary declarations + -- occur at the library level and aren't associated with a + -- normal scope. + + Qualify_Entity_Names (Decl); + Pop_Scope; end; diff --git a/gcc/ada/exp_dbug.adb b/gcc/ada/exp_dbug.adb index 76ae0ca..ac86891 100644 --- a/gcc/ada/exp_dbug.adb +++ b/gcc/ada/exp_dbug.adb @@ -1011,17 +1011,25 @@ package body Exp_Dbug is E := Defining_Entity (Name_Qualify_Units.Table (J)); Qualify_Entity_Name (E); - Ent := First_Entity (E); - while Present (Ent) loop - Qualify_Entity_Name (Ent); - Next_Entity (Ent); - - -- There are odd cases where Last_Entity (E) = E. This happens - -- in the case of renaming of packages. This test avoids getting - -- stuck in such cases. - - exit when Ent = E; - end loop; + -- Normally entities in the qualification list are scopes, but in the + -- case of a library-level package renaming there is an associated + -- variable that encodes the debugger name and that variable is + -- entered in the list since it occurs in the Aux_Decls list of the + -- compilation and doesn't have a normal scope. + + if Ekind (E) /= E_Variable then + Ent := First_Entity (E); + while Present (Ent) loop + Qualify_Entity_Name (Ent); + Next_Entity (Ent); + + -- There are odd cases where Last_Entity (E) = E. This happens + -- in the case of renaming of packages. This test avoids + -- getting stuck in such cases. + + exit when Ent = E; + end loop; + end if; end loop; end Qualify_All_Entity_Names; diff --git a/gcc/ada/exp_dbug.ads b/gcc/ada/exp_dbug.ads index 3e3e992..c4eb15f 100644 --- a/gcc/ada/exp_dbug.ads +++ b/gcc/ada/exp_dbug.ads @@ -603,8 +603,7 @@ package Exp_Dbug is -- for most debugging formats. However, we do not ever need XD -- encoding for enumeration base types, since here it is always -- clear what the bounds are from the total number of enumeration - -- literals, and of course we do not need to encode the dummy XR - -- types generated for renamings. + -- literals. -- typ___XD -- typ___XDL_lowerbound @@ -969,20 +968,23 @@ package Exp_Dbug is -- Consider a renaming declaration of the form - -- x typ renames y; + -- x : typ renames y; -- There is one case in which no special debugging information is required, - -- namely the case of an object renaming where the backend allocates a + -- namely the case of an object renaming where the back end allocates a -- reference for the renamed variable, and the entity x is this reference. -- The debugger can handle this case without any special processing or -- encoding (it won't know it was a renaming, but that does not matter). - -- All other cases of renaming generate a dummy type definition for - -- an entity whose name is: + -- All other cases of renaming generate a dummy variable for an entity + -- whose name is of the form: - -- x___XR for an object renaming - -- x___XRE for an exception renaming - -- x___XRP for a package renaming + -- x___XR_... for an object renaming + -- x___XRE_... for an exception renaming + -- x___XRP_... for a package renaming + + -- and where the "..." represents a suffix that describes the structure of + -- the object name given in the renaming (see details below). -- The name is fully qualified in the usual manner, i.e. qualified in the -- same manner as the entity x would be. In the case of a package renaming @@ -992,24 +994,24 @@ package Exp_Dbug is -- Note: subprogram renamings are not encoded at the present time - -- The type is an enumeration type with a single enumeration literal - -- that is an identifier which describes the renamed variable. + -- The suffix of the variable name describing the renamed object is + -- defined to use the following encoding: - -- For the simple entity case, where y is an entity name, - -- the enumeration is of the form: + -- For the simple entity case, where y is just an entity name, the suffix + -- is of the form: - -- (y___XE) + -- y___XE - -- i.e. the enumeration type has a single field, whose name matches - -- the name y, with the XE suffix. The entity for this enumeration - -- literal is fully qualified in the usual manner. All subprogram, - -- exception, and package renamings fall into this category, as - -- well as simple object renamings. + -- i.e. the suffix has a single field, the first part matching the + -- name y, followed by a "___" separator, ending with sequence XE. + -- The entity name portion is fully qualified in the usual manner. + -- This same naming scheme is followed for all forms of encoded + -- renamings that rename a simple entity. -- For the object renaming case where y is a selected component or an - -- indexed component, the literal name is suffixed by additional fields + -- indexed component, the variable name is suffixed by additional fields -- that give details of the components. The name starts as above with a - -- y___XE entity indicating the outer level variable. Then a series of + -- y___XE name indicating the outer level object entity. Then a series of -- selections and indexing operations can be specified as follows: -- Indexed component @@ -1020,20 +1022,19 @@ package Exp_Dbug is -- XSnnn - -- Here nnn is a constant value, encoded as a decimal - -- integer (pos value for enumeration type case). Negative - -- values have a trailing 'm' as usual. + -- Here nnn is a constant value, encoded as a decimal integer + -- (pos value for enumeration type case). Negative values have + -- a trailing 'm' as usual. -- XSe - -- Here e is the (unqualified) name of a constant entity in - -- the same scope as the renaming which contains the subscript - -- value. + -- Here e is the (unqualified) name of a constant entity in the + -- same scope as the renaming which contains the subscript value. -- Slice -- For the slice case, we have two entries. The first is for the - -- lower bound of the slice, and has the form + -- lower bound of the slice, and has the form: -- XLnnn -- XLe @@ -1069,21 +1070,24 @@ package Exp_Dbug is -- z : string renames g (1,5).m(2 ..3) -- end p; - -- The generated type definition would appear as + -- The generated variable entity would appear as + + -- p__z___XR_p__g___XEXS1XS5XRmXL2XS3 : _renaming_type; + -- p__g___XE--------------------outer entity is g + -- XS1-----------------first subscript for g + -- XS5--------------second subscript for g + -- XRm-----------select field m + -- XL2--------lower bound of slice + -- XS3-----upper bound of slice - -- type p__z___XR is - -- (p__g___XEXS1XS5XRmXL2XS3); - -- p__g___XE--------------------outer entity is g - -- XS1-----------------first subscript for g - -- XS5--------------second subscript for g - -- XRm-----------select field m - -- XL2--------lower bound of slice - -- XS3-----upper bound of slice + -- Note that the type of the variable is a special internal type named + -- _renaming_type. This type is an arbitrary type of zero size created + -- in package Standard (see cstand.adb) and is ignored by the debugger. function Debug_Renaming_Declaration (N : Node_Id) return Node_Id; - -- The argument N is a renaming declaration. The result is a type - -- declaration as described in the above paragraphs. If not special - -- debug declaration, than Empty is returned. + -- The argument N is a renaming declaration. The result is a variable + -- declaration as described in the above paragraphs. If N is not a special + -- debug declaration, then Empty is returned. --------------------------- -- Packed Array Encoding -- |