]> Git Repo - binutils.git/blob - gdb/testsuite/gdb.base/async.exp
gdb.base/async.exp: Don't hardcode line numbers.
[binutils.git] / gdb / testsuite / gdb.base / async.exp
1 #   Copyright 1999-2014 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
17 #
18 # test running programs
19 #
20
21 standard_testfile
22
23 if [get_compiler_info] {
24     return -1
25 }
26
27 if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
28     untested $testfile.exp
29     return -1
30 }
31
32 ########################################
33 ##
34 ## Don't do any of these tests until we reach consensus on this file.
35 ##
36 return 0
37 ########################################
38
39 gdb_exit
40 gdb_start
41 gdb_reinitialize_dir $srcdir/$subdir
42 gdb_load ${binfile}
43
44 gdb_test_no_output "set target-async on"
45
46 #
47 # set it up at a breakpoint so we can play with it
48 #
49 if ![runto_main] then {
50     perror "couldn't run to breakpoint"
51     continue
52 }
53
54 gdb_test "break baz" ".*" ""
55
56 #
57 # Make sure we get a 'completed' message when the target is done.
58 #
59 gdb_test_no_output "set exec-done-display on"
60
61
62 send_gdb "next&\n" 
63 gdb_expect {
64     -re "^next&\r\n$gdb_prompt.*z = 9.*completed\.\r\n" { pass "next &" }
65     -re "$gdb_prompt.*completed\.$" { fail "next &" }
66     timeout  { fail "(timeout) next &" }
67 }
68
69 send_gdb "step&\n" 
70 gdb_expect {
71     -re "^step&\r\n$gdb_prompt.*y = foo \\(\\).*completed\.\r\n" { pass "step &" }
72     -re "$gdb_prompt.*completed\.$" { fail "step &" }
73     timeout  { fail "(timeout) step &" }
74 }
75
76 send_gdb "step&\n" 
77 gdb_expect {
78     -re "^step&\r\n$gdb_prompt foo \\(\\) at .*async.c.*x = 5.*completed\.\r\n" \
79             { pass "step &" }
80     -re "$gdb_prompt.*completed\.$" { fail "step &" }
81     timeout  { fail "(timeout) step &" }
82 }
83
84 send_gdb "stepi&\n" 
85 gdb_expect {
86     -re "^stepi&\r\n$gdb_prompt.*$hex.*x = 5.*completed\.\r\n" { pass "stepi &" }
87     -re "$gdb_prompt.*completed\.$" { fail "stepi &" }
88     timeout  { fail "(timeout) stepi &" }
89 }
90
91 send_gdb "nexti&\n" 
92 gdb_expect {
93     -re "^nexti&\r\n$gdb_prompt.*y = 3.*completed\.\r\n" { pass "nexti &" }
94     -re "$gdb_prompt.*completed\.$" { fail "nexti &" }
95     timeout  { fail "(timeout) nexti &" }
96 }
97
98 send_gdb "finish&\n" 
99 gdb_expect {
100     -re "^finish&\r\nRun till exit from #0  foo \\(\\) at.*async.c.*\r\n$gdb_prompt.*$hex in main \\(\\) at.*async.c.*y = foo \\(\\).*Value returned is.*= 8.*completed\.\r\n" \
101             { pass "finish &" }
102     -re "$gdb_prompt.*completed\.$" { fail "finish &" }
103     timeout  { fail "(timeout) finish &" }
104 }
105
106 set jump_here [gdb_get_line_number "jump here"]
107
108 send_gdb "jump $jump_here&\n"
109 gdb_expect {
110     -re "^jump $jump_here&.*Continuing at $hex.*$gdb_prompt.*Breakpoint 2, baz \\(\\) at.*async.c.*return 5.*completed\.\r\n" \
111             { pass "jump &" }
112     -re ".*$gdb_prompt.*completed\.$" { fail "jump &" }
113     timeout  { fail "(timeout) jump &" }
114 }
115
116 set until_here [gdb_get_line_number "until here"]
117
118 send_gdb "until $until_here&\n" 
119 gdb_expect {
120     -re "^until $until_here&.*$gdb_prompt.*$hex in main \\(\\) at.*async.c.*y = baz \\(\\).*completed\.\r\n" \
121             { pass "until &" }
122     -re "$gdb_prompt.*completed\.$" { fail "until &" }
123     timeout  { fail "(timeout) until &" }
124 }
125
126 gdb_test_no_output "set exec-done-display off"
This page took 0.030834 seconds and 4 git commands to generate.