diff options
author | Keven Boell <keven.boell@intel.com> | 2013-11-15 11:32:01 +0100 |
---|---|---|
committer | Keven Boell <keven.boell@intel.com> | 2013-12-19 13:18:21 +0100 |
commit | 530e8392d7d5d4a831c5ce0e4cd410e1c4bd166a (patch) | |
tree | 42608c61640ecfb4d7d3800e2f27868d355a63f5 /gdb/dwarf2read.c | |
parent | 7f9b20bb352768e14cfa7361a82373b8539bebed (diff) | |
download | gdb-530e8392d7d5d4a831c5ce0e4cd410e1c4bd166a.zip gdb-530e8392d7d5d4a831c5ce0e4cd410e1c4bd166a.tar.gz gdb-530e8392d7d5d4a831c5ce0e4cd410e1c4bd166a.tar.bz2 |
fortran: enable ptype/whatis for modules.
Added new domain MODULE_DOMAIN for fortran modules to avoid
issues with sharing namespaces (e.g. when a variable currently
in scope has the same name as a module).
(gdb) ptype modname
old> No symbol "modname" in current context.
new> type = module modname
This fixes PR 15209 and also addresses the issue
with sharing namespaces:
https://sourceware.org/ml/gdb-patches/2013-02/msg00643.html
2013-11-19 Keven Boell <keven.boell@intel.com>
Sanimir Agovic <sanimir.agovic@intel.com>
* cp-namespace.c (cp_lookup_nested_symbol): Enable
nested lookups for fortran modules.
* dwarf2read.c (read_module): Add fortran module to
the symbol table.
(add_partial_symbol, add_partial_module): Add fortran
module to the partial symbol table.
(new_symbol_full): Create full symbol for fortran module.
* f-exp.y (yylex): Add new module domain to be parsed.
* symtab.h: New domain for fortran modules.
testsuite/
* gdb.fortran/module.exp: Completion matches fortran module
names as well. ptype/whatis on modules return a proper type.
Add new check for having the correct scope.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index f057afa..1a99450 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -6801,6 +6801,13 @@ add_partial_symbol (struct partial_die_info *pdi, struct dwarf2_cu *cu) &objfile->global_psymbols, 0, (CORE_ADDR) 0, cu->language, objfile); break; + case DW_TAG_module: + add_psymbol_to_list (actual_name, strlen (actual_name), + built_actual_name != NULL, + MODULE_DOMAIN, LOC_TYPEDEF, + &objfile->global_psymbols, + 0, (CORE_ADDR) 0, cu->language, objfile); + break; case DW_TAG_class_type: case DW_TAG_interface_type: case DW_TAG_structure_type: @@ -6871,6 +6878,10 @@ static void add_partial_module (struct partial_die_info *pdi, CORE_ADDR *lowpc, CORE_ADDR *highpc, int need_pc, struct dwarf2_cu *cu) { + /* Add a symbol for the namespace. */ + + add_partial_symbol (pdi, cu); + /* Now scan partial symbols in that module. */ if (pdi->has_children) @@ -13674,6 +13685,10 @@ static void read_module (struct die_info *die, struct dwarf2_cu *cu) { struct die_info *child_die = die->child; + struct type *type; + + type = read_type_die (die, cu); + new_symbol (die, type, cu); while (child_die && child_die->tag) { @@ -17704,6 +17719,11 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; list_to_add = &global_symbols; break; + case DW_TAG_module: + SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF; + SYMBOL_DOMAIN (sym) = MODULE_DOMAIN; + list_to_add = &global_symbols; + break; case DW_TAG_common_block: SYMBOL_ACLASS_INDEX (sym) = LOC_COMMON_BLOCK; SYMBOL_DOMAIN (sym) = COMMON_BLOCK_DOMAIN; |