2014-10-09 14:31:03 +00:00
|
|
|
// min-lldb-version: 310
|
2013-11-04 06:53:01 +00:00
|
|
|
|
2014-02-07 03:57:09 +00:00
|
|
|
// compile-flags:-g
|
2014-07-09 12:46:09 +00:00
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
|
|
|
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:run
|
2013-08-29 09:44:11 +00:00
|
|
|
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print variable
|
|
|
|
// gdb-check:$1 = 1
|
|
|
|
// gdb-command:print constant
|
|
|
|
// gdb-check:$2 = 2
|
|
|
|
// gdb-command:print a_struct
|
2016-10-25 21:32:04 +00:00
|
|
|
// gdbg-check:$3 = {a = -3, b = 4.5, c = 5}
|
|
|
|
// gdbr-check:$3 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5}
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print *struct_ref
|
2016-10-25 21:32:04 +00:00
|
|
|
// gdbg-check:$4 = {a = -3, b = 4.5, c = 5}
|
|
|
|
// gdbr-check:$4 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5}
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print *owned
|
|
|
|
// gdb-check:$5 = 6
|
|
|
|
// gdb-command:print closure_local
|
2014-10-02 22:12:58 +00:00
|
|
|
// gdb-check:$6 = 8
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:continue
|
2013-08-29 09:44:11 +00:00
|
|
|
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print variable
|
2014-10-02 22:12:58 +00:00
|
|
|
// gdb-check:$7 = 1
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print constant
|
2014-10-02 22:12:58 +00:00
|
|
|
// gdb-check:$8 = 2
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print a_struct
|
2016-10-25 21:32:04 +00:00
|
|
|
// gdbg-check:$9 = {a = -3, b = 4.5, c = 5}
|
|
|
|
// gdbr-check:$9 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5}
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print *struct_ref
|
2016-10-25 21:32:04 +00:00
|
|
|
// gdbg-check:$10 = {a = -3, b = 4.5, c = 5}
|
|
|
|
// gdbr-check:$10 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5}
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print *owned
|
2014-10-02 22:12:58 +00:00
|
|
|
// gdb-check:$11 = 6
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:print closure_local
|
2014-10-02 22:12:58 +00:00
|
|
|
// gdb-check:$12 = 8
|
2014-04-24 09:35:48 +00:00
|
|
|
// gdb-command:continue
|
2013-09-03 16:23:59 +00:00
|
|
|
|
2014-07-09 12:46:09 +00:00
|
|
|
|
|
|
|
// === LLDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// lldb-command:run
|
|
|
|
|
|
|
|
// lldb-command:print variable
|
2018-10-02 16:13:30 +00:00
|
|
|
// lldbg-check:[...]$0 = 1
|
|
|
|
// lldbr-check:(isize) variable = 1
|
2014-07-09 12:46:09 +00:00
|
|
|
// lldb-command:print constant
|
2018-10-02 16:13:30 +00:00
|
|
|
// lldbg-check:[...]$1 = 2
|
|
|
|
// lldbr-check:(isize) constant = 2
|
2014-07-09 12:46:09 +00:00
|
|
|
// lldb-command:print a_struct
|
2019-05-14 12:50:58 +00:00
|
|
|
// lldbg-check:[...]$2 = { a = -3 b = 4.5 c = 5 }
|
|
|
|
// lldbr-check:(var_captured_in_nested_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 }
|
2014-07-09 12:46:09 +00:00
|
|
|
// lldb-command:print *struct_ref
|
2019-05-14 12:50:58 +00:00
|
|
|
// lldbg-check:[...]$3 = { a = -3 b = 4.5 c = 5 }
|
|
|
|
// lldbr-check:(var_captured_in_nested_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 }
|
2014-07-09 12:46:09 +00:00
|
|
|
// lldb-command:print *owned
|
2018-10-02 16:13:30 +00:00
|
|
|
// lldbg-check:[...]$4 = 6
|
|
|
|
// lldbr-check:(isize) *owned = 6
|
2014-07-09 12:46:09 +00:00
|
|
|
// lldb-command:print closure_local
|
2018-10-02 16:13:30 +00:00
|
|
|
// lldbg-check:[...]$5 = 8
|
|
|
|
// lldbr-check:(isize) closure_local = 8
|
2014-07-09 12:46:09 +00:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// lldb-command:print variable
|
2018-10-02 16:13:30 +00:00
|
|
|
// lldbg-check:[...]$6 = 1
|
|
|
|
// lldbr-check:(isize) variable = 1
|
2014-07-09 12:46:09 +00:00
|
|
|
// lldb-command:print constant
|
2018-10-02 16:13:30 +00:00
|
|
|
// lldbg-check:[...]$7 = 2
|
|
|
|
// lldbr-check:(isize) constant = 2
|
2014-07-09 12:46:09 +00:00
|
|
|
// lldb-command:print a_struct
|
2019-05-14 12:50:58 +00:00
|
|
|
// lldbg-check:[...]$8 = { a = -3 b = 4.5 c = 5 }
|
|
|
|
// lldbr-check:(var_captured_in_nested_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 }
|
2014-07-09 12:46:09 +00:00
|
|
|
// lldb-command:print *struct_ref
|
2019-05-14 12:50:58 +00:00
|
|
|
// lldbg-check:[...]$9 = { a = -3 b = 4.5 c = 5 }
|
|
|
|
// lldbr-check:(var_captured_in_nested_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 }
|
2014-07-09 12:46:09 +00:00
|
|
|
// lldb-command:print *owned
|
2018-10-02 16:13:30 +00:00
|
|
|
// lldbg-check:[...]$10 = 6
|
|
|
|
// lldbr-check:(isize) *owned = 6
|
2014-07-09 12:46:09 +00:00
|
|
|
// lldb-command:print closure_local
|
2018-10-02 16:13:30 +00:00
|
|
|
// lldbg-check:[...]$11 = 8
|
|
|
|
// lldbr-check:(isize) closure_local = 8
|
2014-07-09 12:46:09 +00:00
|
|
|
// lldb-command:continue
|
|
|
|
|
2021-04-06 17:34:17 +00:00
|
|
|
|
|
|
|
// === CDB TESTS ===================================================================================
|
|
|
|
|
|
|
|
// cdb-command: g
|
|
|
|
|
|
|
|
// cdb-command: dx variable
|
|
|
|
// cdb-check:variable : 1 [Type: [...]]
|
|
|
|
// cdb-command: dx constant
|
|
|
|
// cdb-check:constant : 2 [Type: [...]]
|
|
|
|
// cdb-command: dx a_struct
|
|
|
|
// cdb-check:a_struct [Type: var_captured_in_nested_closure::Struct]
|
|
|
|
// cdb-check: [+0x[...]] a : -3 [Type: [...]]
|
|
|
|
// cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
|
|
|
|
// cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
|
|
|
|
// cdb-command: dx struct_ref
|
|
|
|
// cdb-check:struct_ref : 0x[...] [Type: var_captured_in_nested_closure::Struct *]
|
|
|
|
// cdb-check: [+0x[...]] a : -3 [Type: [...]]
|
|
|
|
// cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
|
|
|
|
// cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
|
|
|
|
// cdb-command: dx owned
|
|
|
|
// cdb-check:owned : 0x[...] : 6 [Type: [...] *]
|
|
|
|
// cdb-check: 6 [Type: [...]]
|
|
|
|
// cdb-command: dx closure_local
|
|
|
|
// cdb-check:closure_local : 8 [Type: [...]]
|
|
|
|
// cdb-command: dx nested_closure
|
2022-01-19 16:56:53 +00:00
|
|
|
// cdb-check:nested_closure [Type: var_captured_in_nested_closure::main::closure$0::closure_env$0]
|
2021-04-06 17:34:17 +00:00
|
|
|
|
|
|
|
// cdb-command: g
|
|
|
|
|
|
|
|
// cdb-command: dx variable
|
|
|
|
// cdb-check:variable : 1 [Type: [...]]
|
|
|
|
// cdb-command: dx constant
|
|
|
|
// cdb-check:constant : 2 [Type: [...]]
|
|
|
|
// cdb-command: dx a_struct
|
|
|
|
// cdb-check:a_struct [Type: var_captured_in_nested_closure::Struct]
|
|
|
|
// cdb-check: [+0x[...]] a : -3 [Type: [...]]
|
|
|
|
// cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
|
|
|
|
// cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
|
|
|
|
// cdb-command: dx struct_ref
|
|
|
|
// cdb-check:struct_ref : 0x[...] [Type: var_captured_in_nested_closure::Struct *]
|
|
|
|
// cdb-check: [+0x[...]] a : -3 [Type: [...]]
|
|
|
|
// cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
|
|
|
|
// cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
|
|
|
|
// cdb-command: dx owned
|
|
|
|
// cdb-check:owned : 0x[...] : 6 [Type: [...] *]
|
|
|
|
// cdb-check: 6 [Type: [...]]
|
|
|
|
// cdb-command: dx closure_local
|
|
|
|
// cdb-check:closure_local : 8 [Type: [...]]
|
|
|
|
|
2014-10-27 22:37:07 +00:00
|
|
|
#![allow(unused_variables)]
|
2015-09-19 20:33:47 +00:00
|
|
|
#![feature(omit_gdb_pretty_printer_section)]
|
2014-12-03 22:48:18 +00:00
|
|
|
#![omit_gdb_pretty_printer_section]
|
2013-08-29 09:44:11 +00:00
|
|
|
|
|
|
|
struct Struct {
|
2015-03-26 00:06:52 +00:00
|
|
|
a: isize,
|
2013-09-26 06:26:09 +00:00
|
|
|
b: f64,
|
2015-03-26 00:06:52 +00:00
|
|
|
c: usize
|
2013-08-29 09:44:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut variable = 1;
|
|
|
|
let constant = 2;
|
|
|
|
|
|
|
|
let a_struct = Struct {
|
|
|
|
a: -3,
|
|
|
|
b: 4.5,
|
|
|
|
c: 5
|
|
|
|
};
|
|
|
|
|
|
|
|
let struct_ref = &a_struct;
|
2021-08-25 00:39:40 +00:00
|
|
|
let owned: Box<_> = Box::new(6);
|
2013-08-29 09:44:11 +00:00
|
|
|
|
2016-04-16 18:51:26 +00:00
|
|
|
let mut closure = || {
|
2013-08-29 09:44:11 +00:00
|
|
|
let closure_local = 8;
|
|
|
|
|
2016-04-16 18:51:26 +00:00
|
|
|
let mut nested_closure = || {
|
2014-07-09 12:46:09 +00:00
|
|
|
zzz(); // #break
|
2014-10-02 05:10:09 +00:00
|
|
|
variable = constant + a_struct.a + struct_ref.a + *owned + closure_local;
|
2013-08-29 09:44:11 +00:00
|
|
|
};
|
|
|
|
|
2014-07-09 12:46:09 +00:00
|
|
|
zzz(); // #break
|
2013-08-29 09:44:11 +00:00
|
|
|
|
|
|
|
nested_closure();
|
|
|
|
};
|
|
|
|
|
|
|
|
closure();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn zzz() {()}
|