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-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
13 // min-lldb-version: 310
17 // === GDB TESTS ===================================================================================
21 // gdb-command:print s
22 // gdbg-check:$1 = {a = 1, b = 2.5}
23 // gdbr-check:$1 = by_value_non_immediate_argument::Struct {a: 1, b: 2.5}
24 // gdb-command:continue
26 // gdb-command:print x
27 // gdbg-check:$2 = {a = 3, b = 4.5}
28 // gdbr-check:$2 = by_value_non_immediate_argument::Struct {a: 3, b: 4.5}
29 // gdb-command:print y
31 // gdb-command:print z
33 // gdb-command:continue
35 // gdb-command:print a
36 // gdbg-check:$5 = {__0 = 7, __1 = 8, __2 = 9.5, __3 = 10.5}
37 // gdbr-check:$5 = (7, 8, 9.5, 10.5)
38 // gdb-command:continue
40 // gdb-command:print a
41 // gdbg-check:$6 = {__0 = 11.5, __1 = 12.5, __2 = 13, __3 = 14}
42 // gdbr-check:$6 = by_value_non_immediate_argument::Newtype (11.5, 12.5, 13, 14)
43 // gdb-command:continue
45 // gdb-command:print x
46 // gdbg-check:$7 = {{RUST$ENUM$DISR = Case1, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = Case1, [...]}}
47 // gdbr-check:$7 = by_value_non_immediate_argument::Enum::Case1{x: 0, y: 8970181431921507452}
48 // gdb-command:continue
51 // === LLDB TESTS ==================================================================================
55 // lldb-command:print s
56 // lldb-check:[...]$0 = Struct { a: 1, b: 2.5 }
57 // lldb-command:continue
59 // lldb-command:print x
60 // lldb-check:[...]$1 = Struct { a: 3, b: 4.5 }
61 // lldb-command:print y
62 // lldb-check:[...]$2 = 5
63 // lldb-command:print z
64 // lldb-check:[...]$3 = 6.5
65 // lldb-command:continue
67 // lldb-command:print a
68 // lldb-check:[...]$4 = (7, 8, 9.5, 10.5)
69 // lldb-command:continue
71 // lldb-command:print a
72 // lldb-check:[...]$5 = Newtype(11.5, 12.5, 13, 14)
73 // lldb-command:continue
75 // lldb-command:print x
76 // lldb-check:[...]$6 = Case1 { x: 0, y: 8970181431921507452 }
77 // lldb-command:continue
79 #![feature(omit_gdb_pretty_printer_section)]
80 #![omit_gdb_pretty_printer_section]
98 fn fun_fun(StructStruct { a: x, b: Struct { a: y, b: z } }: StructStruct) {
102 fn tup(a: (isize, usize, f64, f64)) {
106 struct Newtype(f64, f64, isize, usize);
108 fn new_type(a: Newtype) {
112 // The first element is to ensure proper alignment, irrespective of the machines word size. Since
113 // the size of the discriminant value is machine dependent, this has be taken into account when
114 // datatype layout should be predictable as in this case.
116 Case1 { x: i64, y: i64 },
117 Case2 (i64, i32, i32),
120 fn by_val_enum(x: Enum) {
125 fun(Struct { a: 1, b: 2.5 });
126 fun_fun(StructStruct { a: Struct { a: 3, b: 4.5 }, b: Struct { a: 5, b: 6.5 } });
127 tup((7, 8, 9.5, 10.5));
128 new_type(Newtype(11.5, 12.5, 13, 14));
130 // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
131 // 0b01111100011111000111110001111100 = 2088533116
132 // 0b0111110001111100 = 31868
134 by_val_enum(Enum::Case1 { x: 0, y: 8970181431921507452 });