1# Copyright 2019-2023 Free Software Foundation, Inc. 2 3# This program is free software; you can redistribute it and/or modify 4# it under the terms of the GNU General Public License as published by 5# the Free Software Foundation; either version 3 of the License, or 6# (at your option) any later version. 7# 8# This program is distributed in the hope that it will be useful, 9# but WITHOUT ANY WARRANTY; without even the implied warranty of 10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11# GNU General Public License for more details. 12# 13# You should have received a copy of the GNU General Public License 14# along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16standard_testfile 17 18set epilogue [have_epilogue_line_info] 19 20if { [prepare_for_testing "failed to prepare" "skip-inline" \ 21 {skip-inline.c skip1.c } \ 22 {debug nowarnings}] } { 23 return -1 24} 25 26set srcfile skip-inline.c 27set srcfile1 skip1.c 28 29proc_with_prefix single_step { } { 30 if ![runto_main] { 31 return 32 } 33 34 gdb_test "bt" "\\s*\\#0\\s+main.*" "in the main" 35 gdb_test "step" ".*" "step into baz, since foo will be skipped" 36 gdb_test "bt" "\\s*\\#0\\s+baz.*" "in the baz, since foo was skipped" 37 gdb_step_until ".*x = 0; x = baz \\(foo \\(\\)\\).*" 38 gdb_test "bt" "\\s*\\#0\\s+main.*" "again in the main" 39 gdb_test "step" ".*" "step again into baz, since foo will be skipped" 40 gdb_test "bt" "\\s*\\#0\\s+baz.*" "again in the baz" 41 gdb_step_until "main \\(\\) at .*" "step back to main, again" 42 gdb_test "bt" "\\s*\\#0.*main.*" "again back to main" 43} 44 45proc_with_prefix double_step { } { 46 if ![runto_main] { 47 return 48 } 49 50 with_test_prefix "double step" { 51 gdb_test "bt" "\\s*\\#0\\s+main.*" "in the main" 52 gdb_test "step 2" ".*" "step into baz, since foo will be skipped" 53 gdb_test "bt" "\\s*\\#0\\s+baz.*" "still in the baz" 54 gdb_test "step" ".*" "step back to main" 55 gdb_test "bt" "\\s*\\#0\\s+main.*" "again in the main" 56 gdb_test "step 2" ".*" "step again into baz, since foo will be skipped" 57 gdb_test "bt" "\\s*\\#0\\s+baz.*" "again in the baz" 58 gdb_test "step" ".*" "step back to main, again" 59 gdb_test "bt" "\\s*\\#0\\s+main.*" "again back to main" 60 } 61} 62 63proc_with_prefix triple_step { } { 64 if ![runto_main] { 65 return 66 } 67 68 with_test_prefix "triple step" { 69 gdb_test "bt" "\\s*\\#0\\s+main.*" "in the main" 70 gdb_test "step 3" ".*" "step over baz" 71 gdb_test "bt" "\\s*\\#0\\s+main.*" "again in the main" 72 gdb_test "step 3" ".*" "step over baz, again" 73 gdb_test "bt" "\\s*\\#0\\s+main.*" "again back to main" 74 } 75} 76 77proc_with_prefix skip_current_frame { } { 78 if ![runto_main] { 79 return 80 } 81 82 gdb_test "skip delete" ".*" "skip delete" 83 84 gdb_test "bt" "\\s*\\#0\\s+main.*" "in the main" 85 gdb_test "step" ".*" "step into foo" 86 gdb_test "bt" "\\s*\\#0\\s+foo.*" "in the foo" 87 gdb_test "skip" "Function foo will be skipped when stepping\." "skip" 88} 89 90# Create a skiplist entry for a specified file and function. 91 92gdb_test "skip function foo" "Function foo will be skipped when stepping\." 93 94single_step 95 96# Some compilers link the epilogue of functions to the line containing the 97# closing brace, while others dont. The behavior ends up so out of sync 98# with multiple steps at a time, that completely different procs would need 99# to be made, and it is frankly unnecessary. 100if {$epilogue} { 101 double_step 102 triple_step 103} 104 105skip_current_frame 106