]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.dwarf2/utf-rust.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / utf-rust.exp
1 # Copyright 2021-2024 Free Software Foundation, Inc.
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 # Test DW_ATE_UTF for Rust.
17
18 load_lib dwarf.exp
19
20 # This test can only be run on targets which support DWARF-2 and use
21 # gas.
22 require dwarf2_support
23
24 standard_testfile main.c .S
25
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
30
31 declare_labels char_label
32
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 }
45
46 DW_TAG_variable {
47 {name cvalue}
48 {type :$char_label}
49 {const_value 97 DW_FORM_udata}
50 }
51 }
52 }
53 }
54
55 if {[prepare_for_testing "failed to prepare" ${testfile} \
56 [list $srcfile $asm_file] debug]} {
57 return -1
58 }
59
60 if {![runto main]} {
61 return -1
62 }
63
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'"