Author: Jason Molenda Date: 2023-10-31T15:38:42Z New Revision: d4026458d4ced8471cc0fcbf3a1a4cd1944ebea9
URL: https://github.com/llvm/llvm-project/commit/d4026458d4ced8471cc0fcbf3a1a4cd1944ebea9 DIFF: https://github.com/llvm/llvm-project/commit/d4026458d4ced8471cc0fcbf3a1a4cd1944ebea9.diff LOG: [LLDB] On AArch64, reconfigure register context first (#70742) On an SVE/SME the register context configuration may change after the inferior process has executed. This was handled via https://reviews.llvm.org/D159504 but it is reconfiguring and clearing the register context after we've parsed any expedited reigster values from the stop reply packet. That results in lldb having to read each register value one at a time while at that stop location, which will be a performance problem on non-local debug setups. The configuration & clearing needs to happen first. Also, update the names of the local variables for a little clarity. Added: Modified: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index dad1396698050d4..16b3ba661d07162 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1642,9 +1642,22 @@ ThreadSP ProcessGDBRemote::SetThreadStopInfo( } ThreadGDBRemote *gdb_thread = static_cast<ThreadGDBRemote *>(thread_sp.get()); - RegisterContextSP gdb_reg_ctx_sp(gdb_thread->GetRegisterContext()); + RegisterContextSP reg_ctx_sp(gdb_thread->GetRegisterContext()); - gdb_reg_ctx_sp->InvalidateIfNeeded(true); + reg_ctx_sp->InvalidateIfNeeded(true); + + // AArch64 SVE/SME specific code below updates SVE and ZA register sizes and + // offsets if value of VG or SVG registers has changed since last stop. + const ArchSpec &arch = GetTarget().GetArchitecture(); + if (arch.IsValid() && arch.GetTriple().isAArch64()) { + GDBRemoteRegisterContext *gdb_remote_reg_ctx = + static_cast<GDBRemoteRegisterContext *>(reg_ctx_sp.get()); + + if (gdb_remote_reg_ctx) { + gdb_remote_reg_ctx->AArch64Reconfigure(); + gdb_remote_reg_ctx->InvalidateAllRegisters(); + } + } auto iter = std::find(m_thread_ids.begin(), m_thread_ids.end(), tid); if (iter != m_thread_ids.end()) @@ -1655,25 +1668,10 @@ ThreadSP ProcessGDBRemote::SetThreadStopInfo( WritableDataBufferSP buffer_sp( new DataBufferHeap(reg_value_extractor.GetStringRef().size() / 2, 0)); reg_value_extractor.GetHexBytes(buffer_sp->GetData(), '\xcc'); - uint32_t lldb_regnum = gdb_reg_ctx_sp->ConvertRegisterKindToRegisterNumber( + uint32_t lldb_regnum = reg_ctx_sp->ConvertRegisterKindToRegisterNumber( eRegisterKindProcessPlugin, pair.first); gdb_thread->PrivateSetRegisterValue(lldb_regnum, buffer_sp->GetData()); } - - // AArch64 SVE/SME specific code below updates SVE and ZA register sizes and - // offsets if value of VG or SVG registers has changed since last stop. - const ArchSpec &arch = GetTarget().GetArchitecture(); - if (arch.IsValid() && arch.GetTriple().isAArch64()) { - GDBRemoteRegisterContext *reg_ctx_sp = - static_cast<GDBRemoteRegisterContext *>( - gdb_thread->GetRegisterContext().get()); - - if (reg_ctx_sp) { - reg_ctx_sp->AArch64Reconfigure(); - reg_ctx_sp->InvalidateAllRegisters(); - } - } - thread_sp->SetName(thread_name.empty() ? nullptr : thread_name.c_str()); gdb_thread->SetThreadDispatchQAddr(thread_dispatch_qaddr); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits