From 530e8392d7d5d4a831c5ce0e4cd410e1c4bd166a Mon Sep 17 00:00:00 2001 From: Keven Boell Date: Fri, 15 Nov 2013 11:32:01 +0100 Subject: 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 Sanimir Agovic * 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. --- gdb/cp-namespace.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gdb/cp-namespace.c') diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index d0520bd..a3684aa 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -812,6 +812,10 @@ cp_lookup_nested_symbol (struct type *parent_type, case TYPE_CODE_STRUCT: case TYPE_CODE_NAMESPACE: case TYPE_CODE_UNION: + /* NOTE: Handle modules here as well, because Fortran is re-using the C++ + specific code to lookup nested symbols in modules, by calling the + function pointer la_lookup_symbol_nonlocal, which ends up here. */ + case TYPE_CODE_MODULE: { /* NOTE: carlton/2003-11-10: We don't treat C++ class members of classes like, say, data or function members. Instead, -- cgit v1.1