Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / interp.exp
CommitLineData
88b9d363 1# Copyright 2004-2022 Free Software Foundation, Inc.
1b9afc04
NR
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
1b9afc04 6# (at your option) any later version.
e22f8b7c 7#
1b9afc04
NR
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.
e22f8b7c 12#
1b9afc04 13# You should have received a copy of the GNU General Public License
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
1b9afc04
NR
15
16# interp.exp Test interpreter-exec command
17
f8b41b00 18standard_testfile
4801a9a3 19
5b362f04 20if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile {debug}] } {
4801a9a3
PA
21 return -1
22}
1b9afc04 23
97a2d1d3
DJ
24# Do not use gdb_test for this test, since it has two prompts.
25set cmd "interpreter-exec mi \"-var-update *\""
26gdb_test_multiple $cmd $cmd {
27 -re "\\^done,changelist=\\\[\\\]\r\n$gdb_prompt " {
28 pass "$cmd"
29 gdb_expect 1 {
30 -re "\r\n$gdb_prompt $" { }
31 }
32 }
33}
74e5ef44 34gdb_test "interpreter-exec console \"show version\"" "GNU gdb .*"
1b9afc04 35
305aeedc
TT
36# Regression test for crash when an exception occurs in mi_parse.
37gdb_test_multiple "interpreter-exec mi \"-break-insert --thread a\"" \
38 "regression test for mi_parse crash" {
39 -re ".error,msg=.Invalid value for the '--thread' option.\r\n$gdb_prompt " {
40 pass "$cmd"
41 gdb_expect 1 {
42 -re "\r\n$gdb_prompt $" { }
43 }
44 }
45 }
46
4801a9a3
PA
47set cmd "interpreter-exec mi \"-stack-info-frame\""
48gdb_test_multiple $cmd $cmd {
49 -re ".error,msg=.No registers\..\r\n$gdb_prompt " {
50 pass "$cmd"
51 gdb_expect 1 {
52 -re "\r\n$gdb_prompt $" { }
53 }
54 }
55}
56
57set cmd "interpreter-exec mi1 \"-break-insert main\""
58gdb_test_multiple $cmd $cmd {
59 -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
60 pass "$cmd"
61 gdb_expect 1 {
62 -re "\r\n$gdb_prompt $" { }
63 }
64 }
65}
66
67set cmd "interpreter-exec mi2 \"-break-insert main\""
68gdb_test_multiple $cmd $cmd {
69 -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
70 pass "$cmd"
71 gdb_expect 1 {
72 -re "\r\n$gdb_prompt $" { }
73 }
74 }
75}
76
77set cmd "interpreter-exec mi3 \"-break-insert main\""
78gdb_test_multiple $cmd $cmd {
79 -re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
80 pass "$cmd"
81 gdb_expect 1 {
82 -re "\r\n$gdb_prompt $" { }
83 }
84 }
85}
86
87if ![runto_main] then {
88 fail "run to main"
ae59b1da 89 return -1
4801a9a3
PA
90}
91
92gdb_test "list" ".*\[0-9\].*main \\(int argc.*" "can list sources"
1b9afc04 93gdb_exit
This page took 1.913054 seconds and 4 git commands to generate.