diff options
author | Tom Tromey <tromey@adacore.com> | 2024-09-06 12:24:41 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2025-03-06 14:17:18 -0700 |
commit | 8cf79a06467464fe7df292555dd0ce9e839db832 (patch) | |
tree | ae267254be6f65d9e62612cc24b64d35e85075a0 /gdb | |
parent | 4a4a50517b6cb12918beff56b288d6412bca0d0d (diff) | |
download | binutils-8cf79a06467464fe7df292555dd0ce9e839db832.zip binutils-8cf79a06467464fe7df292555dd0ce9e839db832.tar.gz binutils-8cf79a06467464fe7df292555dd0ce9e839db832.tar.bz2 |
Handle DW_TAG_module for Ada
This updates read_module_type to turn DW_TAG_module into a
TYPE_CODE_NAMESPACE when the CU represents Ada code.
Note that the GNAT that generates this isn't generally available yet
and so this shouldn't have an impact on current code.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/dwarf2/read.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 0859262..962d51e 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -13123,25 +13123,36 @@ read_namespace (struct die_info *die, struct dwarf2_cu *cu) } } -/* Read a Fortran module as type. This DIE can be only a declaration used for - imported module. Still we need that type as local Fortran "use ... only" - declaration imports depend on the created type in determine_prefix. */ +/* Read a Fortran module or Ada package as type. For Fortran, This + DIE can be only a declaration used for imported module. Still we + need that type as local Fortran "use ... only" declaration imports + depend on the created type in determine_prefix. */ static struct type * read_module_type (struct die_info *die, struct dwarf2_cu *cu) { + enum language lang = cu->lang (); struct objfile *objfile = cu->per_objfile->objfile; - const char *module_name; struct type *type; - module_name = dwarf2_name (die, cu); - type = type_allocator (objfile, cu->lang ()).new_type (TYPE_CODE_MODULE, - 0, module_name); + if (lang == language_ada) + { + const char *pkg_name = dwarf2_full_name (nullptr, die, cu); + type = type_allocator (objfile, lang).new_type (TYPE_CODE_NAMESPACE, + 0, pkg_name); + } + else + { + const char *module_name = dwarf2_name (die, cu); + type = type_allocator (objfile, lang).new_type (TYPE_CODE_MODULE, + 0, module_name); + } return set_die_type (die, type, cu); } -/* Read a Fortran module. */ +/* Read a module. This tag is used by Fortran (for modules), but also + by Ada (for packages). */ static void read_module (struct die_info *die, struct dwarf2_cu *cu) |