aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-06-02 22:41:56 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-06-02 22:41:56 +0000
commitf55ee35cf17f1eb104292b4c6b2f7def38ffe4a8 (patch)
treec2e55a94783ead4a756b264e10093e6382e40c0f /gdb/symtab.c
parent31e43e98bfeca5206fc5dfdfa7ff7d5eeca27a92 (diff)
downloadgdb-f55ee35cf17f1eb104292b4c6b2f7def38ffe4a8.zip
gdb-f55ee35cf17f1eb104292b4c6b2f7def38ffe4a8.tar.gz
gdb-f55ee35cf17f1eb104292b4c6b2f7def38ffe4a8.tar.bz2
gdb/
Support DW_TAG_module as separate namespaces. * dwarf2read.c (typename_concat): New parameter physname. (read_module_type): New function and declaration. (scan_partial_symbols): Scan also DW_TAG_module children. (partial_die_parent_scope): Accept scope even from DW_TAG_module. Pass to typename_concat backward compatible physname value 0. (partial_die_full_name, read_namespace_type): Pass to typename_concat backward compatible physname value 0. (add_partial_module, read_module): Remove FIXME comment. (process_die) <DW_TAG_module>: Set PROCESSING_HAS_NAMESPACE_INFO. (die_needs_namespace) <DW_TAG_variable>: Allow returning true even for DIEs under DW_TAG_module. (dwarf2_compute_name): Move the ada block for DW_AT_linkage_name and DW_AT_MIPS_linkage_name first, extend it for language_fortran && physname and return there instead of just setting NAME. Extend the main block for language_fortran. Pass physname parameter to the typename_concat call. (read_import_statement, read_func_scope, get_scope_pc_bounds) (load_partial_dies, determine_prefix): Support also DW_TAG_module. (new_symbol): Fill in cplus_specific.demangled_name if it is still missing from SYMBOL_SET_NAMES in the language_fortran case. (new_symbol) <DW_TAG_variable>: Force LOC_UNRESOLVED for gfortran module variables. (read_type_die) <DW_TAG_module>: New. (MAX_SEP_LEN): Increase to 7. (typename_concat): New parameter physname. New variable lead. Support also language_fortran. * f-exp.y (yylex): Consider : also as a symbol name character class. * f-lang.c: Include cp-support.h. (f_word_break_characters, f_make_symbol_completion_list): New functions. (f_language_defn): Use cp_lookup_symbol_nonlocal, f_word_break_characters and f_make_symbol_completion_list. * f-typeprint.c (f_type_print_base) <TYPE_CODE_MODULE>: New. * gdbtypes.h (enum type_code) <TYPE_CODE_MODULE>: New. * symtab.c (symbol_init_language_specific): Support language_fortran. (symbol_find_demangled_name): New comment on language_fortran. (symbol_natural_name, symbol_demangled_name): Use demangled_name even for language_fortran. (lookup_symbol_aux_local): Check imports also for language_fortran. (default_make_symbol_completion_list): Rename to ... (default_make_symbol_completion_list_break_on): ... this name. New parameter break_on, use it. (default_make_symbol_completion_list): New stub. * symtab.h (default_make_symbol_completion_list_break_on): New prototype. gdb/testsuite/ Support DW_TAG_module as separate namespaces. * gdb.fortran/library-module.exp, gdb.fortran/library-module-main.f90, gdb.fortran/library-module-lib.f90: New. * gdb.fortran/module.exp: Replace startup by a prepare_for_testing call. (print i): Remove. (continue to breakpoint: i-is-1, print var_i value 1) (continue to breakpoint: i-is-2, print var_i value 2) (continue to breakpoint: a-b-c-d, print var_a, print var_b, print var_c) (print var_d, print var_i value 14, ptype modmany, complete `modm) (complete `modmany, complete `modmany`, complete `modmany`var) (show language, setting breakpoint at module): New tests. * gdb.fortran/module.f90 (module mod): Remove. (module mod1, module mod2, module modmany, subroutine sub1) (subroutine sub2, program module): New.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 632893d..cada00e 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -351,7 +351,8 @@ symbol_init_language_specific (struct general_symbol_info *gsymbol,
if (gsymbol->language == language_cplus
|| gsymbol->language == language_d
|| gsymbol->language == language_java
- || gsymbol->language == language_objc)
+ || gsymbol->language == language_objc
+ || gsymbol->language == language_fortran)
{
gsymbol->language_specific.cplus_specific.demangled_name = NULL;
}
@@ -465,6 +466,11 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol,
return demangled;
}
}
+ /* We could support `gsymbol->language == language_fortran' here to provide
+ module namespaces also for inferiors with only minimal symbol table (ELF
+ symbols). Just the mangling standard is not standardized across compilers
+ and there is no DW_AT_producer available for inferiors with only the ELF
+ symbols to check the mangling kind. */
return NULL;
}
@@ -645,6 +651,7 @@ symbol_natural_name (const struct general_symbol_info *gsymbol)
case language_d:
case language_java:
case language_objc:
+ case language_fortran:
if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
return gsymbol->language_specific.cplus_specific.demangled_name;
break;
@@ -671,6 +678,7 @@ symbol_demangled_name (const struct general_symbol_info *gsymbol)
case language_d:
case language_java:
case language_objc:
+ case language_fortran:
if (gsymbol->language_specific.cplus_specific.demangled_name != NULL)
return gsymbol->language_specific.cplus_specific.demangled_name;
break;
@@ -1156,7 +1164,7 @@ lookup_symbol_aux_local (const char *name, const struct block *block,
if (sym != NULL)
return sym;
- if (language == language_cplus)
+ if (language == language_cplus || language == language_fortran)
{
sym = cp_lookup_symbol_imports (scope,
name,
@@ -3582,7 +3590,8 @@ add_partial_symbol_name (const char *name, void *user_data)
}
char **
-default_make_symbol_completion_list (char *text, char *word)
+default_make_symbol_completion_list_break_on (char *text, char *word,
+ const char *break_on)
{
/* Problem: All of the symbols have to be copied because readline
frees them. I'm not going to worry about this; hopefully there
@@ -3645,7 +3654,7 @@ default_make_symbol_completion_list (char *text, char *word)
while (p > text)
{
if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0'
- || p[-1] == ':')
+ || p[-1] == ':' || strchr (break_on, p[-1]) != NULL)
--p;
else
break;
@@ -3771,6 +3780,12 @@ default_make_symbol_completion_list (char *text, char *word)
return (return_val);
}
+char **
+default_make_symbol_completion_list (char *text, char *word)
+{
+ return default_make_symbol_completion_list_break_on (text, word, "");
+}
+
/* Return a NULL terminated array of all symbols (regardless of class)
which begin by matching TEXT. If the answer is no symbols, then
the return value is an array which contains only a NULL pointer. */