]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // min-lldb-version: 310 |
2 | ||
3 | // compile-flags:-g | |
4 | ||
5 | // === GDB TESTS =================================================================================== | |
6 | ||
7 | // gdb-command:run | |
8 | ||
9 | // STACK BY REF | |
10 | // gdb-command:print *self | |
c30ab7b3 SL |
11 | // gdbg-check:$1 = {x = 100} |
12 | // gdbr-check:$1 = method_on_struct::Struct {x: 100} | |
1a4d82fc JJ |
13 | // gdb-command:print arg1 |
14 | // gdb-check:$2 = -1 | |
15 | // gdb-command:print arg2 | |
16 | // gdb-check:$3 = -2 | |
17 | // gdb-command:continue | |
18 | ||
19 | // STACK BY VAL | |
20 | // gdb-command:print self | |
c30ab7b3 SL |
21 | // gdbg-check:$4 = {x = 100} |
22 | // gdbr-check:$4 = method_on_struct::Struct {x: 100} | |
1a4d82fc JJ |
23 | // gdb-command:print arg1 |
24 | // gdb-check:$5 = -3 | |
25 | // gdb-command:print arg2 | |
26 | // gdb-check:$6 = -4 | |
27 | // gdb-command:continue | |
28 | ||
29 | // OWNED BY REF | |
30 | // gdb-command:print *self | |
c30ab7b3 SL |
31 | // gdbg-check:$7 = {x = 200} |
32 | // gdbr-check:$7 = method_on_struct::Struct {x: 200} | |
1a4d82fc JJ |
33 | // gdb-command:print arg1 |
34 | // gdb-check:$8 = -5 | |
35 | // gdb-command:print arg2 | |
36 | // gdb-check:$9 = -6 | |
37 | // gdb-command:continue | |
38 | ||
39 | // OWNED BY VAL | |
40 | // gdb-command:print self | |
c30ab7b3 SL |
41 | // gdbg-check:$10 = {x = 200} |
42 | // gdbr-check:$10 = method_on_struct::Struct {x: 200} | |
1a4d82fc JJ |
43 | // gdb-command:print arg1 |
44 | // gdb-check:$11 = -7 | |
45 | // gdb-command:print arg2 | |
46 | // gdb-check:$12 = -8 | |
47 | // gdb-command:continue | |
48 | ||
49 | // OWNED MOVED | |
50 | // gdb-command:print *self | |
c30ab7b3 SL |
51 | // gdbg-check:$13 = {x = 200} |
52 | // gdbr-check:$13 = method_on_struct::Struct {x: 200} | |
1a4d82fc JJ |
53 | // gdb-command:print arg1 |
54 | // gdb-check:$14 = -9 | |
55 | // gdb-command:print arg2 | |
56 | // gdb-check:$15 = -10 | |
57 | // gdb-command:continue | |
58 | ||
59 | ||
60 | // === LLDB TESTS ================================================================================== | |
61 | ||
62 | // lldb-command:run | |
63 | ||
64 | // STACK BY REF | |
65 | // lldb-command:print *self | |
f035d41b | 66 | // lldbg-check:[...]$0 = { x = 100 } |
0bf4aa26 | 67 | // lldbr-check:(method_on_struct::Struct) *self = Struct { x: 100 } |
1a4d82fc | 68 | // lldb-command:print arg1 |
0bf4aa26 XL |
69 | // lldbg-check:[...]$1 = -1 |
70 | // lldbr-check:(isize) arg1 = -1 | |
1a4d82fc | 71 | // lldb-command:print arg2 |
0bf4aa26 XL |
72 | // lldbg-check:[...]$2 = -2 |
73 | // lldbr-check:(isize) arg2 = -2 | |
1a4d82fc JJ |
74 | // lldb-command:continue |
75 | ||
76 | // STACK BY VAL | |
77 | // lldb-command:print self | |
f035d41b | 78 | // lldbg-check:[...]$3 = { x = 100 } |
0bf4aa26 | 79 | // lldbr-check:(method_on_struct::Struct) self = Struct { x: 100 } |
1a4d82fc | 80 | // lldb-command:print arg1 |
0bf4aa26 XL |
81 | // lldbg-check:[...]$4 = -3 |
82 | // lldbr-check:(isize) arg1 = -3 | |
1a4d82fc | 83 | // lldb-command:print arg2 |
0bf4aa26 XL |
84 | // lldbg-check:[...]$5 = -4 |
85 | // lldbr-check:(isize) arg2 = -4 | |
1a4d82fc JJ |
86 | // lldb-command:continue |
87 | ||
88 | // OWNED BY REF | |
89 | // lldb-command:print *self | |
f035d41b | 90 | // lldbg-check:[...]$6 = { x = 200 } |
0bf4aa26 | 91 | // lldbr-check:(method_on_struct::Struct) *self = Struct { x: 200 } |
1a4d82fc | 92 | // lldb-command:print arg1 |
0bf4aa26 XL |
93 | // lldbg-check:[...]$7 = -5 |
94 | // lldbr-check:(isize) arg1 = -5 | |
1a4d82fc | 95 | // lldb-command:print arg2 |
0bf4aa26 XL |
96 | // lldbg-check:[...]$8 = -6 |
97 | // lldbr-check:(isize) arg2 = -6 | |
1a4d82fc JJ |
98 | // lldb-command:continue |
99 | ||
100 | // OWNED BY VAL | |
101 | // lldb-command:print self | |
f035d41b | 102 | // lldbg-check:[...]$9 = { x = 200 } |
0bf4aa26 | 103 | // lldbr-check:(method_on_struct::Struct) self = Struct { x: 200 } |
1a4d82fc | 104 | // lldb-command:print arg1 |
0bf4aa26 XL |
105 | // lldbg-check:[...]$10 = -7 |
106 | // lldbr-check:(isize) arg1 = -7 | |
1a4d82fc | 107 | // lldb-command:print arg2 |
0bf4aa26 XL |
108 | // lldbg-check:[...]$11 = -8 |
109 | // lldbr-check:(isize) arg2 = -8 | |
1a4d82fc JJ |
110 | // lldb-command:continue |
111 | ||
112 | // OWNED MOVED | |
113 | // lldb-command:print *self | |
f035d41b | 114 | // lldbg-check:[...]$12 = { x = 200 } |
0bf4aa26 | 115 | // lldbr-check:(method_on_struct::Struct) *self = Struct { x: 200 } |
1a4d82fc | 116 | // lldb-command:print arg1 |
0bf4aa26 XL |
117 | // lldbg-check:[...]$13 = -9 |
118 | // lldbr-check:(isize) arg1 = -9 | |
1a4d82fc | 119 | // lldb-command:print arg2 |
0bf4aa26 XL |
120 | // lldbg-check:[...]$14 = -10 |
121 | // lldbr-check:(isize) arg2 = -10 | |
1a4d82fc JJ |
122 | // lldb-command:continue |
123 | ||
b039eaaf | 124 | #![feature(omit_gdb_pretty_printer_section)] |
1a4d82fc JJ |
125 | #![omit_gdb_pretty_printer_section] |
126 | ||
c34b1796 | 127 | #[derive(Copy, Clone)] |
1a4d82fc | 128 | struct Struct { |
c34b1796 | 129 | x: isize |
1a4d82fc JJ |
130 | } |
131 | ||
132 | impl Struct { | |
133 | ||
c34b1796 | 134 | fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize { |
1a4d82fc JJ |
135 | zzz(); // #break |
136 | self.x + arg1 + arg2 | |
137 | } | |
138 | ||
c34b1796 | 139 | fn self_by_val(self, arg1: isize, arg2: isize) -> isize { |
1a4d82fc JJ |
140 | zzz(); // #break |
141 | self.x + arg1 + arg2 | |
142 | } | |
143 | ||
c34b1796 | 144 | fn self_owned(self: Box<Struct>, arg1: isize, arg2: isize) -> isize { |
1a4d82fc JJ |
145 | zzz(); // #break |
146 | self.x + arg1 + arg2 | |
147 | } | |
148 | } | |
149 | ||
150 | fn main() { | |
151 | let stack = Struct { x: 100 }; | |
152 | let _ = stack.self_by_ref(-1, -2); | |
153 | let _ = stack.self_by_val(-3, -4); | |
154 | ||
c295e0f8 | 155 | let owned: Box<_> = Box::new(Struct { x: 200 }); |
1a4d82fc JJ |
156 | let _ = owned.self_by_ref(-5, -6); |
157 | let _ = owned.self_by_val(-7, -8); | |
158 | let _ = owned.self_owned(-9, -10); | |
159 | } | |
160 | ||
161 | fn zzz() {()} |