[Lldb-commits] [PATCH] D116896: [lldb] [gdb-remote] Support client fallback for servers without reg defs (WIP)
Michał Górny via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sun Jan 9 10:47:23 PST 2022
mgorny updated this revision to Diff 398447.
mgorny added a comment.
Improve macro formatting while it's still hot.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116896/new/
https://reviews.llvm.org/D116896
Files:
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -375,6 +375,36 @@
return regnums.size();
}
+static std::vector<DynamicRegisterInfo::Register> GetRegisters_x86_64() {
+ ConstString empty_alt_name;
+ ConstString reg_set{"general purpose registers"};
+
+#define R64(name) \
+ DynamicRegisterInfo::Register { \
+ ConstString(#name), empty_alt_name, reg_set, 8, LLDB_INVALID_INDEX32, \
+ lldb::eEncodingUint, lldb::eFormatHex, LLDB_INVALID_REGNUM, \
+ LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, {}, {} \
+ }
+#define R32(name) \
+ DynamicRegisterInfo::Register { \
+ ConstString(#name), empty_alt_name, reg_set, 4, LLDB_INVALID_INDEX32, \
+ lldb::eEncodingUint, lldb::eFormatHex, LLDB_INVALID_REGNUM, \
+ LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, {}, {} \
+ }
+
+ std::vector<DynamicRegisterInfo::Register> registers{
+ R64(rax), R64(rbx), R64(rcx), R64(rdx), R64(rsi), R64(rdi),
+ R64(rbp), R64(rsp), R64(r8), R64(r9), R64(r10), R64(r11),
+ R64(r12), R64(r13), R64(r14), R64(r15), R64(rip), R32(eflags),
+ R32(cs), R32(ss), R32(ds), R32(es), R32(fs), R32(gs),
+ };
+
+#undef R32
+#undef R64
+
+ return registers;
+}
+
void ProcessGDBRemote::BuildDynamicRegisterInfo(bool force) {
if (!force && m_register_info_sp)
return;
@@ -394,6 +424,7 @@
// 2 - If the target definition doesn't have any of the info from the
// target.xml (registers) then proceed to read the target.xml.
// 3 - Fall back on the qRegisterInfo packets.
+ // 4 - Use hardcoded defaults if available.
FileSpec target_definition_fspec =
GetGlobalPluginProperties().GetTargetDefinitionFile();
@@ -507,6 +538,18 @@
}
}
+ if (registers.empty()) {
+ switch (arch_to_use.GetMachine()) {
+ case llvm::Triple::x86:
+ break;
+ case llvm::Triple::x86_64:
+ registers = GetRegisters_x86_64();
+ break;
+ default:
+ break;
+ }
+ }
+
AddRemoteRegisters(registers, arch_to_use);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116896.398447.patch
Type: text/x-patch
Size: 2511 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220109/7d51c91e/attachment.bin>
More information about the lldb-commits
mailing list