mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-10-29 03:06:10 +08:00
45 lines
1.1 KiB
Plaintext
45 lines
1.1 KiB
Plaintext
#exe {
|
|
--name switch_blocks
|
|
-Mroot=switch_blocks.zig
|
|
#}
|
|
|
|
#write switch_blocks.zig {
|
|
pub fn main() void {
|
|
for (0..2) |i| {
|
|
switch (i) {
|
|
0 => {
|
|
var x: u32 = 123;
|
|
_ = &x;
|
|
},
|
|
else => {
|
|
var x: f32 = 4.5;
|
|
_ = &x;
|
|
},
|
|
}
|
|
}
|
|
}
|
|
#}
|
|
#update
|
|
#check lldb {
|
|
(lldb) breakpoint set --file switch_blocks.zig --source-pattern-regexp '_ = &x;'
|
|
Breakpoint 1: 2 locations.
|
|
(lldb) process launch
|
|
Process #... launched: '#.../switch_blocks' (#...)
|
|
Process #... stopped
|
|
* thread #1, name = 'switch_blocks', stop reason = breakpoint 1.1
|
|
frame #0: switch_blocks`switch_blocks.main at switch_blocks.zig:6:17
|
|
(lldb) frame variable --show-all-children
|
|
(usize) i = 0
|
|
(u32) x = 123
|
|
(lldb) process continue
|
|
Process #... resuming
|
|
Process #... stopped
|
|
* thread #1, name = 'switch_blocks', stop reason = breakpoint 1.2
|
|
frame #0: switch_blocks`switch_blocks.main at switch_blocks.zig:10:17
|
|
(lldb) frame variable --show-all-children
|
|
(usize) i = 1
|
|
(f32) x = 4.5
|
|
(lldb) breakpoint delete --force 1
|
|
1 breakpoints deleted; 0 breakpoint locations disabled.
|
|
#}
|