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. https://reviews.llvm.org/D82853 Files: lldb/include/lldb/Host/common/NativeRegisterContext.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp 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) { LLDB_LOGF(log, "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);
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) { LLDB_LOGF(log, "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);
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits