]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/basic-types-mut-globals.rs
Auto merge of #47242 - estebank:issue-15980, r=petrochenkov
[rust.git] / src / test / debuginfo / basic-types-mut-globals.rs
1 // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // Caveats - gdb prints any 8-bit value (meaning rust I8 and u8 values)
12 // as its numerical value along with its associated ASCII char, there
13 // doesn't seem to be any way around this. Also, gdb doesn't know
14 // about UTF-32 character encoding and will print a rust char as only
15 // its numerical value.
16
17 // min-lldb-version: 310
18 // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
19
20 // compile-flags:-g
21
22 // gdb-command:run
23
24 // Check initializers
25 // gdbg-command:print 'basic_types_mut_globals::B'
26 // gdbr-command:print B
27 // gdb-check:$1 = false
28 // gdbg-command:print 'basic_types_mut_globals::I'
29 // gdbr-command:print I
30 // gdb-check:$2 = -1
31 // gdbg-command:print/d 'basic_types_mut_globals::C'
32 // gdbr-command:print C
33 // gdbg-check:$3 = 97
34 // gdbr-check:$3 = 97 'a'
35 // gdbg-command:print/d 'basic_types_mut_globals::I8'
36 // gdbr-command:print I8
37 // gdb-check:$4 = 68
38 // gdbg-command:print 'basic_types_mut_globals::I16'
39 // gdbr-command:print I16
40 // gdb-check:$5 = -16
41 // gdbg-command:print 'basic_types_mut_globals::I32'
42 // gdbr-command:print I32
43 // gdb-check:$6 = -32
44 // gdbg-command:print 'basic_types_mut_globals::I64'
45 // gdbr-command:print I64
46 // gdb-check:$7 = -64
47 // gdbg-command:print 'basic_types_mut_globals::U'
48 // gdbr-command:print U
49 // gdb-check:$8 = 1
50 // gdbg-command:print/d 'basic_types_mut_globals::U8'
51 // gdbr-command:print U8
52 // gdb-check:$9 = 100
53 // gdbg-command:print 'basic_types_mut_globals::U16'
54 // gdbr-command:print U16
55 // gdb-check:$10 = 16
56 // gdbg-command:print 'basic_types_mut_globals::U32'
57 // gdbr-command:print U32
58 // gdb-check:$11 = 32
59 // gdbg-command:print 'basic_types_mut_globals::U64'
60 // gdbr-command:print U64
61 // gdb-check:$12 = 64
62 // gdbg-command:print 'basic_types_mut_globals::F32'
63 // gdbr-command:print F32
64 // gdb-check:$13 = 2.5
65 // gdbg-command:print 'basic_types_mut_globals::F64'
66 // gdbr-command:print F64
67 // gdb-check:$14 = 3.5
68 // gdb-command:continue
69
70 // Check new values
71 // gdbg-command:print 'basic_types_mut_globals'::B
72 // gdbr-command:print B
73 // gdb-check:$15 = true
74 // gdbg-command:print 'basic_types_mut_globals'::I
75 // gdbr-command:print I
76 // gdb-check:$16 = 2
77 // gdbg-command:print/d 'basic_types_mut_globals'::C
78 // gdbr-command:print C
79 // gdbg-check:$17 = 102
80 // gdbr-check:$17 = 102 'f'
81 // gdbg-command:print/d 'basic_types_mut_globals'::I8
82 // gdbr-command:print/d I8
83 // gdb-check:$18 = 78
84 // gdbg-command:print 'basic_types_mut_globals'::I16
85 // gdbr-command:print I16
86 // gdb-check:$19 = -26
87 // gdbg-command:print 'basic_types_mut_globals'::I32
88 // gdbr-command:print I32
89 // gdb-check:$20 = -12
90 // gdbg-command:print 'basic_types_mut_globals'::I64
91 // gdbr-command:print I64
92 // gdb-check:$21 = -54
93 // gdbg-command:print 'basic_types_mut_globals'::U
94 // gdbr-command:print U
95 // gdb-check:$22 = 5
96 // gdbg-command:print/d 'basic_types_mut_globals'::U8
97 // gdbr-command:print/d U8
98 // gdb-check:$23 = 20
99 // gdbg-command:print 'basic_types_mut_globals'::U16
100 // gdbr-command:print U16
101 // gdb-check:$24 = 32
102 // gdbg-command:print 'basic_types_mut_globals'::U32
103 // gdbr-command:print U32
104 // gdb-check:$25 = 16
105 // gdbg-command:print 'basic_types_mut_globals'::U64
106 // gdbr-command:print U64
107 // gdb-check:$26 = 128
108 // gdbg-command:print 'basic_types_mut_globals'::F32
109 // gdbr-command:print F32
110 // gdb-check:$27 = 5.75
111 // gdbg-command:print 'basic_types_mut_globals'::F64
112 // gdbr-command:print F64
113 // gdb-check:$28 = 9.25
114
115 #![allow(unused_variables)]
116 #![feature(omit_gdb_pretty_printer_section)]
117 #![omit_gdb_pretty_printer_section]
118
119 static mut B: bool = false;
120 static mut I: isize = -1;
121 static mut C: char = 'a';
122 static mut I8: i8 = 68;
123 static mut I16: i16 = -16;
124 static mut I32: i32 = -32;
125 static mut I64: i64 = -64;
126 static mut U: usize = 1;
127 static mut U8: u8 = 100;
128 static mut U16: u16 = 16;
129 static mut U32: u32 = 32;
130 static mut U64: u64 = 64;
131 static mut F32: f32 = 2.5;
132 static mut F64: f64 = 3.5;
133
134 fn main() {
135     _zzz(); // #break
136
137     unsafe {
138         B = true;
139         I = 2;
140         C = 'f';
141         I8 = 78;
142         I16 = -26;
143         I32 = -12;
144         I64 = -54;
145         U = 5;
146         U8 = 20;
147         U16 = 32;
148         U32 = 16;
149         U64 = 128;
150         F32 = 5.75;
151         F64 = 9.25;
152     }
153
154     _zzz(); // #break
155 }
156
157 fn _zzz() {()}