• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/gdb/gdb/testsuite/gdb.base/
1#   Copyright 1999, 2007 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# Please email any bugs, comments, and/or additions to this file to:
17# bug-gdb@prep.ai.mit.edu
18
19
20if $tracelevel then {
21    strace $tracelevel
22}
23
24#
25# test running programs
26#
27set prms_id 0
28set bug_id 0
29
30set testfile "async"
31set srcfile ${testfile}.c
32set binfile ${objdir}/${subdir}/${testfile}
33
34if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
35    untested async.exp
36    return -1
37}
38
39if [get_compiler_info ${binfile}] {
40    return -1
41}
42
43########################################
44##
45## Don't do any of these tests until we reach consensus on this file.
46##
47return 0
48########################################
49
50set board [target_info name]
51set current_target [target_info gdb_protocol]
52if { $current_target == "remote" } {
53  unset_board_info "gdb_protocol"
54  set_board_info "gdb_protocol" "async"
55  } else {
56      return 0
57  }
58
59gdb_exit
60gdb_start
61gdb_reinitialize_dir $srcdir/$subdir
62gdb_load ${binfile}
63if [target_info exists gdb_stub] {
64    gdb_step_for_stub;
65}
66
67#
68# set it up at a breakpoint so we can play with it
69#
70if ![runto_main] then {
71    perror "couldn't run to breakpoint"
72    continue
73}
74
75gdb_test "break baz" "" ""
76
77#
78# Make sure we get a 'completed' message when the target is done.
79#
80gdb_test "set display-exec-done on" "" ""
81
82
83send_gdb "next&\n"
84gdb_expect {
85    -re "^next&\r\n$gdb_prompt.*z = 9.*completed\.\r\n" { pass "next &" }
86    -re "$gdb_prompt.*completed\.$" { fail "next &" }
87    timeout  { fail "(timeout) next &" }
88}
89
90send_gdb "step&\n"
91gdb_expect {
92    -re "^step&\r\n$gdb_prompt.*y = foo \\(\\).*completed\.\r\n" { pass "step &" }
93    -re "$gdb_prompt.*completed\.$" { fail "step &" }
94    timeout  { fail "(timeout) step &" }
95}
96
97send_gdb "step&\n"
98gdb_expect {
99    -re "^step&\r\n$gdb_prompt foo \\(\\) at .*async.c.*x = 5.*completed\.\r\n" \
100	    { pass "step &" }
101    -re "$gdb_prompt.*completed\.$" { fail "step &" }
102    timeout  { fail "(timeout) step &" }
103}
104
105send_gdb "stepi&\n"
106gdb_expect {
107    -re "^stepi&\r\n$gdb_prompt.*$hex.*x = 5.*completed\.\r\n" { pass "stepi &" }
108    -re "$gdb_prompt.*completed\.$" { fail "stepi &" }
109    timeout  { fail "(timeout) stepi &" }
110}
111
112send_gdb "nexti&\n"
113gdb_expect {
114    -re "^nexti&\r\n$gdb_prompt.*y = 3.*completed\.\r\n" { pass "nexti &" }
115    -re "$gdb_prompt.*completed\.$" { fail "nexti &" }
116    timeout  { fail "(timeout) nexti &" }
117}
118
119send_gdb "finish&\n"
120gdb_expect {
121    -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" \
122	    { pass "finish &" }
123    -re "$gdb_prompt.*completed\.$" { fail "finish &" }
124    timeout  { fail "(timeout) finish &" }
125}
126
127send_gdb "jump 33&\n"
128gdb_expect {
129    -re "^jump 33&.*Continuing at $hex.*$gdb_prompt.*Breakpoint 2, baz \\(\\) at.*async.c.*return 5.*completed\.\r\n" \
130	    { pass "jump &" }
131    -re ".*$gdb_prompt.*completed\.$" { fail "jump &" }
132    timeout  { fail "(timeout) jump &" }
133}
134
135send_gdb "until 35&\n"
136gdb_expect {
137    -re "^until 35&.*$gdb_prompt.*$hex in main \\(\\) at.*async.c.*y = baz \\(\\).*completed\.\r\n" \
138	    { pass "until &" }
139    -re "$gdb_prompt.*completed\.$" { fail "until &" }
140    timeout  { fail "(timeout) until &" }
141}
142
143gdb_test "set display-exec-done off" "" ""
144
145unset_board_info "gdb_protocol"
146set_board_info "gdb_protocol" "remote"
147
148
149
150
151
152
153