-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lldb RISC-V support #55383
Comments
@llvm/issue-subscribers-backend-risc-v |
@llvm/issue-subscribers-lldb |
Someone asked about this on Discord, so clearly we need a bit of an update here. The referenced Phab review did later land as 847de9c. Recently we got corefile support for RISC-V 64: d3a9043 Before that, Emmer added all the register information and a whole bunch of instructions to the emulation plugin. I think this was needed due to a lack of hardware single step (a standardized one at least). I've been told the basics work when connecting to qemu at least, but I don't know about a native RISC-V system and there's no publuc build bot for either configuration. If anyone does try lldb and has problems, please raise issues for them, it helps a lot just to know they exist. @tedwoodward you seem to have been in this area last year, do you know what the state is? |
Earlier this year, Qualcomm released a toolchain based on LLVM 18.0 that included LLDB. It works with RISC-V 32 and 64, tested with Linux user space QEMU. Our team is working on getting the LLDB test suite running for RISC-V 32 using QEMU, and plan to upstream support when it's in good shape. I'd like to run a bot in the llvm farm, but we haven't had that discussion internally. If not us, I'd like the tests to be set up so anyone could get RISC-V QEMU and run LLDB tests with it. I don't think we've got any debug on hardware yet. Maybe when there is more hardware, and RISC-V Linux is more mature we could port lldb-server to it, and run remote tests on hardware (or system QEMU). Or JTAG with OpenOCD. |
Debian also just enabled lldb for llvm-18 https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/merge_requests/137 (soon to be landed in unstable hopefully soon..) need to enable it for Alpine, here is MR https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/68640 plugins support is needed to get stuff like https://github.com/dotnet/diagnostics/tree/main/src/SOS/lldbplugin working. i will test it once the package is available in one of these distros. |
Significant PRs since Ted's update in July: In summary:
|
upcoming ubuntu 24.10 has lldb: $ docker run --platform linux/riscv64 --rm ubuntu:24.10 sh -c \
'uname -a && apt update && apt search liblldb-18-dev' # or lldb-18
Linux bef2d8730a94 6.10.0-linuxkit #1 SMP Wed Jul 17 10:51:09 UTC 2024 riscv64 riscv64 riscv64 GNU/Linux
...
liblldb-18-dev/oracular 1:18.1.8-9ubuntu1 riscv64
Next generation, high-performance debugger, header files so does alpine edge: $ docker run --platform linux/riscv64 --rm alpine:edge sh -c \
'uname -a && apk update && apk search lldb-dev' # or lldb
Linux 12b67a23eb80 6.10.0-linuxkit #1 SMP Wed Jul 17 10:51:09 UTC 2024 riscv64 Linux
...
lldb-dev-18.1.8-r0 |
@sylvestre, @Ikke if it's not too late, can we apply these patches to lldb-18 (in debian and alpine respectively)?
and the last one on lldb-19 as well? |
Expressions can now make function calls: #99336 |
awesome! a few hours ago, ubuntu 24.04 LTS accepted lldb 18 (see bug report). hopefully, these patches will make it into lldb 19, so the product becomes fully usable with all the bells and whistles, including custom plugin commands. waiting for llvm 20 means progress won’t come until the end of next year, when distros start adopting it—possibly not until 2026 for LTS releases. :/ |
im currently working on llvm19 for alpine. |
@ncopa, some of these aren't in 19 branch
basically all of these patches are for feature parity with other archs, so there is no fear of regression of any kind. (lldb is in alpine's community repo) |
They are in the correct order? |
ops, those patch urls are not good, we should be using .patch to the merge commit of each PR. let me provide it. |
@sylvestre, @ncopa these are the merge commits |
@sylvestre in ascending order of their merge date
|
ok, could you please get these patches in the next 19 dot releases? |
Would it be feasible to backport the following LLDB patches for RISC-V to v19 branch, or do they not meet the criteria for backporting? Justification: RISC-V is an emerging architecture, and LLDB's support for it is still maturing. These patches help bring RISC-V closer to feature parity with other architectures currently supported by LLVM. Risk: The risk is low, as LLDB’s RISC-V support is relatively new, and the associated functionality has not been previously operational. for chronological cherry-picking, this is the order: #55383 (comment) (+/- potential conflicts 🙂) |
It would definitely be way outside what we normally consider for back-porting. Adding new features post the first release doesn't seem sensible to me, even if the risk for other platforms are low in theory, it is a risk at this point. |
I agree. If these patches were fixing issues in features already supported on RISC-V, might be a different story. Which means anyone interested in RISC-V support has a few months to make LLDB 20 as good as possible. Please raise issues for any test failures and missing features you or other users find. Use builds from the Also there is a talk at the upcoming dev meeting on RISC-V support "Hey, do you want a RISC-V debugger?”, so you might get some good news before the next release. Edit: Which is now on YouTube |
On RISC-V, gdb is not always a suitable option to debug programs, especially for folks who use lldb plugins on other architectures. Without the working lldb, debugging code can be quite challenging.
D62732 is in review for over three years and there is no indication whether it is moving forward or abandoned. I realize that it is a matter of prioritization, but if someone else in the community can help with testing on riscv64/32, please do so. Or better yet, if you are familiar with lldb code-base, resubmit the patch.
The text was updated successfully, but these errors were encountered: