-
-
Notifications
You must be signed in to change notification settings - Fork 48
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 Compatibility #99
Comments
#100 merged in the first bit of explicit LLVM compat to Admittedly, these changes were merged in a pretty "laissez faire" manner, as they were fairly minor (allowing a few more bits to fall through the packet validation logic), and are entirely backwards compatible with GDB. I'm not convinced this sort of attitude will be applicable for more involved LLVM compat scenarios, but it's a reasonable way to enable a particular user's use case for now. At a certain point, it'd be a good idea to re-evaluate this approach, and consider alternative ways of enabling LLVM compat in the vFile API (e.g: changing the API to pass a |
Ah, interesting! Reading through the LLDB GDB RSP spec doc, it looks like LLDB adds a Depending on how early in the handshake LLDB sends this packet, it could serve double-duty as a way to dynamically detect when a LLDB client is connected, and swap into a LLDB "quirks" mode. Of course, this assumes that |
Hi! I noticed that lldb works, but only if the list of registers is explicitly provided. For example, for rv32, this string is currently returned:
This works fine with gdb (it seems to be ignore the register list), but llvm cares. To fix it, I changed it to this:
With that, lldb works out of the box; gdb is unaffected. I think, lldb is actually within the spec to require this. See https://sourceware.org/gdb/current/onlinedocs/gdb.html/RISC_002dV-Features.html:
Would you take a patch that addresses this? I'd apply this to rv32, rv64 and arm. Those are the three platforms where I observed this, though I wouldn't be surprised if this is a universal issue. |
Actually, I filed a separate task to not clutter this one: #148 |
This is a meta-issue to discuss + track
gdbstub
's LLDB compatibility story.Overview
LLDB uses the GDB Remote Serial Protocol for remote debugging, and for the most part, LLDB works "out of the box" with GDB server implementations. Unfortunately, there are some differences between how LLDB and GDB implement the Remote Serial Protocol, resulting in potential issues when mixing and matching servers/clients.
In some cases, LLDB has added new protocol extensions that are disjoint from (and therefore backwards compatible with) the base GDB protocol. The de-facto documentation for these LLDB specific extensions can be found here:
Unfortunately, there are some cases where LLDB happened to implement certain packets differently from GDB, resulting in breaking incompatibilities. The most pertinent example of this is wrt how LLDB handles
vFile
packets. This blog post does a good job providing an overview of the various LLDB-GDB RSP compatibility hazards: https://www.moritz.systems/blog/improving-gdb-protocol-compatibility-in-lldb/Moreover, as mentioned in the blog post above, LLDB has actually made breaking changes to its RSP between versions! Unlike GDB, using a newer LLDB client with an older LLDB server is not supported!
Supporting LLDB clients in
gdbstub
With these challenges in mind, what would be the best way to support LLDB clients in
gdbstub
?For the most part, it should be pretty straightforward to support arbitrary LLDB extensions in
gdbstub
. After all, adding support for any particular LLDB packet should be no different from adding support for a new GDB packet.Indeed, the bulk of the complexity in supporting LLDB clients is figuring out how to handle the inconsistencies between the LLDB and GDB RSPs.
gdbstub
include some kind of configuration to target a specific LLDB protocol version?qRegisterInfo
packet to fetch a target's register description, though newer versions of LLDB support parsingtarget.xml
data. Shouldgdbstub
attempt to "unify"qRegisterInfo
withtarget.xml
via theArch
trait, thereby enabling transparent support across all GDB and LLDB clients?These are open questions, and ones that I don't have answers to just yet. I suspect the only way to answer these questions will be by someone putting in the legwork to try some ideas out, and seeing how the things look.
The text was updated successfully, but these errors were encountered: