1#exe {
2--name strings
3-Mroot=strings.zig
4#}
5
6#write strings.zig {
7const Strings = struct {
8 c_ptr: [*c]const u8 = "c_ptr\x07\x08\t",
9 many_ptr: [*:0]const u8 = "many_ptr\n\x0b\x0c",
10 ptr_array: *const [12:0]u8 = "ptr_array\x00\r\x1b",
11 slice: [:0]const u8 = "slice\"\'\\\x00",
12};
13fn testStrings(strings: Strings) void {
14 _ = strings;
15}
16pub fn main() void {
17 testStrings(.{});
18}
19#}
20#update
21#check lldb {
22(lldb) breakpoint set --file strings.zig --source-pattern-regexp '_ = strings;'
23Breakpoint 1: where = strings`strings.testStrings + #... at strings.zig:9:1, address = 0x#...
24(lldb) process launch
25Process #... launched: '#.../strings' (#...)
26Process #... stopped
27* thread #1, name = 'strings', stop reason = breakpoint 1.1
28 frame #0: strings`strings.testStrings(strings=Strings @ 0x#...) at strings.zig:9:1
29(lldb) frame variable --show-all-children --show-types -- strings.slice
30([:0]const u8) strings.slice = len=9 {
31 (u8) [0] = 115
32 (u8) [1] = 108
33 (u8) [2] = 105
34 (u8) [3] = 99
35 (u8) [4] = 101
36 (u8) [5] = 34
37 (u8) [6] = 39
38 (u8) [7] = 92
39 (u8) [8] = 0
40}
41(lldb) frame variable --show-all-children --show-types --format character -- strings.slice
42([:0]const u8) strings.slice = len=9 {
43 (u8) [0] = 's'
44 (u8) [1] = 'l'
45 (u8) [2] = 'i'
46 (u8) [3] = 'c'
47 (u8) [4] = 'e'
48 (u8) [5] = '\"'
49 (u8) [6] = '\''
50 (u8) [7] = '\\'
51 (u8) [8] = '\x00'
52}
53(lldb) frame variable --show-all-children --show-types --format c-string -- strings
54(root.strings.Strings) strings = {
55 ([*c]const u8) .c_ptr = "c_ptr\x07\x08\t"
56 ([*:0]const u8) .many_ptr = "many_ptr\n\x0b\x0c"
57 (*const [12:0]u8) .ptr_array = "ptr_array\x00\r\x1b"
58 ([:0]const u8) .slice = "slice\"\'\\\x00" len=9 {
59 (u8) [0] = "s"
60 (u8) [1] = "l"
61 (u8) [2] = "i"
62 (u8) [3] = "c"
63 (u8) [4] = "e"
64 (u8) [5] = "\""
65 (u8) [6] = "\'"
66 (u8) [7] = "\\"
67 (u8) [8] = "\x00"
68 }
69}
70(lldb) breakpoint delete --force 1
711 breakpoints deleted; 0 breakpoint locations disabled.
72#}