]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
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 | // ignore-tidy-linelength | |
1a4d82fc JJ |
12 | // min-lldb-version: 310 |
13 | ||
14 | // compile-flags:-g | |
15 | ||
16 | // === GDB TESTS =================================================================================== | |
17 | ||
18 | // gdb-command:run | |
19 | ||
20 | // gdb-command:print s | |
c30ab7b3 SL |
21 | // gdbg-check:$1 = {a = 1, b = 2.5} |
22 | // gdbr-check:$1 = by_value_non_immediate_argument::Struct {a: 1, b: 2.5} | |
1a4d82fc JJ |
23 | // gdb-command:continue |
24 | ||
25 | // gdb-command:print x | |
c30ab7b3 SL |
26 | // gdbg-check:$2 = {a = 3, b = 4.5} |
27 | // gdbr-check:$2 = by_value_non_immediate_argument::Struct {a: 3, b: 4.5} | |
1a4d82fc JJ |
28 | // gdb-command:print y |
29 | // gdb-check:$3 = 5 | |
30 | // gdb-command:print z | |
31 | // gdb-check:$4 = 6.5 | |
32 | // gdb-command:continue | |
33 | ||
34 | // gdb-command:print a | |
c30ab7b3 SL |
35 | // gdbg-check:$5 = {__0 = 7, __1 = 8, __2 = 9.5, __3 = 10.5} |
36 | // gdbr-check:$5 = (7, 8, 9.5, 10.5) | |
1a4d82fc JJ |
37 | // gdb-command:continue |
38 | ||
39 | // gdb-command:print a | |
c30ab7b3 SL |
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) | |
1a4d82fc JJ |
42 | // gdb-command:continue |
43 | ||
44 | // gdb-command:print x | |
c30ab7b3 SL |
45 | // gdbg-check:$7 = {{RUST$ENUM$DISR = Case1, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = Case1, __0 = 0, __1 = 2088533116, __2 = 2088533116}} |
46 | // gdbr-check:$7 = by_value_non_immediate_argument::Enum::Case1{x: 0, y: 8970181431921507452} | |
1a4d82fc JJ |
47 | // gdb-command:continue |
48 | ||
49 | ||
50 | // === LLDB TESTS ================================================================================== | |
51 | ||
52 | // lldb-command:run | |
53 | ||
54 | // lldb-command:print s | |
55 | // lldb-check:[...]$0 = Struct { a: 1, b: 2.5 } | |
56 | // lldb-command:continue | |
57 | ||
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 | |
65 | ||
66 | // lldb-command:print a | |
67 | // lldb-check:[...]$4 = (7, 8, 9.5, 10.5) | |
68 | // lldb-command:continue | |
69 | ||
70 | // lldb-command:print a | |
71 | // lldb-check:[...]$5 = Newtype(11.5, 12.5, 13, 14) | |
72 | // lldb-command:continue | |
73 | ||
74 | // lldb-command:print x | |
75 | // lldb-check:[...]$6 = Case1 { x: 0, y: 8970181431921507452 } | |
76 | // lldb-command:continue | |
77 | ||
b039eaaf | 78 | #![feature(omit_gdb_pretty_printer_section)] |
1a4d82fc JJ |
79 | #![omit_gdb_pretty_printer_section] |
80 | ||
81 | #[derive(Clone)] | |
82 | struct Struct { | |
c34b1796 | 83 | a: isize, |
1a4d82fc JJ |
84 | b: f64 |
85 | } | |
86 | ||
87 | #[derive(Clone)] | |
88 | struct StructStruct { | |
89 | a: Struct, | |
90 | b: Struct | |
91 | } | |
92 | ||
93 | fn fun(s: Struct) { | |
94 | zzz(); // #break | |
95 | } | |
96 | ||
97 | fn fun_fun(StructStruct { a: x, b: Struct { a: y, b: z } }: StructStruct) { | |
98 | zzz(); // #break | |
99 | } | |
100 | ||
c34b1796 | 101 | fn tup(a: (isize, usize, f64, f64)) { |
1a4d82fc JJ |
102 | zzz(); // #break |
103 | } | |
104 | ||
c34b1796 | 105 | struct Newtype(f64, f64, isize, usize); |
1a4d82fc JJ |
106 | |
107 | fn new_type(a: Newtype) { | |
108 | zzz(); // #break | |
109 | } | |
110 | ||
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. | |
114 | enum Enum { | |
115 | Case1 { x: i64, y: i64 }, | |
116 | Case2 (i64, i32, i32), | |
117 | } | |
118 | ||
119 | fn by_val_enum(x: Enum) { | |
120 | zzz(); // #break | |
121 | } | |
122 | ||
123 | fn main() { | |
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)); | |
128 | ||
129 | // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452 | |
130 | // 0b01111100011111000111110001111100 = 2088533116 | |
131 | // 0b0111110001111100 = 31868 | |
132 | // 0b01111100 = 124 | |
133 | by_val_enum(Enum::Case1 { x: 0, y: 8970181431921507452 }); | |
134 | } | |
135 | ||
136 | fn zzz() { () } |