[lldb-dev] Rust support in LLDB, again

Vadim Chugunov via lldb-dev lldb-dev at lists.llvm.org
Sat Sep 28 16:00:18 PDT 2019


Hi,
Last year there was an effort led by Tom Tromey to add Rust language
support into LLDB.  He had implemented a fairly complete language plugin,
however it was not accepted into mainline because of supportability
concerns.    I guess these concerns had some merit, because this change did
not survive even in Rust's private branch
<https://github.com/rust-lang/llvm-project/pull/19> due to the difficulty
of rebasing on top of LLVM 9.

I am wondering if there's a more limited version of this, that *can* be
merged into mainline:
In terms of its memory model, Rust is not that far off from C++, so
treating Rust types is if they were C++ types basically works.  There is
only one major problem: currently LLDB cannot deal with tagged unions,
which Rust code uses quite heavily.   When such a type is encountered, LLDB
just emits an empty struct, which makes it impossible to examine the
contents.

My tentative proposal is to modify LLDB's DWARFASTParserClang to handle
DW_TAG_variant et al, and create a C++ approximation of these types, e.g.
as a polymorphic class, or just an untagged union.   This would provide at
least a minimal level of functionality for Rust (and possibly other
languages) and be a much lesser maintenance burden on LLDB core team.
What would y'all say?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20190928/eccedca7/attachment.html>


More information about the lldb-dev mailing list