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
13 // ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
17 // === GDB TESTS ===================================================================================
22 // gdb-command:print *self
23 // gdbg-check:$1 = {{RUST$ENUM$DISR = Variant2, [...]}, {RUST$ENUM$DISR = Variant2, __0 = 117901063}}
24 // gdbr-check:$1 = method_on_enum::Enum::Variant2(117901063)
25 // gdb-command:print arg1
27 // gdb-command:print arg2
29 // gdb-command:continue
32 // gdb-command:print self
33 // gdbg-check:$4 = {{RUST$ENUM$DISR = Variant2, [...]}, {RUST$ENUM$DISR = Variant2, __0 = 117901063}}
34 // gdbr-check:$4 = method_on_enum::Enum::Variant2(117901063)
35 // gdb-command:print arg1
37 // gdb-command:print arg2
39 // gdb-command:continue
42 // gdb-command:print *self
43 // gdbg-check:$7 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}}
44 // gdbr-check:$7 = method_on_enum::Enum::Variant1{x: 1799, y: 1799}
45 // gdb-command:print arg1
47 // gdb-command:print arg2
49 // gdb-command:continue
52 // gdb-command:print self
53 // gdbg-check:$10 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}}
54 // gdbr-check:$10 = method_on_enum::Enum::Variant1{x: 1799, y: 1799}
55 // gdb-command:print arg1
57 // gdb-command:print arg2
59 // gdb-command:continue
62 // gdb-command:print *self
63 // gdbg-check:$13 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}}
64 // gdbr-check:$13 = method_on_enum::Enum::Variant1{x: 1799, y: 1799}
65 // gdb-command:print arg1
67 // gdb-command:print arg2
68 // gdb-check:$15 = -10
69 // gdb-command:continue
72 // === LLDB TESTS ==================================================================================
77 // lldb-command:print *self
78 // lldb-check:[...]$0 = Variant2(117901063)
79 // lldb-command:print arg1
80 // lldb-check:[...]$1 = -1
81 // lldb-command:print arg2
82 // lldb-check:[...]$2 = -2
83 // lldb-command:continue
86 // lldb-command:print self
87 // lldb-check:[...]$3 = Variant2(117901063)
88 // lldb-command:print arg1
89 // lldb-check:[...]$4 = -3
90 // lldb-command:print arg2
91 // lldb-check:[...]$5 = -4
92 // lldb-command:continue
95 // lldb-command:print *self
96 // lldb-check:[...]$6 = Variant1 { x: 1799, y: 1799 }
97 // lldb-command:print arg1
98 // lldb-check:[...]$7 = -5
99 // lldb-command:print arg2
100 // lldb-check:[...]$8 = -6
101 // lldb-command:continue
104 // lldb-command:print self
105 // lldb-check:[...]$9 = Variant1 { x: 1799, y: 1799 }
106 // lldb-command:print arg1
107 // lldb-check:[...]$10 = -7
108 // lldb-command:print arg2
109 // lldb-check:[...]$11 = -8
110 // lldb-command:continue
113 // lldb-command:print *self
114 // lldb-check:[...]$12 = Variant1 { x: 1799, y: 1799 }
115 // lldb-command:print arg1
116 // lldb-check:[...]$13 = -9
117 // lldb-command:print arg2
118 // lldb-check:[...]$14 = -10
119 // lldb-command:continue
121 #![feature(box_syntax)]
122 #![feature(omit_gdb_pretty_printer_section)]
123 #![omit_gdb_pretty_printer_section]
125 #[derive(Copy, Clone)]
127 Variant1 { x: u16, y: u16 },
133 fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
138 fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
143 fn self_owned(self: Box<Enum>, arg1: isize, arg2: isize) -> isize {
150 let stack = Enum::Variant2(117901063);
151 let _ = stack.self_by_ref(-1, -2);
152 let _ = stack.self_by_val(-3, -4);
154 let owned: Box<_> = box Enum::Variant1{ x: 1799, y: 1799 };
155 let _ = owned.self_by_ref(-5, -6);
156 let _ = owned.self_by_val(-7, -8);
157 let _ = owned.self_owned(-9, -10);