Commit | Line | Data |
---|---|---|
28e7fd62 | 1 | # Copyright 2001-2013 Free Software Foundation, Inc. |
3207ec21 KB |
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 | |
4fcb9948 | 5 | # the Free Software Foundation; either version 3 of the License, or |
3207ec21 | 6 | # (at your option) any later version. |
4fcb9948 | 7 | # |
3207ec21 KB |
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. | |
4fcb9948 | 12 | # |
3207ec21 | 13 | # You should have received a copy of the GNU General Public License |
c7b778ff | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
3207ec21 | 15 | |
3207ec21 KB |
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 | ||
3207ec21 | 23 | set testfile step-line |
f2dd3617 | 24 | set srcfile ${testfile}.c |
f24fce77 | 25 | set linefile ${testfile}.inp |
3207ec21 KB |
26 | set binfile ${objdir}/${subdir}/${testfile} |
27 | ||
28 | remote_exec build "rm -f ${binfile}" | |
f2dd3617 | 29 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { |
b60f0898 JB |
30 | untested step-line.exp |
31 | return -1 | |
3207ec21 KB |
32 | } |
33 | ||
34 | gdb_exit | |
35 | gdb_start | |
36 | gdb_reinitialize_dir $srcdir/$subdir | |
37 | gdb_load ${binfile} | |
38 | ||
39 | if ![runto_main] then { | |
40 | fail "Can't run to main" | |
41 | return 0 | |
42 | } | |
43 | ||
f24fce77 NF |
44 | set remote_linefile [remote_download host ${srcdir}/${subdir}/${linefile}] |
45 | ||
293e2f9e | 46 | gdb_test "break f1" ".*Breakpoint 2 at .* file .*step-line.c.*" "break f1" |
3207ec21 KB |
47 | gdb_test "continue" \ |
48 | "Continuing.*Breakpoint 2, f1 \\(i=4\\).*dummy \\(1, i\\);" \ | |
49 | "continue to f1" | |
50 | gdb_test "next" \ | |
51 | ".*i = f2 \\(i\\);.*" \ | |
52 | "next over dummy 1" | |
53 | gdb_test "next" \ | |
54 | ".*dummy \\(2, i\\);.*" \ | |
55 | "next to dummy 2" | |
56 | gdb_test "next" \ | |
57 | ".*i = f2 \\(i\\);.*" \ | |
58 | "next over dummy 2" | |
59 | gdb_test "step" \ | |
60 | ".*f2 \\(i=4\\).*dummy \\(4, i\\);.*" \ | |
61 | "step into f2" | |
62 | gdb_test "next" \ | |
63 | ".*j = i;.*" \ | |
64 | "next over dummy 4" | |
65 | gdb_test "next" \ | |
66 | ".*dummy \\(5, i\\);.*" \ | |
67 | "next to dummy 5" | |
68 | gdb_test "next" \ | |
69 | ".*dummy \\(6, j\\);.*" \ | |
70 | "next to dummy 6" | |
71 | gdb_test "next" \ | |
72 | ".*j = SUCC \\(j\\);.*" \ | |
73 | "next over dummy 6" | |
74 | gdb_test "next" \ | |
75 | ".*dummy \\(7, i\\);.*" \ | |
76 | "next to dummy 7" | |
77 | gdb_test "next" \ | |
78 | ".*dummy \\(8, j\\);.*" \ | |
79 | "next to dummy 8" | |
80 | gdb_test "next" \ | |
81 | ".*j = j - i;.*" \ | |
82 | "next over dummy 8" | |
83 | gdb_test "next" \ | |
84 | ".*dummy \\(9, i\\);.*" \ | |
85 | "next to dummy 9" | |
86 | gdb_test "next" \ | |
87 | ".*dummy \\(10, j\\);.*" \ | |
88 | "next to dummy 10" | |
89 | gdb_test "next" \ | |
90 | ".*RETURN \\(j\\);.*" \ | |
91 | "next over dummy 10" | |
f24fce77 NF |
92 | |
93 | remote_file host delete ${remote_linefile} | |
94 | ||
3207ec21 | 95 | return 0 |