This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [gdb-remote] Support client fallback for servers without reg defs
ClosedPublic

Authored by mgorny on Jan 9 2022, 10:45 AM.

Details

Summary

Provide minimal register definition defaults for working with servers
that implement neither target.xml nor qRegisterInfo packets. This is
useful e.g. when interacting with FreeBSD's kernel minimal gdbserver
that does not send target.xml but uses the same layout for its supported
register subset as GDB.

The prerequisite for this is the ability to determine the correct
architecture, e.g. from the target executable.

Diff Detail

Event Timeline

mgorny created this revision.Jan 9 2022, 10:45 AM
mgorny requested review of this revision.Jan 9 2022, 10:45 AM
mgorny updated this revision to Diff 398447.

Improve macro formatting while it's still hot.

mgorny updated this revision to Diff 398542.Jan 10 2022, 2:19 AM
mgorny edited the summary of this revision. (Show Details)

Simplify the macros. Add a test.

This looks pretty okay I'd say. I might consider putting the actual definitions into a separate cpp file, simply because it's easy, and ProcessGDBRemote.cpp is already too big.

lldb/test/API/functionalities/gdb_remote_client/amd64-fallback-regs.FileCheck
1 ↗(On Diff #398542)

I actually think it would be better if this was defined inline in the python file, as then you could intersperse these lines with the definitions (which you have already formatted in a way that makes this easy), and it would be immediately obvious that the two lines describe the same data (modulo endianness).

mgorny added inline comments.Jan 10 2022, 4:18 AM
lldb/test/API/functionalities/gdb_remote_client/amd64-fallback-regs.FileCheck
1 ↗(On Diff #398542)

Using self.match, writing into a temporary file for FileCheck or do you have some other testing method on your mind?

mgorny updated this revision to Diff 398595.Jan 10 2022, 5:41 AM

Inline FileCheck input in the test file.

mgorny updated this revision to Diff 398644.Jan 10 2022, 7:49 AM

Split the new code into a separate file.

mgorny updated this revision to Diff 398654.Jan 10 2022, 8:33 AM

Add aarch64.

mgorny updated this revision to Diff 398701.Jan 10 2022, 10:56 AM
mgorny retitled this revision from [lldb] [gdb-remote] Support client fallback for servers without reg defs (WIP) to [lldb] [gdb-remote] Support client fallback for servers without reg defs.
mgorny edited the summary of this revision. (Show Details)

Added i386.

I suppose this concludes all my ideas so far.

labath accepted this revision.Jan 17 2022, 10:18 AM
This revision is now accepted and ready to land.Jan 17 2022, 10:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 17 2022, 1:31 PM