gdb/fortran: Nested subroutine support
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.fortran / nested-funcs.exp
index f6a5335ac27fe0fbfa560018b74306a18b2a24e2..abc2423f8cfd5de4560309b4548d8523c37964a1 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright 2016-2017 Free Software Foundation, Inc.\r
+# Copyright 2016-2019 Free Software Foundation, Inc.\r
 \r
 # This program is free software; you can redistribute it and/or modify\r
 # it under the terms of the GNU General Public License as published by\r
@@ -30,12 +30,17 @@ if ![runto MAIN__] then {
     continue\r
 }\r
 \r
+# Test if we can set a breakpoint in a nested function\r
+gdb_breakpoint "testnestedfuncs::sub_nested_outer"\r
+gdb_continue_to_breakpoint "testnestedfuncs::sub_nested_outer" \\r
+    ".*local_int = 19"\r
+\r
 # Test if we can access local and\r
 # non-local variables defined one level up.\r
 gdb_breakpoint [gdb_get_line_number "! BP_outer"]\r
 gdb_continue_to_breakpoint "! BP_outer" ".*! BP_outer"\r
 gdb_test "print index" "= 13" "print index at BP_outer"\r
-gdb_test "set index = 42"\r
+gdb_test_no_output "set variable index = 42"\r
 gdb_test "print index" "= 42" "print index at BP_outer, manipulated"\r
 gdb_test "print local_int" "= 19" "print local_int in outer function"\r
 \r
@@ -43,6 +48,11 @@ gdb_test "print local_int" "= 19" "print local_int in outer function"
 gdb_test "up"\r
 gdb_test "print index" "= 42" "print index at BP1, one frame up"\r
 \r
+# Test if we can set a breakpoint in a nested function\r
+gdb_breakpoint "testnestedfuncs::sub_nested_inner"\r
+gdb_continue_to_breakpoint "testnestedfuncs::sub_nested_inner" \\r
+    ".*local_int = 17"\r
+\r
 # Test if we can access local and\r
 # non-local variables defined two level up.\r
 gdb_breakpoint [gdb_get_line_number "! BP_inner"]\r
@@ -57,6 +67,24 @@ gdb_continue_to_breakpoint "! BP_outer_2" ".*! BP_outer_2"
 gdb_test "print local_int" "= 19" \\r
   "print local_int in outer function, after sub_nested_inner"\r
 \r
+# Test if we can set a breakpoint in public routine with the same name\r
+# as the internal\r
+gdb_breakpoint "sub_nested_outer"\r
+gdb_continue_to_breakpoint "sub_nested_outer" \\r
+    ".*name = 'sub_nested_outer external'"\r
+\r
+# Test if we can set a breakpoint in public routine with the same name\r
+# as the internal\r
+gdb_breakpoint "sub_with_sub_nested_outer::sub_nested_outer"\r
+gdb_continue_to_breakpoint \\r
+    "sub_with_sub_nested_outer::sub_nested_outer" ".*local_int = 11"\r
+\r
+# Test if we can set a breakpoint in public routine with the same name\r
+# as the internal\r
+gdb_breakpoint "mod1::sub_nested_outer"\r
+gdb_continue_to_breakpoint "mod1::sub_nested_outer" \\r
+    ".*name = 'sub_nested_outer_mod1'"\r
+\r
 # Sanity check in main.\r
 gdb_breakpoint [gdb_get_line_number "! BP_main"]\r
 gdb_continue_to_breakpoint "! BP_main" ".*! BP_main"\r
This page took 0.026509 seconds and 4 git commands to generate.