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