Zig RAD Debugger interface library

Zig RAD Debugger interface library


After getting nerd sniped in RadDebugger and Zig - #3 by lassade I decided to make a Zig library with the capabilities of raddbg_markup.h.

This allow you to things such as

comptime {
    raddbg.typeView(
        Interner,
        "rows($, " ++
            "strings = storedStrings.size, " ++
            "holes = slots.items.len, " ++
            "bytes_used = storage.items.len, " ++
            "bytes_allocated = storage.capacity, " ++
            "storage = memory(storage.items.ptr, storage.items.len), " ++
            "slots, storedStrings, slotMergeThreshold)",
    );
}

So that when you are debugging you can see more meaningful information as fast as possible.

There is still much to do, since I am on linux I have not verified it works on windows (beyond cross compiling and checking the section is present in the binary).
and there is still functionality that I have yet to implement like setting thread name / colour, adding and removing breakpoints in the debugger programmatically, etc.
But it is functional enough for now.

Also of note, since linux support is still experimental for RAD Debugger (you have to build it yourself, it’s pretty easy though) I had to work around some bugs, such as it does not read the views from the elf file, so I had to make a small program that you can use at build time that uses Zig’s built in objcopy to get the section and write it out to the project file format.

Supported Zig versions

0.17.0

14 Likes

So I ended up dropping the objcopy step because it was crashing the build if the elf did not have the .raddbg section, I instead switched to having it be done by the helper program.

I also now got threadName and threadIdName working on linux with the debugger.
And the rest (thread colour and programmatic breakpoints) I don’t think can be done on linux, so I will see if I continue on to the windows side by using wine.