Today I attempted to debug a simple zig program in VSCode with CodeLLDB plugin, I got a empty list in the ‘Local’ node of variables tree after debugger running.
So, I directly ran the lldb command in the console to debug my program.
I got an error message from lldb when I print a variable:
“Could not find type system for language zig: TypeSystem for language zig doesn’t exist”
This sounds like a configuration issue with your editor. I can’t help with that directly, maybe someone else can. I think we’ll need more details of your setup though.
I replied to let you know that Zig has lldb pretty printers distributed with the source. I’ve found them to be fairly helpful for debugging Zig code.
Thank you for your reply.
I skipped use editor, just do all in terminal:
bgling@ubt:~/zprj$ pwd
/home/bgling/zprj
bgling@ubt:~/zprj$ mkdir demo2 && cd demo2
bgling@ubt:~/zprj/demo2$ zig init
info: created build.zig
info: created build.zig.zon
info: created src/main.zig
info: created src/root.zig
info: see `zig build --help` for a menu of options
bgling@ubt:~/zprj/demo2$ cd src
bgling@ubt:~/zprj/demo2/src$ cat > main.zig << 'EOF'
> const std = @import("std");
>
> pub fn main() !void {
> const a: i32 = 123;
> std.debug.print("{d}\n", .{a});
> }
> EOF
bgling@ubt:~/zprj/demo2/src$ cd ..
bgling@ubt:~/zprj/demo2$ zig build
bgling@ubt:~/zprj/demo2$ ./zig-out/bin/demo2
123
bgling@ubt:~/zprj/demo2$ lldb ./zig-out/bin/demo2
(lldb) target create "./zig-out/bin/demo2"
Current executable set to '/home/bgling/zprj/demo2/zig-out/bin/demo2' (x86_64).
(lldb) b main.main
Breakpoint 1: where = demo2`main.main + 8, address = 0x000000000115284b
(lldb) r
Process 19543 launched: '/home/bgling/zprj/demo2/zig-out/bin/demo2' (x86_64)
Process 19543 stopped
* thread #1, name = 'demo2', stop reason = breakpoint 1.1
frame #0: 0x000000000115284b demo2`main.main at main.zig:5:20
2
3 pub fn main() !void {
4 const a: i32 = 123;
-> 5 std.debug.print("{d}\n", .{a});
6 }
warning: This version of LLDB has no plugin for the language "zig". Inspection of frame variables will be limited.
(lldb) p a
error: Could not find type system for language zig: TypeSystem for language zig doesn't exist
(lldb) q
Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] y
Oh, I got the same problem, thanks to all of you guys! It’s definitely related to the default setting—on the master branch of Zig, the custom backend has been enabled by default for debug builds less than a month ago, which is likely the cause of the issue