zig icon indicating copy to clipboard operation
zig copied to clipboard

llvm: Nest debug info correctly

Open tau-dev opened this issue 1 year ago • 0 comments

Zig previously put the debug entries for types, functions and variables at top-level into the file scope. This meant that most of these declarations could be accessed from a debugger expression only by their fully qualified names, which in turn are hard to use because C-style debuggers try to interpret the .s in them as member access. Getting around that in GDB required you to enclose the FQN in single-quotes (which has really bad discoverability) and was, as far as I can tell, impossible in LLDB.

This PR nests that data so that it can also be accessed from C++ debuggers with the regular :: namespace operator. LLDB still handles variables badly and sometimes takes two tries for other declarations, but hopefully I can get a patch for that upstream.

All of that not only improves the experience with current debuggers, but also is a first step towards #614 (or its equivalent in LLDB), which will need this data too.

If this is PR accepted, I'm also willing to implement it in the self-hosted DWARF backend.

tau-dev avatar Jun 21 '24 14:06 tau-dev