| 1 | #exe { |
| 2 | --name switch_blocks |
| 3 | -Mroot=switch_blocks.zig |
| 4 | #} |
| 5 | |
| 6 | #write switch_blocks.zig { |
| 7 | pub fn main() void { |
| 8 | for (0..2) |i| { |
| 9 | switch (i) { |
| 10 | 0 => { |
| 11 | var x: u32 = 123; |
| 12 | _ = &x; |
| 13 | }, |
| 14 | else => { |
| 15 | var x: f32 = 4.5; |
| 16 | _ = &x; |
| 17 | }, |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | #} |
| 22 | #update |
| 23 | #check lldb { |
| 24 | (lldb) breakpoint set --file switch_blocks.zig --source-pattern-regexp '_ = &x;' |
| 25 | Breakpoint 1: 2 locations. |
| 26 | (lldb) process launch |
| 27 | Process #... launched: '#.../switch_blocks' (#...) |
| 28 | Process #... stopped |
| 29 | * thread #1, name = 'switch_blocks', stop reason = breakpoint 1.1 |
| 30 | frame #0: switch_blocks`switch_blocks.main at switch_blocks.zig:6:17 |
| 31 | (lldb) frame variable --show-all-children |
| 32 | (usize) i = 0 |
| 33 | (u32) x = 123 |
| 34 | (lldb) process continue |
| 35 | Process #... resuming |
| 36 | Process #... stopped |
| 37 | * thread #1, name = 'switch_blocks', stop reason = breakpoint 1.2 |
| 38 | frame #0: switch_blocks`switch_blocks.main at switch_blocks.zig:10:17 |
| 39 | (lldb) frame variable --show-all-children |
| 40 | (usize) i = 1 |
| 41 | (f32) x = 4.5 |
| 42 | (lldb) breakpoint delete --force 1 |
| 43 | 1 breakpoints deleted; 0 breakpoint locations disabled. |
| 44 | #} |