blob: c7c4d02a5ca03082530f93602984eade373b5c23 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# Copyright 2022-2024 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
load_lib gdb-python.exp
require allow_python_tests
gdb_exit
gdb_start
# Each test data has 4 parts:
# 1. The string used in 'show XXX-charset' command,
# 2. The string expected in the output of the command used in #1,
# 3. The string used is gdb.XXXX_charset() python function call,
# 4. A string that is a regexp appended to the result of #1, used to
# match the output of #3
foreach test_data { {host host host ""} \
{target target target ""} \
{target-wide "target wide" \
"target_wide" "(LE|BE)?"} } {
with_test_prefix "charset=[lindex $test_data 0]" {
set charset "unknown"
gdb_test_multiple "show [lindex $test_data 0]-charset" "" {
-re "The [lindex $test_data 1] character set is \"auto; currently (\[^\"\]*)\".*$gdb_prompt $" {
set charset $expect_out(1,string)
pass $gdb_test_name
}
-re "The [lindex $test_data 1] character set is \"(\[^\"\]*)\".*$gdb_prompt $" {
set charset $expect_out(1,string)
pass $gdb_test_name
}
}
set charset "${charset}[lindex $test_data 3]"
gdb_test "python print(gdb.[lindex $test_data 2]_charset())" \
"${charset}"
}
}
|