Automatic date update in version.in
[binutils-gdb/blckswan.git] / gdb / testsuite / gdb.mi / mi-language.exp
blobdb23590a70c8bcbabbf2079aac48af6f7a47e7f0
1 # Copyright 2013-2022 Free Software Foundation, Inc.
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.
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.
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/>.
16 load_lib mi-support.exp
17 set MIFLAGS "-i=mi"
19 gdb_exit
20 if [mi_gdb_start] {
21 return
24 # First, verify that the debugger correctly advertises support
25 # for the --language option.
26 mi_gdb_test "-list-features" \
27 "\\^done,features=\\\[.*\"language-option\".*\\\]" \
28 "-list-features should include \"language-option\""
30 mi_gdb_test "set lang ada" \
31 ".*=cmd-param-changed,param=\"language\",value=\"ada\".*"
33 # Evaluate an expression that the Ada language is unable to parse.
34 mi_gdb_test "-data-evaluate-expression \"sizeof (void*)\"" \
35 "\\^error,.*" \
36 "sizeof expression using current language"
38 # Now, ask for the same expression to be parsed, but using the C
39 # language.
40 mi_gdb_test "-data-evaluate-expression --language c \"sizeof (void*)\"" \
41 "\\^done,value=\"$decimal\"" \
42 "sizeof expression using C language"
44 # Double-check that the current language has not changed.
45 mi_gdb_test "show lang ada" \
46 ".*The current source language is \\\\\"ada\\\\\".*"
48 # Test what happens when specifying an invalid language name...
49 mi_gdb_test "-data-evaluate-expression --language invlang \"sizeof (void*)\"" \
50 "\\^error,msg=\"Invalid --language argument: invlang\"" \
51 "data-evaluate-expression with invalid language name"
53 # Make sure that "--language auto" is also rejected.
54 mi_gdb_test "-data-evaluate-expression --language auto \"sizeof (void*)\"" \
55 "\\^error,msg=\"Invalid --language argument: auto\"" \
56 "data-evaluate-expression with language auto"
58 # Make sure that "--language local" is also rejected.
59 mi_gdb_test "-data-evaluate-expression --language local \"sizeof (void*)\"" \
60 "\\^error,msg=\"Invalid --language argument: local\"" \
61 "data-evaluate-expression with language local"
63 # Make sure that "--language unknown" is also rejected.
64 mi_gdb_test "-data-evaluate-expression --language unknown \"sizeof (void*)\"" \
65 "\\^error,msg=\"Invalid --language argument: unknown\"" \
66 "data-evaluate-expression with language unknown"