diff options
author | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2020-06-23 17:37:17 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2020-06-23 18:35:45 +0200 |
commit | fa0588dbec38b46d88f46229e2f2b94d16ab09ba (patch) | |
tree | 1a6c6fc071031bee1db527e6c2ba6a764fe9fafe /gcc/ada/gcc-interface | |
parent | d94d571bf0d42beb90bb36d311b7a4c075c81b94 (diff) | |
download | gcc-fa0588dbec38b46d88f46229e2f2b94d16ab09ba.zip gcc-fa0588dbec38b46d88f46229e2f2b94d16ab09ba.tar.gz gcc-fa0588dbec38b46d88f46229e2f2b94d16ab09ba.tar.bz2 |
Emit user subtypes with -fgnat-encodings=minimal
This changes the compiler to emit debug info for user-defined subtypes
with -fgnat-encodings=minimal, as they might be needed by the debugger.
gcc/ada/ChangeLog:
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Subtype>: Set
debug type to the base type and only if the subtype is artificial.
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 33d59d5..589154b 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -3507,18 +3507,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) gnu_type = make_node (RECORD_TYPE); TYPE_NAME (gnu_type) = gnu_entity_name; - if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL) - { - /* Use the ultimate base record type as the debug type. - Subtypes and derived types bring no useful - information. */ - Entity_Id gnat_debug_type = gnat_entity; - while (Etype (gnat_debug_type) != gnat_debug_type) - gnat_debug_type = Etype (gnat_debug_type); - tree gnu_debug_type - = TYPE_MAIN_VARIANT (gnat_to_gnu_type (gnat_debug_type)); - SET_TYPE_DEBUG_TYPE (gnu_type, gnu_debug_type); - } TYPE_PACKED (gnu_type) = TYPE_PACKED (gnu_base_type); TYPE_REVERSE_STORAGE_ORDER (gnu_type) = Reverse_Storage_Order (gnat_entity); @@ -3580,6 +3568,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) true, debug_info_p, NULL, gnat_entity); } + + /* Or else, if the subtype is artificial and encodings are not + used, use the base record type as the debug type. */ + else if (debug_info_p + && artificial_p + && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL) + SET_TYPE_DEBUG_TYPE (gnu_type, gnu_unpad_base_type); } /* Otherwise, go down all the components in the new type and make |