2012-01-04 08:17:56 +00:00
|
|
|
# Copyright 2009-2012 Free Software Foundation, Inc.
|
2009-02-12 09:15:07 +00:00
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
set testfile "module"
|
|
|
|
set srcfile ${testfile}.f90
|
|
|
|
|
2011-06-29 17:50:47 +00:00
|
|
|
if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}] } {
|
2009-02-12 09:15:07 +00:00
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
gdb/
* symfile.c (init_filename_language_table): New extensions .for, .FOR,
.ftn, .FTN, .fpp, .FPP, .f90, .F90, .f95, .F95, .f03, .F03, .f08 and
.F08.
gdb/testsuite/
* gdb.fortran/module.exp (stopped language detection): New test.
2010-06-02 23:01:01 +00:00
|
|
|
# Test automatic language detection before the inferior starts. It tests the
|
|
|
|
# effect of expected:
|
|
|
|
# (gdb) show language
|
|
|
|
# The current source language is "auto; currently fortran".
|
|
|
|
gdb_test "p modmany::var_i" " = 14" "stopped language detection"
|
|
|
|
|
2010-09-22 19:22:44 +00:00
|
|
|
gdb_test "print mod1::var_const" " = 20" "fully qualified name of DW_TAG_constant"
|
|
|
|
|
2009-02-12 09:15:07 +00:00
|
|
|
if ![runto MAIN__] then {
|
|
|
|
perror "couldn't run to breakpoint MAIN__"
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
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.
2010-06-02 22:41:56 +00:00
|
|
|
# Do not use simple single-letter names as GDB would pick up for expectedly
|
|
|
|
# nonexisting symbols some static variables from system libraries debuginfos.
|
|
|
|
|
|
|
|
gdb_breakpoint [gdb_get_line_number "i-is-1"]
|
|
|
|
gdb_continue_to_breakpoint "i-is-1" ".*i-is-1.*"
|
|
|
|
gdb_test "print var_i" " = 1" "print var_i value 1"
|
|
|
|
|
|
|
|
gdb_breakpoint [gdb_get_line_number "i-is-2"]
|
|
|
|
gdb_continue_to_breakpoint "i-is-2" ".*i-is-2.*"
|
|
|
|
gdb_test "print var_i" " = 2" "print var_i value 2"
|
|
|
|
|
|
|
|
gdb_breakpoint [gdb_get_line_number "a-b-c-d"]
|
|
|
|
gdb_continue_to_breakpoint "a-b-c-d" ".*a-b-c-d.*"
|
|
|
|
gdb_test "print var_a" "No symbol \"var_a\" in current context\\."
|
|
|
|
gdb_test "print var_b" " = 11"
|
|
|
|
gdb_test "print var_c" "No symbol \"var_c\" in current context\\."
|
|
|
|
gdb_test "print var_d" " = 12"
|
|
|
|
gdb_test "print var_i" " = 14" "print var_i value 14"
|
gdb/
Fix non-only rename list for Fortran modules import.
* cp-namespace.c (cp_scan_for_anonymous_namespaces): Adjust the
cp_add_using_directive caller.
(cp_add_using_directive): New parameter excludes, describe it. New
variables ix and param. Compare if also excludes match. Allocate NEW
with variable size, initialize EXCLUDES there.
(cp_lookup_symbol_imports): New variable excludep, test
current->EXCLUDES with it.
* cp-support.h: Include vec.h.
(struct using_direct): New field excludes, describe it.
(DEF_VEC_P (const_char_ptr)): New.
(cp_add_using_directive): New parameter excludes.
* defs.h (const_char_ptr): New typedef.
* dwarf2read.c (read_import_statement): New variables child_die,
excludes and cleanups, read in excludes.
(read_namespace): Adjust the cp_add_using_directive caller.
gdb/testsuite/
Fix non-only rename list for Fortran modules import.
* gdb.fortran/module.exp (print var_x, print var_y, print var_z): New
tests.
* gdb.fortran/module.f90 (module moduse): New.
(program module): use moduse, test var_x, var_y and var_z.
2011-06-29 22:05:16 +00:00
|
|
|
gdb_test "print var_x" " = 30" "print var_x value 30"
|
|
|
|
gdb_test "print var_y" "No symbol \"var_y\" in current context\\."
|
|
|
|
gdb_test "print var_z" " = 31" "print var_x value 31"
|
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.
2010-06-02 22:41:56 +00:00
|
|
|
|
|
|
|
gdb_test "ptype modmany" {No symbol "modmany" in current context.}
|
|
|
|
|
|
|
|
proc complete {expr list} {
|
|
|
|
set cmd "complete p $expr"
|
|
|
|
set expect [join [concat [list $cmd] $list] "\r\np "]
|
|
|
|
gdb_test $cmd $expect "complete $expr"
|
|
|
|
}
|
|
|
|
set modmany_list {modmany::var_a modmany::var_b modmany::var_c modmany::var_i}
|
|
|
|
complete "modm" $modmany_list
|
|
|
|
complete "modmany" $modmany_list
|
|
|
|
complete "modmany::" $modmany_list
|
|
|
|
complete "modmany::var" $modmany_list
|
|
|
|
|
|
|
|
# Breakpoint would work in language "c".
|
|
|
|
gdb_test "show language" {The current source language is "(auto; currently )?fortran".}
|
|
|
|
|
|
|
|
# gcc-4.4.2: The main program is always MAIN__ in .symtab so "runto" above
|
|
|
|
# works. But DWARF DW_TAG_subprogram contains the name specified by
|
|
|
|
# the "program" Fortran statement.
|
|
|
|
if [gdb_breakpoint "module"] {
|
|
|
|
pass "setting breakpoint at module"
|
|
|
|
}
|