Author: Ayush Sahay Date: 2026-05-10T18:30:18+05:30 New Revision: 79fa36f9ceeb325b4c946a5a52b3c8775d7e7ddd
URL: https://github.com/llvm/llvm-project/commit/79fa36f9ceeb325b4c946a5a52b3c8775d7e7ddd DIFF: https://github.com/llvm/llvm-project/commit/79fa36f9ceeb325b4c946a5a52b3c8775d7e7ddd.diff LOG: [lldb][Windows] Invalidate cached register values on thread stop (#192430) Invalidate cached values in register context data structures on every thread stop. NativeRegisterContextRegisterInfo::InvalidateAllRegisters performs no operation by default. Subclasses may override it to clear cached values within their register context data structures whenever a thread stops. This change intends to set up the necessary infrastructure to support caching of the thread context in NativeRegisterContextWindows_arm64, which will improve read performance. Currently, the thread context is retrieved for every read or write operation. Added: Modified: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h lldb/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h index 08f19d374e280..797eacc3bdd0f 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h @@ -37,9 +37,6 @@ class NativeRegisterContextLinux // Determine the architecture of the thread given by its ID. static llvm::Expected<ArchSpec> DetermineArchitecture(lldb::tid_t tid); - // Invalidates cached values in register context data structures - virtual void InvalidateAllRegisters(){} - struct SyscallData { /// The syscall instruction. If the architecture uses software /// single-stepping, the instruction should also be followed by a trap to diff --git a/lldb/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h b/lldb/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h index 0e96841fd9091..58a2a4843e4ec 100644 --- a/lldb/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h +++ b/lldb/source/Plugins/Process/Utility/NativeRegisterContextRegisterInfo.h @@ -33,6 +33,9 @@ class NativeRegisterContextRegisterInfo : public NativeRegisterContext { const RegisterInfoInterface &GetRegisterInfoInterface() const; + // Invalidate cached values in register context data structures. + virtual void InvalidateAllRegisters() {} + protected: std::unique_ptr<RegisterInfoInterface> m_register_info_interface_up; }; diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp index 8ad59cd1ece88..d76e9a51fdace 100644 --- a/lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp @@ -38,6 +38,9 @@ Status NativeThreadWindows::DoStop() { if (previous_suspend_count == (DWORD)-1) return Status(::GetLastError(), eErrorTypeWin32); + // Invalidate cached register values on every stop. + GetRegisterContext().InvalidateAllRegisters(); + m_state = eStateStopped; } return Status(); _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
