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