Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LLDB] On AArch64, reconfigure register context first #70742

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
DavidSpickett marked this conversation as resolved.
Show resolved Hide resolved
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())
Expand All @@ -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);
Expand Down