[Lldb-commits] [PATCH] D82853: [LLDB] Support custom expedited register set in gdb-remote

Muhammad Omair Javaid via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 30 03:46:33 PDT 2020

omjavaid created this revision.
omjavaid added a reviewer: labath.
Herald added a subscriber: kristof.beyls.
Herald added a reviewer: rengolin.
omjavaid added parent revisions: D79699: Add ptrace register access for AArch64 SVE registers, D77047: AArch64 SVE register infos and core file support.

This patch adds capability to introduce a custom expedited register set in gdb remote. Currently we sent register set 0 as expedited register but for the case of AArch64 SVE we intend to send additional information about register set configuration stored in vg register. This will happen only when SVE mode is selected so we need a way to inform gdb-remote which register set to use when.



Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -806,11 +806,17 @@
   // Grab the register context.
   NativeRegisterContext& reg_ctx = thread->GetRegisterContext();
-  // Expedite all registers in the first register set (i.e. should be GPRs)
-  // that are not contained in other registers.
-  const RegisterSet *reg_set_p;
-  if (reg_ctx.GetRegisterSetCount() > 0 &&
-      ((reg_set_p = reg_ctx.GetRegisterSet(0)) != nullptr)) {
+  const RegisterSet *reg_set_p = reg_ctx.GetExpeditedRegisterSet();
+  if (reg_set_p == nullptr) {
+    // Architecture does not specify an expedited register set.
+    // Expedite all registers in the first register set (i.e. should be GPRs)
+    // that are not contained in other registers.
+    if (reg_ctx.GetRegisterSetCount() > 0)
+      reg_set_p = reg_ctx.GetRegisterSet(0);
+  }
+  if (reg_set_p != nullptr) {
               "GDBRemoteCommunicationServerLLGS::%s expediting registers "
               "from set '%s' (registers set count: %zu)",
Index: lldb/include/lldb/Host/common/NativeRegisterContext.h
--- lldb/include/lldb/Host/common/NativeRegisterContext.h
+++ lldb/include/lldb/Host/common/NativeRegisterContext.h
@@ -114,6 +114,8 @@
   virtual NativeThreadProtocol &GetThread() { return m_thread; }
+  virtual const RegisterSet *GetExpeditedRegisterSet() const { return nullptr; }
   const RegisterInfo *GetRegisterInfoByName(llvm::StringRef reg_name,
                                             uint32_t start_idx = 0);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82853.274392.patch
Type: text/x-patch
Size: 1842 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200630/d2b9e7c0/attachment.bin>

More information about the lldb-commits mailing list