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.
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.
11 // ignore-tidy-linelength
12 // min-lldb-version: 310
16 // === GDB TESTS ===================================================================================
20 // gdb-command:print s
21 // gdb-check:$1 = {a = 1, b = 2.5}
22 // gdb-command:continue
24 // gdb-command:print x
25 // gdb-check:$2 = {a = 3, b = 4.5}
26 // gdb-command:print y
28 // gdb-command:print z
30 // gdb-command:continue
32 // gdb-command:print a
33 // gdb-check:$5 = {__0 = 7, __1 = 8, __2 = 9.5, __3 = 10.5}
34 // gdb-command:continue
36 // gdb-command:print a
37 // gdb-check:$6 = {__0 = 11.5, __1 = 12.5, __2 = 13, __3 = 14}
38 // gdb-command:continue
40 // gdb-command:print x
41 // gdb-check:$7 = {{RUST$ENUM$DISR = Case1, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = Case1, __0 = 0, __1 = 2088533116, __2 = 2088533116}}
42 // gdb-command:continue
45 // === LLDB TESTS ==================================================================================
49 // lldb-command:print s
50 // lldb-check:[...]$0 = Struct { a: 1, b: 2.5 }
51 // lldb-command:continue
53 // lldb-command:print x
54 // lldb-check:[...]$1 = Struct { a: 3, b: 4.5 }
55 // lldb-command:print y
56 // lldb-check:[...]$2 = 5
57 // lldb-command:print z
58 // lldb-check:[...]$3 = 6.5
59 // lldb-command:continue
61 // lldb-command:print a
62 // lldb-check:[...]$4 = (7, 8, 9.5, 10.5)
63 // lldb-command:continue
65 // lldb-command:print a
66 // lldb-check:[...]$5 = Newtype(11.5, 12.5, 13, 14)
67 // lldb-command:continue
69 // lldb-command:print x
70 // lldb-check:[...]$6 = Case1 { x: 0, y: 8970181431921507452 }
71 // lldb-command:continue
73 #![feature(omit_gdb_pretty_printer_section)]
74 #![omit_gdb_pretty_printer_section]
92 fn fun_fun(StructStruct { a: x, b: Struct { a: y, b: z } }: StructStruct) {
96 fn tup(a: (isize, usize, f64, f64)) {
100 struct Newtype(f64, f64, isize, usize);
102 fn new_type(a: Newtype) {
106 // The first element is to ensure proper alignment, irrespective of the machines word size. Since
107 // the size of the discriminant value is machine dependent, this has be taken into account when
108 // datatype layout should be predictable as in this case.
110 Case1 { x: i64, y: i64 },
111 Case2 (i64, i32, i32),
114 fn by_val_enum(x: Enum) {
119 fun(Struct { a: 1, b: 2.5 });
120 fun_fun(StructStruct { a: Struct { a: 3, b: 4.5 }, b: Struct { a: 5, b: 6.5 } });
121 tup((7, 8, 9.5, 10.5));
122 new_type(Newtype(11.5, 12.5, 13, 14));
124 // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
125 // 0b01111100011111000111110001111100 = 2088533116
126 // 0b0111110001111100 = 31868
128 by_val_enum(Enum::Case1 { x: 0, y: 8970181431921507452 });