]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/interp.exp
Automatic date update in version.in
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / interp.exp
1 # Copyright 2004-2024 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 # interp.exp Test interpreter-exec command
17
18 standard_testfile
19
20 if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile {debug}] } {
21 return -1
22 }
23
24 # Do not use gdb_test for this test, since it has two prompts.
25 gdb_test_multiple "interpreter-exec mi \"-var-update *\"" "" {
26 -re "\\^done,changelist=\\\[\\\]\r\n$gdb_prompt " {
27 pass $gdb_test_name
28 gdb_expect 1 {
29 -re "\r\n$gdb_prompt $" { }
30 }
31 }
32 }
33 gdb_test "interpreter-exec console \"show version\"" "GNU gdb .*"
34
35 # Regression test for crash when an exception occurs in mi_parse.
36 gdb_test_multiple "interpreter-exec mi \"-break-insert --thread a\"" \
37 "regression test for mi_parse crash" {
38 -re ".error,msg=.Invalid value for the '--thread' option.\r\n$gdb_prompt " {
39 pass $gdb_test_name
40 gdb_expect 1 {
41 -re "\r\n$gdb_prompt $" { }
42 }
43 }
44 }
45
46 gdb_test_multiple "interpreter-exec mi \"-stack-info-frame\"" "" {
47 -re ".error,msg=.No registers\..\r\n$gdb_prompt " {
48 pass $gdb_test_name
49 gdb_expect 1 {
50 -re "\r\n$gdb_prompt $" { }
51 }
52 }
53 }
54
55 gdb_test_multiple "interpreter-exec mi2 \"-break-insert main\"" "" {
56 -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
57 pass $gdb_test_name
58 gdb_expect 1 {
59 -re "\r\n$gdb_prompt $" { }
60 }
61 }
62 }
63
64 gdb_test_multiple "interpreter-exec mi3 \"-break-insert main\"" "" {
65 -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
66 pass $gdb_test_name
67 gdb_expect 1 {
68 -re "\r\n$gdb_prompt $" { }
69 }
70 }
71 }
72
73 set test "define hello command"
74 set commands "interpreter-exec mi3 \"-data-evaluate-expression 23\""
75 gdb_test_multiple "define hello" "$test" {
76 -re "Type commands for definition of \"hello\".\r\nEnd with a line saying just \"end\".\r\n>$" {
77 pass "$test"
78 }
79 }
80 gdb_test "$commands\nend" "" "finish defining hello command"
81
82 gdb_test "hello" [string_to_regexp "^done,value=\"23\""]
83
84 if {![runto_main]} {
85 return -1
86 }
87
88 gdb_test "list" ".*\[0-9\].*main \\(int argc.*" "can list sources"
89 gdb_exit