Skip to content

Include lldb-zig for nightlies #236

@bangbangsheshotmedown

Description

@bangbangsheshotmedown

I wanted to debug my zig program, but i couldn't (see bellow)

I suggest shipping lldb-zig build in the nightly version of zig

https://github.com/jacobly0/llvm-project/tree/lldb-zig

Important: it must be built with scripting enabled LLDB_ENABLE_PYTHON (require swig), and should build lldb-server separatly, this is important to have good IDE debugging: https://github.com/vadimcn/codelldb/blob/master/MANUAL.md#alternate-lldb-backends


(snippet of discord help discussion)

https://discord.com/channels/605571803288698900/1384079067065614346

I can't seem to set break points with  `@breakpoint()`, it refuses to compile:

game-run
└─ run game failure
error: the following command terminated unexpectedly:
cd /home/ryuukk/dev/kdomz/bin && /home/ryuukk/dev/kdomz/zig-out/bin/game 
Build Summary: 10/12 steps succeeded; 1 failed
game-run transitive failure
└─ run game failure
error: the following build command failed with exit code 1:
.zig-cache/o/4c8b2ecd881988a70e2c3e1aa3cc108f/build /opt/zig-x86_64-linux-gnu-baseline/zig /opt/zig-x86_64-linux-gnu-baseline/lib /home/ryuukk/dev/kdomz .zig-cache /home/ryuukk/.cache/zig --seed 0xf217fcd0 -Zd469f5fafd8caadc --prominent-compile-errors game-run



and when i try to break with `lldb` i get: 

(lldb) breakpoint set --name main
Breakpoint 1: where = game`start.main + 71, address = 0x000000000116f094
(lldb) run
Process 14322 launched: '/home/ryuukk/dev/kdomz/bin/game' (x86_64)
Process 14322 stopped
* thread # 1, name = 'game', stop reason = breakpoint 1.1
    frame # 0: 0x000000000116f094 game`start.main at start.zig:639:5
   636     }
   637     
   638     fn main(c_argc: c_int, c_argv: [*][*:0]c_char, c_envp: [*:null]?[*:0]c_char) callconv(.c) c_int {
-> 639         var env_count: usize = 0;
   640         while (c_envp[env_count] != null) : (env_count += 1) {}
   641         const envp = @as([*][*:0]u8, @ptrCast(c_envp))[0..env_count];
   642     
warning: This version of LLDB has no plugin for the language "zig". Inspection of frame variables will be limited.

i copied the executable from `zig-out/bin` to `bin/` because i need some files in there

build: https://gist.github.com/ryuukk/99c206b6538f39eae7bb59a7a02a5c7b

ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions