OSDN Git Service

gdb/
[pf3gnuchains/pf3gnuchains4x.git] / gdb / testsuite / gdb.base / interp.exp
1 # Copyright 2004, 2005, 2007, 2008, 2009, 2010, 2011
2 # Free Software Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # interp.exp   Test interpreter-exec command
18
19 if $tracelevel then {
20     strace $tracelevel
21 }
22
23 set testfile "interp"
24
25 if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.c {debug}] } {
26     return -1
27 }
28
29 # Do not use gdb_test for this test, since it has two prompts.
30 set cmd "interpreter-exec mi \"-var-update *\""
31 gdb_test_multiple $cmd $cmd {
32     -re "\\^done,changelist=\\\[\\\]\r\n$gdb_prompt " {
33         pass "$cmd"
34         gdb_expect 1 {
35             -re "\r\n$gdb_prompt $" { }
36         }
37     }
38 }
39 gdb_test "interpreter-exec console \"show version\"" "GNU gdb .*"
40
41 # Regression test for crash when an exception occurs in mi_parse.
42 gdb_test_multiple "interpreter-exec mi \"-break-insert --thread a\"" \
43     "regression test for mi_parse crash" {
44         -re ".error,msg=.Invalid value for the '--thread' option.\r\n$gdb_prompt " {
45             pass "$cmd"
46             gdb_expect 1 {
47                 -re "\r\n$gdb_prompt $" { }
48             }
49         }
50     }
51
52 set cmd "interpreter-exec mi \"-stack-info-frame\""
53 gdb_test_multiple $cmd $cmd {
54     -re ".error,msg=.No registers\..\r\n$gdb_prompt " {
55         pass "$cmd"
56         gdb_expect 1 {
57             -re "\r\n$gdb_prompt $" { }
58         }
59     }
60 }
61
62 set cmd "interpreter-exec mi1 \"-break-insert main\""
63 gdb_test_multiple $cmd $cmd {
64     -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
65         pass "$cmd"
66         gdb_expect 1 {
67             -re "\r\n$gdb_prompt $" { }
68         }
69     }
70 }
71
72 set cmd "interpreter-exec mi2 \"-break-insert main\""
73 gdb_test_multiple $cmd $cmd {
74     -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
75         pass "$cmd"
76         gdb_expect 1 {
77             -re "\r\n$gdb_prompt $" { }
78         }
79     }
80 }
81
82 set cmd "interpreter-exec mi3 \"-break-insert main\""
83 gdb_test_multiple $cmd $cmd {
84     -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
85         pass "$cmd"
86         gdb_expect 1 {
87             -re "\r\n$gdb_prompt $" { }
88         }
89     }
90 }
91
92 if ![runto_main] then {
93   fail "run to main"
94   return -1;
95 }
96
97 gdb_test "list" ".*\[0-9\].*main \\(int argc.*" "can list sources"
98 gdb_exit