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 // gdbg-check:$1 = {a = 1, b = 2.5}
22 // gdbr-check:$1 = by_value_non_immediate_argument::Struct {a: 1, b: 2.5}
23 // gdb-command:continue
25 // gdb-command:print x
26 // gdbg-check:$2 = {a = 3, b = 4.5}
27 // gdbr-check:$2 = by_value_non_immediate_argument::Struct {a: 3, b: 4.5}
28 // gdb-command:print y
30 // gdb-command:print z
32 // gdb-command:continue
34 // gdb-command:print a
35 // gdbg-check:$5 = {__0 = 7, __1 = 8, __2 = 9.5, __3 = 10.5}
36 // gdbr-check:$5 = (7, 8, 9.5, 10.5)
37 // gdb-command:continue
39 // gdb-command:print a
40 // gdbg-check:$6 = {__0 = 11.5, __1 = 12.5, __2 = 13, __3 = 14}
41 // gdbr-check:$6 = by_value_non_immediate_argument::Newtype (11.5, 12.5, 13, 14)
42 // gdb-command:continue
44 // gdb-command:print x
45 // gdbg-check:$7 = {{RUST$ENUM$DISR = Case1, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = Case1, [...]}}
46 // gdbr-check:$7 = by_value_non_immediate_argument::Enum::Case1{x: 0, y: 8970181431921507452}
47 // gdb-command:continue
50 // === LLDB TESTS ==================================================================================
54 // lldb-command:print s
55 // lldb-check:[...]$0 = Struct { a: 1, b: 2.5 }
56 // lldb-command:continue
58 // lldb-command:print x
59 // lldb-check:[...]$1 = Struct { a: 3, b: 4.5 }
60 // lldb-command:print y
61 // lldb-check:[...]$2 = 5
62 // lldb-command:print z
63 // lldb-check:[...]$3 = 6.5
64 // lldb-command:continue
66 // lldb-command:print a
67 // lldb-check:[...]$4 = (7, 8, 9.5, 10.5)
68 // lldb-command:continue
70 // lldb-command:print a
71 // lldb-check:[...]$5 = Newtype(11.5, 12.5, 13, 14)
72 // lldb-command:continue
74 // lldb-command:print x
75 // lldb-check:[...]$6 = Case1 { x: 0, y: 8970181431921507452 }
76 // lldb-command:continue
78 #![feature(omit_gdb_pretty_printer_section)]
79 #![omit_gdb_pretty_printer_section]
97 fn fun_fun(StructStruct { a: x, b: Struct { a: y, b: z } }: StructStruct) {
101 fn tup(a: (isize, usize, f64, f64)) {
105 struct Newtype(f64, f64, isize, usize);
107 fn new_type(a: Newtype) {
111 // The first element is to ensure proper alignment, irrespective of the machines word size. Since
112 // the size of the discriminant value is machine dependent, this has be taken into account when
113 // datatype layout should be predictable as in this case.
115 Case1 { x: i64, y: i64 },
116 Case2 (i64, i32, i32),
119 fn by_val_enum(x: Enum) {
124 fun(Struct { a: 1, b: 2.5 });
125 fun_fun(StructStruct { a: Struct { a: 3, b: 4.5 }, b: Struct { a: 5, b: 6.5 } });
126 tup((7, 8, 9.5, 10.5));
127 new_type(Newtype(11.5, 12.5, 13, 14));
129 // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
130 // 0b01111100011111000111110001111100 = 2088533116
131 // 0b0111110001111100 = 31868
133 by_val_enum(Enum::Case1 { x: 0, y: 8970181431921507452 });