Commit | Line | Data |
---|---|---|
618f726f | 1 | # Copyright 2013-2016 Free Software Foundation, Inc. |
403cb6b1 JB |
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 | load_lib mi-support.exp | |
17 | set MIFLAGS "-i=mi" | |
18 | ||
19 | gdb_exit | |
20 | if [mi_gdb_start] { | |
21 | continue | |
22 | } | |
23 | ||
176f037c JB |
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\"" | |
29 | ||
403cb6b1 JB |
30 | mi_gdb_test "set lang ada" \ |
31 | ".*=cmd-param-changed,param=\"language\",value=\"ada\".*" \ | |
32 | "set lang ada" | |
33 | ||
34 | # Evaluate an expression that the Ada language is unable to parse. | |
35 | mi_gdb_test "-data-evaluate-expression \"sizeof (void*)\"" \ | |
36 | "\\^error,.*" \ | |
37 | "sizeof expression using current language" | |
38 | ||
39 | # Now, ask for the same expression to be parsed, but using the C | |
40 | # language. | |
41 | mi_gdb_test "-data-evaluate-expression --language c \"sizeof (void*)\"" \ | |
42 | "\\^done,value=\"$decimal\"" \ | |
43 | "sizeof expression using C language" | |
44 | ||
45 | # Double-check that the current language has not changed. | |
46 | mi_gdb_test "show lang ada" \ | |
47 | ".*The current source language is \\\\\"ada\\\\\".*" \ | |
48 | "set lang ada" | |
49 | ||
50 | # Test what happens when specifying an invalid language name... | |
51 | mi_gdb_test "-data-evaluate-expression --language invlang \"sizeof (void*)\"" \ | |
52 | "\\^error,msg=\"Invalid --language argument: invlang\"" \ | |
53 | "data-evaluate-expression with invalid language name" | |
54 | ||
55 | # Make sure that "--language auto" is also rejected. | |
56 | mi_gdb_test "-data-evaluate-expression --language auto \"sizeof (void*)\"" \ | |
57 | "\\^error,msg=\"Invalid --language argument: auto\"" \ | |
58 | "data-evaluate-expression with language auto" | |
59 | ||
60 | # Make sure that "--language local" is also rejected. | |
61 | mi_gdb_test "-data-evaluate-expression --language local \"sizeof (void*)\"" \ | |
62 | "\\^error,msg=\"Invalid --language argument: local\"" \ | |
63 | "data-evaluate-expression with language local" | |
64 | ||
65 | # Make sure that "--language unknown" is also rejected. | |
66 | mi_gdb_test "-data-evaluate-expression --language unknown \"sizeof (void*)\"" \ | |
67 | "\\^error,msg=\"Invalid --language argument: unknown\"" \ | |
68 | "data-evaluate-expression with language unknown" |