]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.fortran/module.exp
Update year range in copyright notice of all files owned by the GDB project.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.fortran / module.exp
index fabf6604f131d2046f06a9429e1cef2a6849216a..51f81fce0b8c6c4266fffdaf49be5847f457c595 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2009, 2010 Free Software Foundation, Inc.
+# Copyright 2009-2015 Free Software Foundation, Inc.
 
 # 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
 # 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
+standard_testfile .f90
 
-if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77}] } {
+if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}] } {
     return -1
 }
 
@@ -26,6 +25,8 @@ if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77}] } {
 # The current source language is "auto; currently fortran".
 gdb_test "p modmany::var_i" " = 14" "stopped language detection"
 
+gdb_test "print mod1::var_const" " = 20" "fully qualified name of DW_TAG_constant"
+
 if ![runto MAIN__] then {
     perror "couldn't run to breakpoint MAIN__"
     continue
@@ -42,6 +43,13 @@ 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 "i-is-3"]
+gdb_continue_to_breakpoint "i-is-3" ".*i-is-3.*"
+# Ensure that the scope is correctly resolved.
+gdb_test "p mod3" "Attempt to use a type name as an expression" "print mod3"
+gdb_test "p mod2" " = 3" "print mod2"
+gdb_test "p mod1" " = 3" "print mod1"
+
 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\\."
@@ -49,8 +57,11 @@ 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_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_test "ptype modmany" {No symbol "modmany" in current context.}
+gdb_test "ptype modmany" "type = module modmany"
 
 proc complete {expr list} {
     set cmd "complete p $expr"
@@ -58,8 +69,8 @@ proc complete {expr list} {
     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 "modm" "modmany $modmany_list"
+complete "modmany" "modmany $modmany_list"
 complete "modmany::" $modmany_list
 complete "modmany::var" $modmany_list