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 ===================================================================================
21 // gdb-command:print *self
22 // gdbg-check:$1 = {{RUST$ENUM$DISR = Variant2, [...]}, {RUST$ENUM$DISR = Variant2, __0 = 117901063}}
23 // gdbr-check:$1 = method_on_enum::Enum::Variant2(117901063)
24 // gdb-command:print arg1
26 // gdb-command:print arg2
28 // gdb-command:continue
31 // gdb-command:print self
32 // gdbg-check:$4 = {{RUST$ENUM$DISR = Variant2, [...]}, {RUST$ENUM$DISR = Variant2, __0 = 117901063}}
33 // gdbr-check:$4 = method_on_enum::Enum::Variant2(117901063)
34 // gdb-command:print arg1
36 // gdb-command:print arg2
38 // gdb-command:continue
41 // gdb-command:print *self
42 // gdbg-check:$7 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}}
43 // gdbr-check:$7 = method_on_enum::Enum::Variant1{x: 1799, y: 1799}
44 // gdb-command:print arg1
46 // gdb-command:print arg2
48 // gdb-command:continue
51 // gdb-command:print self
52 // gdbg-check:$10 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}}
53 // gdbr-check:$10 = method_on_enum::Enum::Variant1{x: 1799, y: 1799}
54 // gdb-command:print arg1
56 // gdb-command:print arg2
58 // gdb-command:continue
61 // gdb-command:print *self
62 // gdbg-check:$13 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}}
63 // gdbr-check:$13 = method_on_enum::Enum::Variant1{x: 1799, y: 1799}
64 // gdb-command:print arg1
66 // gdb-command:print arg2
67 // gdb-check:$15 = -10
68 // gdb-command:continue
71 // === LLDB TESTS ==================================================================================
76 // lldb-command:print *self
77 // lldb-check:[...]$0 = Variant2(117901063)
78 // lldb-command:print arg1
79 // lldb-check:[...]$1 = -1
80 // lldb-command:print arg2
81 // lldb-check:[...]$2 = -2
82 // lldb-command:continue
85 // lldb-command:print self
86 // lldb-check:[...]$3 = Variant2(117901063)
87 // lldb-command:print arg1
88 // lldb-check:[...]$4 = -3
89 // lldb-command:print arg2
90 // lldb-check:[...]$5 = -4
91 // lldb-command:continue
94 // lldb-command:print *self
95 // lldb-check:[...]$6 = Variant1 { x: 1799, y: 1799 }
96 // lldb-command:print arg1
97 // lldb-check:[...]$7 = -5
98 // lldb-command:print arg2
99 // lldb-check:[...]$8 = -6
100 // lldb-command:continue
103 // lldb-command:print self
104 // lldb-check:[...]$9 = Variant1 { x: 1799, y: 1799 }
105 // lldb-command:print arg1
106 // lldb-check:[...]$10 = -7
107 // lldb-command:print arg2
108 // lldb-check:[...]$11 = -8
109 // lldb-command:continue
112 // lldb-command:print *self
113 // lldb-check:[...]$12 = Variant1 { x: 1799, y: 1799 }
114 // lldb-command:print arg1
115 // lldb-check:[...]$13 = -9
116 // lldb-command:print arg2
117 // lldb-check:[...]$14 = -10
118 // lldb-command:continue
120 #![feature(box_syntax)]
121 #![feature(omit_gdb_pretty_printer_section)]
122 #![omit_gdb_pretty_printer_section]
124 #[derive(Copy, Clone)]
126 Variant1 { x: u16, y: u16 }
,
132 fn self_by_ref(&self, arg1
: isize, arg2
: isize) -> isize {
137 fn self_by_val(self, arg1
: isize, arg2
: isize) -> isize {
142 fn self_owned(self: Box
<Enum
>, arg1
: isize, arg2
: isize) -> isize {
149 let stack
= Enum
::Variant2(117901063);
150 let _
= stack
.self_by_ref(-1, -2);
151 let _
= stack
.self_by_val(-3, -4);
153 let owned
: Box
<_
> = box Enum
::Variant1{ x: 1799, y: 1799 }
;
154 let _
= owned
.self_by_ref(-5, -6);
155 let _
= owned
.self_by_val(-7, -8);
156 let _
= owned
.self_owned(-9, -10);