2014-10-09 09:31:03 -05:00
|
|
|
// min-lldb-version: 310
|
2013-12-13 17:45:08 -06:00
|
|
|
|
2014-02-06 21:57:09 -06:00
|
|
|
// compile-flags:-g
|
2014-07-09 07:46:09 -05:00
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
|
|
|
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:run
|
|
|
|
|
|
|
|
// gdb-command:print constant
|
|
|
|
// gdb-check:$1 = 1
|
|
|
|
// gdb-command:print a_struct
|
2016-10-25 16:32:04 -05:00
|
|
|
// gdbg-check:$2 = {a = -2, b = 3.5, c = 4}
|
|
|
|
// gdbr-check:$2 = var_captured_in_sendable_closure::Struct {a: -2, b: 3.5, c: 4}
|
2014-04-24 04:35:48 -05:00
|
|
|
// gdb-command:print *owned
|
|
|
|
// gdb-check:$3 = 5
|
2014-11-27 08:52:16 -06:00
|
|
|
// gdb-command:continue
|
2013-08-23 11:45:02 -05:00
|
|
|
|
2014-11-27 08:52:16 -06:00
|
|
|
// gdb-command:print constant2
|
|
|
|
// gdb-check:$4 = 6
|
|
|
|
// gdb-command:continue
|
2014-07-09 07:46:09 -05:00
|
|
|
|
|
|
|
// === LLDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// lldb-command:run
|
|
|
|
|
|
|
|
// lldb-command:print constant
|
2018-10-02 11:13:30 -05:00
|
|
|
// lldbg-check:[...]$0 = 1
|
|
|
|
// lldbr-check:(isize) constant = 1
|
2014-07-09 07:46:09 -05:00
|
|
|
// lldb-command:print a_struct
|
2018-10-02 11:13:30 -05:00
|
|
|
// lldbg-check:[...]$1 = Struct { a: -2, b: 3.5, c: 4 }
|
|
|
|
// lldbr-check:(var_captured_in_sendable_closure::Struct) a_struct = Struct { a: -2, b: 3.5, c: 4 }
|
2014-07-09 07:46:09 -05:00
|
|
|
// lldb-command:print *owned
|
2018-10-02 11:13:30 -05:00
|
|
|
// lldbg-check:[...]$2 = 5
|
|
|
|
// lldbr-check:(isize) *owned = 5
|
2014-07-09 07:46:09 -05:00
|
|
|
|
2014-10-27 17:37:07 -05:00
|
|
|
#![allow(unused_variables)]
|
2016-07-13 09:07:11 -05:00
|
|
|
#![feature(box_syntax)]
|
2015-09-19 15:33:47 -05:00
|
|
|
#![feature(omit_gdb_pretty_printer_section)]
|
2014-12-03 16:48:18 -06:00
|
|
|
#![omit_gdb_pretty_printer_section]
|
2013-08-23 11:45:02 -05:00
|
|
|
|
|
|
|
struct Struct {
|
2015-03-25 19:06:52 -05:00
|
|
|
a: isize,
|
2013-09-26 01:26:09 -05:00
|
|
|
b: f64,
|
2015-03-25 19:06:52 -05:00
|
|
|
c: usize
|
2013-08-23 11:45:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let constant = 1;
|
|
|
|
|
|
|
|
let a_struct = Struct {
|
|
|
|
a: -2,
|
|
|
|
b: 3.5,
|
|
|
|
c: 4
|
|
|
|
};
|
|
|
|
|
2015-02-17 14:41:32 -06:00
|
|
|
let owned: Box<_> = box 5;
|
2013-08-23 11:45:02 -05:00
|
|
|
|
2016-04-16 13:51:26 -05:00
|
|
|
let closure = move || {
|
2014-07-09 07:46:09 -05:00
|
|
|
zzz(); // #break
|
2014-07-07 18:35:15 -05:00
|
|
|
do_something(&constant, &a_struct.a, &*owned);
|
2013-08-23 11:45:02 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
closure();
|
2014-11-27 08:52:16 -06:00
|
|
|
|
2015-02-18 08:05:34 -06:00
|
|
|
let constant2 = 6_usize;
|
2014-11-27 08:52:16 -06:00
|
|
|
|
|
|
|
// The `self` argument of the following closure should be passed by value
|
2018-05-08 08:10:16 -05:00
|
|
|
// to FnOnce::call_once(self, args), which gets codegened a bit differently
|
2014-11-27 08:52:16 -06:00
|
|
|
// than the regular case. Let's make sure this is supported too.
|
2016-04-16 13:51:26 -05:00
|
|
|
let immedate_env = move || {
|
2014-11-27 08:52:16 -06:00
|
|
|
zzz(); // #break
|
|
|
|
return constant2;
|
|
|
|
};
|
|
|
|
|
|
|
|
immedate_env();
|
2013-08-23 11:45:02 -05:00
|
|
|
}
|
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
fn do_something(_: &isize, _:&isize, _:&isize) {
|
2013-08-23 11:45:02 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fn zzz() {()}
|