Howdy!
I’ve been contacted privately regarding debugging by several Rust and LLDB maintainers. I’ve been a bit swamped so I’ve been putting off following up on it, but I can share what I know atm.
I dont want to say too much on anyone’s behalf, but Rust maintainers have expressed some interest.
They are currently looking into overhauling the compiler’s testing suite for debug info because it’s more or less non-functional and very brittle to changes in the debuggers themselves. It’s hard to account for the versions of the ambient tools, and those version changes can cause huge breakages. It’s also hard to replicate CI failures on local machines (or vice versa). Last I checked, CI only ran the tests on Linux, and there was talks of disabling them altogether until they’re fixed. I was unable to get them running on Windows locally at all.
That’s not a direct blocker to debug info changes on Rust’s end, but there’s definitely some hesitence because of it.
The major blockers seem to be lack of experts from those debuggers and/or lack of interest in general. The Windows side of things is especially neglected (for both *-gnu and *-msvc targets). There is some potential for help or information from Microsoft? Take that with a HUGE grain of salt though. The most I know is a Rust maintainer knows a guy who works on Rust UX at MS and was willing to pass on a few of my questions. PDB as a format is also still seemingly getting new features, so any info we can get from them would be awesome.
I’ve been back and forth on if it makes more sense to upstream TypeSystemRust or just add more conditional behavior to TypeSystemClang, but I’m just about done adding PDB support to TypeSystemRust and that has tipped my opinion towards having a dedicated plugin. There’s too many little edge cases, and it would solve a lot of the bigger annoyances with debug info maintenance (e.g. having to have separate Synthetic Providers for gnu and msvc, problems with type lookups, missing template args). Certain problems are hard to solve in TypeSystemClang becuause of the semantic differences between the languages. References arent objects in C++, so ref-to-ref isnt valid, but it is in Rust. Normalizing the type names that Rust generates (e.g. tuple$<u8, ref$<u32>>) to play nice with CDB is also an issue.
Some issues require changes to the output that Rust is generating, and I have some fixes for those, but some are a matter of “do we put in a super hacky fix now and then rip it out later, or do we just wait until it’s unnecessary?” and i havent asked about that yet.
I’ve heard second-hand as recently as a few months ago (through a Rust contributor that works with them) that Greg Clayton expressed interest in more formal Rust support in LLDB, including compiler integration similar to TypeSystemClang, so long as there’s proper testing and such.
One thing I want to point out is that even though codelldb no longer uses a bespoke TypeSystemRust, I’m pretty sure it does still use a slightly-custom version of LLDB. The major tipoff is that codelldb seems to properly handle Rust type names from PDB debug info. Mainline LLDB uses the “unique name” field from the PDB data for some reason (which is just a number) rather than the “name” field. I dont think the branch codelldb uses is public, but it may be worth asking what changes they’ve made and upstreaming them if they’re up for it.
CodeLLDB also has the best Rust<->LLDB bindings that exist right now by far, but it’s exclusively the public SB api iirc. The crates arent on crates.io, but they are in the codelldb repo (see also: weaklink which takes care of dynamic linking to lldb).
I definitely think making good bindings for the TypeSystem and adjacent APIs (DWARF/PDB parsers, lldb_private::Type, erc.) would help a lot for getting contributors. There’s a lot of wrapped LLVM APIs already in the Rust compiler, so it wouldnt be out of place. I’m not an expert on FFI or anything, but it definitely seems do-able.
An lldb-c API similar to llvm-c and clang-c would help a lot since automated binding tools require a lot less intervention with C code. Being able to build LLDB as a static lib would also be pretty nice, since it could be bundled into an lldb-sys FFI crate. That would allow crates.io’s versioning to guarantee specific LLDB versions and isolate from ambient tools on the system (duckdb and rusqlite work this way via a feature flag).
On the opposite end, without bindings it’s not 100% necessary to write Rust code at all to write the TypeSystem. There might be C++ devs willing to work on it if it boils down to “here’s a document of Rust debug info quirks” but all the actual coding is C++ and they dont have to dig through the Rust compiler source.