Files

73 lines
1.9 KiB
Plaintext

#exe {
--name strings
-Mroot=strings.zig
#}
#write strings.zig {
const Strings = struct {
c_ptr: [*c]const u8 = "c_ptr\x07\x08\t",
many_ptr: [*:0]const u8 = "many_ptr\n\x0b\x0c",
ptr_array: *const [12:0]u8 = "ptr_array\x00\r\x1b",
slice: [:0]const u8 = "slice\"\'\\\x00",
};
fn testStrings(strings: Strings) void {
_ = strings;
}
pub fn main() void {
testStrings(.{});
}
#}
#update
#check lldb {
(lldb) breakpoint set --file strings.zig --source-pattern-regexp '_ = strings;'
Breakpoint 1: where = strings`strings.testStrings + #... at strings.zig:9:1, address = 0x#...
(lldb) process launch
Process #... launched: '#.../strings' (#...)
Process #... stopped
* thread #1, name = 'strings', stop reason = breakpoint 1.1
frame #0: strings`strings.testStrings(strings=Strings @ 0x#...) at strings.zig:9:1
(lldb) frame variable --show-all-children --show-types -- strings.slice
([:0]const u8) strings.slice = len=9 {
(u8) [0] = 115
(u8) [1] = 108
(u8) [2] = 105
(u8) [3] = 99
(u8) [4] = 101
(u8) [5] = 34
(u8) [6] = 39
(u8) [7] = 92
(u8) [8] = 0
}
(lldb) frame variable --show-all-children --show-types --format character -- strings.slice
([:0]const u8) strings.slice = len=9 {
(u8) [0] = 's'
(u8) [1] = 'l'
(u8) [2] = 'i'
(u8) [3] = 'c'
(u8) [4] = 'e'
(u8) [5] = '\"'
(u8) [6] = '\''
(u8) [7] = '\\'
(u8) [8] = '\x00'
}
(lldb) frame variable --show-all-children --show-types --format c-string -- strings
(root.strings.Strings) strings = {
([*c]const u8) .c_ptr = "c_ptr\x07\x08\t"
([*:0]const u8) .many_ptr = "many_ptr\n\x0b\x0c"
(*const [12:0]u8) .ptr_array = "ptr_array\x00\r\x1b"
([:0]const u8) .slice = "slice\"\'\\\x00" len=9 {
(u8) [0] = "s"
(u8) [1] = "l"
(u8) [2] = "i"
(u8) [3] = "c"
(u8) [4] = "e"
(u8) [5] = "\""
(u8) [6] = "\'"
(u8) [7] = "\\"
(u8) [8] = "\x00"
}
}
(lldb) breakpoint delete --force 1
1 breakpoints deleted; 0 breakpoint locations disabled.
#}