1 // min-lldb-version: 310
5 // === GDB TESTS ===================================================================================
9 // gdb-command:print variable
11 // gdb-command:print constant
13 // gdb-command:print a_struct
14 // gdbg-check:$3 = {a = -3, b = 4.5, c = 5}
15 // gdbr-check:$3 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5}
16 // gdb-command:print *struct_ref
17 // gdbg-check:$4 = {a = -3, b = 4.5, c = 5}
18 // gdbr-check:$4 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5}
19 // gdb-command:print *owned
21 // gdb-command:print closure_local
23 // gdb-command:continue
25 // gdb-command:print variable
27 // gdb-command:print constant
29 // gdb-command:print a_struct
30 // gdbg-check:$9 = {a = -3, b = 4.5, c = 5}
31 // gdbr-check:$9 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5}
32 // gdb-command:print *struct_ref
33 // gdbg-check:$10 = {a = -3, b = 4.5, c = 5}
34 // gdbr-check:$10 = var_captured_in_nested_closure::Struct {a: -3, b: 4.5, c: 5}
35 // gdb-command:print *owned
37 // gdb-command:print closure_local
39 // gdb-command:continue
42 // === LLDB TESTS ==================================================================================
46 // lldb-command:print variable
47 // lldbg-check:[...]$0 = 1
48 // lldbr-check:(isize) variable = 1
49 // lldb-command:print constant
50 // lldbg-check:[...]$1 = 2
51 // lldbr-check:(isize) constant = 2
52 // lldb-command:print a_struct
53 // lldbg-check:[...]$2 = { a = -3 b = 4.5 c = 5 }
54 // lldbr-check:(var_captured_in_nested_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 }
55 // lldb-command:print *struct_ref
56 // lldbg-check:[...]$3 = { a = -3 b = 4.5 c = 5 }
57 // lldbr-check:(var_captured_in_nested_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 }
58 // lldb-command:print *owned
59 // lldbg-check:[...]$4 = 6
60 // lldbr-check:(isize) *owned = 6
61 // lldb-command:print closure_local
62 // lldbg-check:[...]$5 = 8
63 // lldbr-check:(isize) closure_local = 8
64 // lldb-command:continue
66 // lldb-command:print variable
67 // lldbg-check:[...]$6 = 1
68 // lldbr-check:(isize) variable = 1
69 // lldb-command:print constant
70 // lldbg-check:[...]$7 = 2
71 // lldbr-check:(isize) constant = 2
72 // lldb-command:print a_struct
73 // lldbg-check:[...]$8 = { a = -3 b = 4.5 c = 5 }
74 // lldbr-check:(var_captured_in_nested_closure::Struct) a_struct = { a = -3 b = 4.5 c = 5 }
75 // lldb-command:print *struct_ref
76 // lldbg-check:[...]$9 = { a = -3 b = 4.5 c = 5 }
77 // lldbr-check:(var_captured_in_nested_closure::Struct) *struct_ref = { a = -3 b = 4.5 c = 5 }
78 // lldb-command:print *owned
79 // lldbg-check:[...]$10 = 6
80 // lldbr-check:(isize) *owned = 6
81 // lldb-command:print closure_local
82 // lldbg-check:[...]$11 = 8
83 // lldbr-check:(isize) closure_local = 8
84 // lldb-command:continue
87 // === CDB TESTS ===================================================================================
91 // cdb-command: dx variable
92 // cdb-check:variable : 1 [Type: [...]]
93 // cdb-command: dx constant
94 // cdb-check:constant : 2 [Type: [...]]
95 // cdb-command: dx a_struct
96 // cdb-check:a_struct [Type: var_captured_in_nested_closure::Struct]
97 // cdb-check: [+0x[...]] a : -3 [Type: [...]]
98 // cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
99 // cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
100 // cdb-command: dx struct_ref
101 // cdb-check:struct_ref : 0x[...] [Type: var_captured_in_nested_closure::Struct *]
102 // cdb-check: [+0x[...]] a : -3 [Type: [...]]
103 // cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
104 // cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
105 // cdb-command: dx owned
106 // cdb-check:owned : 0x[...] : 6 [Type: [...] *]
107 // cdb-check: 6 [Type: [...]]
108 // cdb-command: dx closure_local
109 // cdb-check:closure_local : 8 [Type: [...]]
110 // cdb-command: dx nested_closure
111 // cdb-check:nested_closure [Type: var_captured_in_nested_closure::main::closure$0::closure_env$0]
115 // cdb-command: dx variable
116 // cdb-check:variable : 1 [Type: [...]]
117 // cdb-command: dx constant
118 // cdb-check:constant : 2 [Type: [...]]
119 // cdb-command: dx a_struct
120 // cdb-check:a_struct [Type: var_captured_in_nested_closure::Struct]
121 // cdb-check: [+0x[...]] a : -3 [Type: [...]]
122 // cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
123 // cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
124 // cdb-command: dx struct_ref
125 // cdb-check:struct_ref : 0x[...] [Type: var_captured_in_nested_closure::Struct *]
126 // cdb-check: [+0x[...]] a : -3 [Type: [...]]
127 // cdb-check: [+0x[...]] b : 4.500000 [Type: [...]]
128 // cdb-check: [+0x[...]] c : 0x5 [Type: unsigned [...]]
129 // cdb-command: dx owned
130 // cdb-check:owned : 0x[...] : 6 [Type: [...] *]
131 // cdb-check: 6 [Type: [...]]
132 // cdb-command: dx closure_local
133 // cdb-check:closure_local : 8 [Type: [...]]
135 #![allow(unused_variables)]
136 #![feature(omit_gdb_pretty_printer_section)]
137 #![omit_gdb_pretty_printer_section]
146 let mut variable = 1;
149 let a_struct = Struct {
155 let struct_ref = &a_struct;
156 let owned: Box<_> = Box::new(6);
158 let mut closure = || {
159 let closure_local = 8;
161 let mut nested_closure = || {
163 variable = constant + a_struct.a + struct_ref.a + *owned + closure_local;