summaryrefslogtreecommitdiff
path: root/gdb/f-exp.y
diff options
context:
space:
mode:
authorKeven Boell <keven.boell@intel.com>2013-10-25 12:10:57 +0100
committerKeven Boell <keven.boell@intel.com>2013-12-19 13:18:11 +0100
commit7f9b20bb352768e14cfa7361a82373b8539bebed (patch)
tree34deb1ab6cadd180d1b66111fb3b8c98685e6879 /gdb/f-exp.y
parentf6ec89e7bc631c0bd48cb6c4b960b29266e19550 (diff)
downloadbinutils-gdb-7f9b20bb352768e14cfa7361a82373b8539bebed.tar.gz
fortran: enable ptype/whatis for user defined types.
(gdb) ptype type old> No symbol "type" in current context. new> type = Type type integer(kind=4) :: t_i End Type type 2013-11-19 Sanimir Agovic <sanimir.agovic@intel.com> Keven Boell <keven.boell@intel.com> * f-exp.y (yylex): Add domain array to enable lookup in multiple domains. Loop over lookup domains and try to find requested symbol. Add STRUCT_DOMAIN to lookup domains to be able to query for user defined types. testsuite/ * gdb.fortran/type.f90: New file. * gdb.fortran/whatis_type.f90: New file.
Diffstat (limited to 'gdb/f-exp.y')
-rw-r--r--gdb/f-exp.y33
1 files changed, 21 insertions, 12 deletions
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 567cd005acb..a7e59df7aea 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -1175,21 +1175,30 @@ yylex (void)
char *tmp = copy_name (yylval.sval);
struct symbol *sym;
struct field_of_this_result is_a_field_of_this;
+ enum domain_enum_tag lookup_domains[] = {STRUCT_DOMAIN, VAR_DOMAIN};
+ int i;
int hextype;
-
- /* Initialize this in case we *don't* use it in this call; that
- way we can refer to it unconditionally below. */
- memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
-
- sym = lookup_symbol (tmp, expression_context_block,
- VAR_DOMAIN,
- parse_language->la_language == language_cplus
- ? &is_a_field_of_this : NULL);
- if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
+
+ for (i = 0; i < ARRAY_SIZE (lookup_domains); ++i)
{
- yylval.tsym.type = SYMBOL_TYPE (sym);
- return TYPENAME;
+ /* Initialize this in case we *don't* use it in this call; that
+ way we can refer to it unconditionally below. */
+ memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
+
+ sym = lookup_symbol (tmp, expression_context_block,
+ lookup_domains[i],
+ parse_language->la_language == language_cplus
+ ? &is_a_field_of_this : NULL);
+ if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
+ {
+ yylval.tsym.type = SYMBOL_TYPE (sym);
+ return TYPENAME;
+ }
+
+ if (sym)
+ break;
}
+
yylval.tsym.type
= language_lookup_primitive_type_by_name (parse_language,
parse_gdbarch, tmp);