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 // ignore-android: FIXME(#10381)
13 // min-lldb-version: 310
17 // === GDB TESTS ===================================================================================
21 // gdb-command:print s
22 // gdb-check:$1 = {a = 1, b = 2.5}
23 // gdb-command:continue
25 // gdb-command:print x
26 // gdb-check:$2 = {a = 3, b = 4.5}
27 // gdb-command:print y
29 // gdb-command:print z
31 // gdb-command:continue
33 // gdb-command:print a
34 // gdb-check:$5 = {7, 8, 9.5, 10.5}
35 // gdb-command:continue
37 // gdb-command:print a
38 // gdb-check:$6 = {11.5, 12.5, 13, 14}
39 // gdb-command:continue
41 // gdb-command:print x
42 // gdb-check:$7 = {{RUST$ENUM$DISR = Case1, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = Case1, 0, 2088533116, 2088533116}}
43 // gdb-command:continue
46 // === LLDB TESTS ==================================================================================
50 // lldb-command:print s
51 // lldb-check:[...]$0 = Struct { a: 1, b: 2.5 }
52 // lldb-command:continue
54 // lldb-command:print x
55 // lldb-check:[...]$1 = Struct { a: 3, b: 4.5 }
56 // lldb-command:print y
57 // lldb-check:[...]$2 = 5
58 // lldb-command:print z
59 // lldb-check:[...]$3 = 6.5
60 // lldb-command:continue
62 // lldb-command:print a
63 // lldb-check:[...]$4 = (7, 8, 9.5, 10.5)
64 // lldb-command:continue
66 // lldb-command:print a
67 // lldb-check:[...]$5 = Newtype(11.5, 12.5, 13, 14)
68 // lldb-command:continue
70 // lldb-command:print x
71 // lldb-check:[...]$6 = Case1 { x: 0, y: 8970181431921507452 }
72 // lldb-command:continue
90 fn fun_fun(StructStruct { a: x, b: Struct { a: y, b: z } }: StructStruct) {
94 fn tup(a: (int, uint, f64, f64)) {
98 struct Newtype(f64, f64, int, uint);
100 fn new_type(a: Newtype) {
104 // The first element is to ensure proper alignment, irrespective of the machines word size. Since
105 // the size of the discriminant value is machine dependent, this has be taken into account when
106 // datatype layout should be predictable as in this case.
108 Case1 { x: i64, y: i64 },
109 Case2 (i64, i32, i32),
112 fn by_val_enum(x: Enum) {
117 fun(Struct { a: 1, b: 2.5 });
118 fun_fun(StructStruct { a: Struct { a: 3, b: 4.5 }, b: Struct { a: 5, b: 6.5 } });
119 tup((7, 8, 9.5, 10.5));
120 new_type(Newtype(11.5, 12.5, 13, 14));
122 // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
123 // 0b01111100011111000111110001111100 = 2088533116
124 // 0b0111110001111100 = 31868
126 by_val_enum(Enum::Case1 { x: 0, y: 8970181431921507452 });