Commit | Line | Data |
---|---|---|
88b9d363 | 1 | # Copyright 2021-2022 Free Software Foundation, Inc. |
29b161c9 TT |
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 | if {![dwarf2_support]} { | |
23 | return 0 | |
24 | } | |
25 | ||
26 | standard_testfile main.c .S | |
27 | ||
28 | # Make some DWARF for the test. | |
29 | set asm_file [standard_output_file $srcfile2] | |
30 | Dwarf::assemble $asm_file { | |
31 | upvar cu_lang cu_lang | |
32 | ||
33 | declare_labels char_label | |
34 | ||
35 | # Creating a CU with 4-byte addresses lets this test link on | |
36 | # both 32- and 64-bit machines. | |
37 | cu { addr_size 4 } { | |
38 | compile_unit { | |
39 | {name file1.txt} | |
40 | {language @DW_LANG_Rust} | |
41 | } { | |
42 | char_label: DW_TAG_base_type { | |
43 | {DW_AT_byte_size 4 DW_FORM_sdata} | |
44 | {DW_AT_encoding @DW_ATE_UTF} | |
45 | {DW_AT_name char} | |
46 | } | |
47 | ||
48 | DW_TAG_variable { | |
49 | {name cvalue} | |
50 | {type :$char_label} | |
51 | {const_value 97 DW_FORM_udata} | |
52 | } | |
53 | } | |
54 | } | |
55 | } | |
56 | ||
57 | if {[prepare_for_testing "failed to prepare" ${testfile} \ | |
58 | [list $srcfile $asm_file] debug]} { | |
59 | return -1 | |
60 | } | |
61 | ||
62 | if {![runto main]} { | |
63 | return -1 | |
64 | } | |
65 | ||
66 | gdb_test "set language rust" \ | |
67 | "Warning: the current language does not match this frame." | |
68 | # Get the values into history so we can use it from Rust. | |
69 | gdb_test "print cvalue" "\\\$1 = 97 'a'" |