Add translations for various sub-directories
[binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / utf-rust.exp
blob61ae427250cdcf7e6c16f03618fadf94b2960069
1 # Copyright 2021-2024 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 # Test DW_ATE_UTF for Rust.
18 load_lib dwarf.exp
20 # This test can only be run on targets which support DWARF-2 and use
21 # gas.
22 require dwarf2_support
24 standard_testfile main.c .S
26 # Make some DWARF for the test.
27 set asm_file [standard_output_file $srcfile2]
28 Dwarf::assemble $asm_file {
29     upvar cu_lang cu_lang
31     declare_labels char_label
33     # Creating a CU with 4-byte addresses lets this test link on
34     # both 32- and 64-bit machines.
35     cu { addr_size 4 } {
36         compile_unit {
37             {name file1.txt}
38             {language @DW_LANG_Rust}
39         } {
40             char_label: DW_TAG_base_type {
41                 {DW_AT_byte_size 4 DW_FORM_sdata}
42                 {DW_AT_encoding @DW_ATE_UTF}
43                 {DW_AT_name char}
44             }
46             DW_TAG_variable {
47                 {name cvalue}
48                 {type :$char_label}
49                 {const_value 97 DW_FORM_udata}
50             }
51         }
52     }
55 if {[prepare_for_testing "failed to prepare" ${testfile} \
56          [list $srcfile $asm_file] debug]} {
57     return -1
60 if {![runto main]} {
61     return -1
64 gdb_test "set language rust" \
65     "Warning: the current language does not match this frame."
66 # Get the values into history so we can use it from Rust.
67 gdb_test "print cvalue" "\\\$1 = 97 'a'"