blob: 97609ef5d9341e249869301215f3cea39613c32c [file] [log] [blame]
Michael Woerister55a8bd52014-04-24 09:35:481// compile-flags:-g
Tom Tromeyfb204cb2018-10-12 13:34:142
3// Some versions of the non-rust-enabled LLDB print the wrong generic
4// parameter type names in this test.
5// rust-lldb
Michael Woeristerc7f45a92014-07-09 12:46:096
7// === GDB TESTS ===================================================================================
8
Michael Woerister55a8bd52014-04-24 09:35:489// gdb-command:run
10
11// STACK BY REF
Michael Woerister55a8bd52014-04-24 09:35:4812// gdb-command:print *self
Tim Neumann9253e122016-10-25 21:32:0413// gdbg-check:$1 = {x = {__0 = 8888, __1 = -8888}}
14// gdbr-check:$1 = generic_method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)}
Michael Woerister55a8bd52014-04-24 09:35:4815// gdb-command:print arg1
16// gdb-check:$2 = -1
Michael Woeristerc7f45a92014-07-09 12:46:0917// gdb-command:print arg2
18// gdb-check:$3 = 2
Michael Woerister55a8bd52014-04-24 09:35:4819// gdb-command:continue
20
21// STACK BY VAL
Michael Woerister55a8bd52014-04-24 09:35:4822// gdb-command:print self
Tim Neumann9253e122016-10-25 21:32:0423// gdbg-check:$4 = {x = {__0 = 8888, __1 = -8888}}
24// gdbr-check:$4 = generic_method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)}
Michael Woerister55a8bd52014-04-24 09:35:4825// gdb-command:print arg1
26// gdb-check:$5 = -3
27// gdb-command:print arg2
28// gdb-check:$6 = -4
29// gdb-command:continue
30
31// OWNED BY REF
Michael Woerister55a8bd52014-04-24 09:35:4832// gdb-command:print *self
Tim Neumann9253e122016-10-25 21:32:0433// gdbg-check:$7 = {x = 1234.5}
34// gdbr-check:$7 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5}
Michael Woerister55a8bd52014-04-24 09:35:4835// gdb-command:print arg1
36// gdb-check:$8 = -5
37// gdb-command:print arg2
38// gdb-check:$9 = -6
39// gdb-command:continue
40
41// OWNED BY VAL
Michael Woerister55a8bd52014-04-24 09:35:4842// gdb-command:print self
Tim Neumann9253e122016-10-25 21:32:0443// gdbg-check:$10 = {x = 1234.5}
44// gdbr-check:$10 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5}
Michael Woerister55a8bd52014-04-24 09:35:4845// gdb-command:print arg1
46// gdb-check:$11 = -7
47// gdb-command:print arg2
48// gdb-check:$12 = -8
49// gdb-command:continue
50
51// OWNED MOVED
Michael Woerister55a8bd52014-04-24 09:35:4852// gdb-command:print *self
Tim Neumann9253e122016-10-25 21:32:0453// gdbg-check:$13 = {x = 1234.5}
54// gdbr-check:$13 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5}
Michael Woerister55a8bd52014-04-24 09:35:4855// gdb-command:print arg1
56// gdb-check:$14 = -9
57// gdb-command:print arg2
58// gdb-check:$15 = -10.5
59// gdb-command:continue
60
Michael Woeristerc7f45a92014-07-09 12:46:0961
62// === LLDB TESTS ==================================================================================
63
64// lldb-command:run
65
66// STACK BY REF
67// lldb-command:print *self
ortem47c26e62019-05-14 12:50:5868// lldbg-check:[...]$0 = { x = { 0 = 8888, 1 = -8888 } }
69// lldbr-check:(generic_method_on_generic_struct::Struct<(u32, i32)>) *self = { x = { 0 = 8888 1 = -8888 } }
Michael Woeristerc7f45a92014-07-09 12:46:0970// lldb-command:print arg1
Tom Tromeyac33b2e2018-10-02 16:13:3071// lldbg-check:[...]$1 = -1
72// lldbr-check:(isize) arg1 = -1
Michael Woeristerc7f45a92014-07-09 12:46:0973// lldb-command:print arg2
Tom Tromeyac33b2e2018-10-02 16:13:3074// lldbg-check:[...]$2 = 2
75// lldbr-check:(u16) arg2 = 2
Michael Woeristerc7f45a92014-07-09 12:46:0976// lldb-command:continue
77
78// STACK BY VAL
79// lldb-command:print self
ortem47c26e62019-05-14 12:50:5880// lldbg-check:[...]$3 = { x = { 0 = 8888, 1 = -8888 } }
81// lldbr-check:(generic_method_on_generic_struct::Struct<(u32, i32)>) self = { x = { 0 = 8888, 1 = -8888 } }
Michael Woeristerc7f45a92014-07-09 12:46:0982// lldb-command:print arg1
Tom Tromeyac33b2e2018-10-02 16:13:3083// lldbg-check:[...]$4 = -3
84// lldbr-check:(isize) arg1 = -3
Michael Woeristerc7f45a92014-07-09 12:46:0985// lldb-command:print arg2
Tom Tromeyac33b2e2018-10-02 16:13:3086// lldbg-check:[...]$5 = -4
87// lldbr-check:(i16) arg2 = -4
Michael Woeristerc7f45a92014-07-09 12:46:0988// lldb-command:continue
89
90// OWNED BY REF
91// lldb-command:print *self
ortem47c26e62019-05-14 12:50:5892// lldbg-check:[...]$6 = { x = 1234.5 }
93// lldbr-check:(generic_method_on_generic_struct::Struct<f64>) *self = { x = 1234.5 }
Michael Woeristerc7f45a92014-07-09 12:46:0994// lldb-command:print arg1
Tom Tromeyac33b2e2018-10-02 16:13:3095// lldbg-check:[...]$7 = -5
96// lldbr-check:(isize) arg1 = -5
Michael Woeristerc7f45a92014-07-09 12:46:0997// lldb-command:print arg2
Tom Tromeyac33b2e2018-10-02 16:13:3098// lldbg-check:[...]$8 = -6
99// lldbr-check:(i32) arg2 = -6
Michael Woeristerc7f45a92014-07-09 12:46:09100// lldb-command:continue
101
102// OWNED BY VAL
103// lldb-command:print self
ortem47c26e62019-05-14 12:50:58104// lldbg-check:[...]$9 = { x = 1234.5 }
105// lldbr-check:(generic_method_on_generic_struct::Struct<f64>) self = { x = 1234.5 }
Michael Woeristerc7f45a92014-07-09 12:46:09106// lldb-command:print arg1
Tom Tromeyac33b2e2018-10-02 16:13:30107// lldbg-check:[...]$10 = -7
108// lldbr-check:(isize) arg1 = -7
Michael Woeristerc7f45a92014-07-09 12:46:09109// lldb-command:print arg2
Tom Tromeyac33b2e2018-10-02 16:13:30110// lldbg-check:[...]$11 = -8
111// lldbr-check:(i64) arg2 = -8
Michael Woeristerc7f45a92014-07-09 12:46:09112// lldb-command:continue
113
114// OWNED MOVED
115// lldb-command:print *self
ortem47c26e62019-05-14 12:50:58116// lldbg-check:[...]$12 = { x = 1234.5 }
117// lldbr-check:(generic_method_on_generic_struct::Struct<f64>) *self = { x = 1234.5 }
Michael Woeristerc7f45a92014-07-09 12:46:09118// lldb-command:print arg1
Tom Tromeyac33b2e2018-10-02 16:13:30119// lldbg-check:[...]$13 = -9
120// lldbr-check:(isize) arg1 = -9
Michael Woeristerc7f45a92014-07-09 12:46:09121// lldb-command:print arg2
Tom Tromeyac33b2e2018-10-02 16:13:30122// lldbg-check:[...]$14 = -10.5
123// lldbr-check:(f32) arg2 = -10.5
Michael Woeristerc7f45a92014-07-09 12:46:09124// lldb-command:continue
125
Andrew Paseltiner6fa0ff22015-09-19 20:33:47126#![feature(omit_gdb_pretty_printer_section)]
Michael Woerister91a0e182014-12-03 22:48:18127#![omit_gdb_pretty_printer_section]
Michael Woeristerc7f45a92014-07-09 12:46:09128
Niko Matsakis890ed5c2015-03-30 13:38:27129#[derive(Copy, Clone)]
Michael Woerister55a8bd52014-04-24 09:35:48130struct Struct<T> {
131 x: T
132}
133
134impl<T1> Struct<T1> {
135
Alex Crichton43bfaa42015-03-26 00:06:52136 fn self_by_ref<T2>(&self, arg1: isize, arg2: T2) -> isize {
Michael Woeristerc7f45a92014-07-09 12:46:09137 zzz(); // #break
Michael Woerister55a8bd52014-04-24 09:35:48138 arg1
139 }
140
Alex Crichton43bfaa42015-03-26 00:06:52141 fn self_by_val<T2>(self, arg1: isize, arg2: T2) -> isize {
Michael Woeristerc7f45a92014-07-09 12:46:09142 zzz(); // #break
Michael Woerister55a8bd52014-04-24 09:35:48143 arg1
144 }
145
Alex Crichton43bfaa42015-03-26 00:06:52146 fn self_owned<T2>(self: Box<Struct<T1>>, arg1: isize, arg2: T2) -> isize {
Michael Woeristerc7f45a92014-07-09 12:46:09147 zzz(); // #break
Michael Woerister55a8bd52014-04-24 09:35:48148 arg1
149 }
150}
151
152fn main() {
153 let stack = Struct { x: (8888_u32, -8888_i32) };
Michael Woeristerc7f45a92014-07-09 12:46:09154 let _ = stack.self_by_ref(-1, 2_u16);
Michael Woerister55a8bd52014-04-24 09:35:48155 let _ = stack.self_by_val(-3, -4_i16);
156
est3165500212021-08-25 00:39:40157 let owned: Box<_> = Box::new(Struct { x: 1234.5f64 });
Michael Woerister55a8bd52014-04-24 09:35:48158 let _ = owned.self_by_ref(-5, -6_i32);
159 let _ = owned.self_by_val(-7, -8_i64);
160 let _ = owned.self_owned(-9, -10.5_f32);
161}
162
163fn zzz() {()}