1# Copyright 2001-2020 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 16# use this to debug: 17# 18#log_user 1 19 20# step-line.exp -- Expect script to test stepping in files with 21# #line directives. 22 23standard_testfile 24set linefile ${testfile}.inp 25 26if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { 27 return -1 28} 29 30if ![runto_main] then { 31 fail "can't run to main" 32 return 0 33} 34 35set remote_linefile [gdb_remote_download host ${srcdir}/${subdir}/${linefile}] 36 37gdb_test "break f1" ".*Breakpoint 2 at .* file .*step-line.c.*" 38gdb_test "continue" \ 39 "Continuing.*Breakpoint 2, f1 \\(i=4\\).*dummy \\(1, i\\);" \ 40 "continue to f1" 41gdb_test "next" \ 42 ".*i = f2 \\(i\\);.*" \ 43 "next over dummy 1" 44gdb_test "next" \ 45 ".*dummy \\(2, i\\);.*" \ 46 "next to dummy 2" 47gdb_test "next" \ 48 ".*i = f2 \\(i\\);.*" \ 49 "next over dummy 2" 50gdb_test "step" \ 51 ".*f2 \\(i=4\\).*dummy \\(4, i\\);.*" \ 52 "step into f2" 53gdb_test "next" \ 54 ".*j = i;.*" \ 55 "next over dummy 4" 56gdb_test "next" \ 57 ".*dummy \\(5, i\\);.*" \ 58 "next to dummy 5" 59gdb_test "next" \ 60 ".*dummy \\(6, j\\);.*" \ 61 "next to dummy 6" 62gdb_test "next" \ 63 ".*j = SUCC \\(j\\);.*" \ 64 "next over dummy 6" 65gdb_test "next" \ 66 ".*dummy \\(7, i\\);.*" \ 67 "next to dummy 7" 68gdb_test "next" \ 69 ".*dummy \\(8, j\\);.*" \ 70 "next to dummy 8" 71gdb_test "next" \ 72 ".*j = j - i;.*" \ 73 "next over dummy 8" 74gdb_test "next" \ 75 ".*dummy \\(9, i\\);.*" \ 76 "next to dummy 9" 77gdb_test "next" \ 78 ".*dummy \\(10, j\\);.*" \ 79 "next to dummy 10" 80gdb_test "next" \ 81 ".*RETURN \\(j\\);.*" \ 82 "next over dummy 10" 83 84return 0 85