[Lldb-commits] [lldb] [lldb][Windows] Invalidate cached register values on thread stop (PR #192430)
Ayush Sahay via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 16 04:00:20 PDT 2026
https://github.com/ayushsahay1837 created https://github.com/llvm/llvm-project/pull/192430
Invalidate cached values in register context data structures on every thread stop.
_NativeRegisterContextWindows::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.
>From 229bfb9da571688cb2c0300ca82db7d6f4f7fdb2 Mon Sep 17 00:00:00 2001
From: Ayush Sahay <asahay at qti.qualcomm.com>
Date: Thu, 16 Apr 2026 16:10:42 +0530
Subject: [PATCH] [lldb][Windows] Invalidate cached register values on thread
stop
Invalidate cached values in register context data structures on every
thread stop.
---
.../Process/Windows/Common/NativeRegisterContextWindows.h | 3 +++
.../Plugins/Process/Windows/Common/NativeThreadWindows.cpp | 3 +++
2 files changed, 6 insertions(+)
diff --git a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.h b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.h
index 2b71f639d562e..d7d8a3a4d9c18 100644
--- a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.h
+++ b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.h
@@ -28,6 +28,9 @@ class NativeRegisterContextWindows
// Explicitly defining it ensures the class remains constructible.
NativeRegisterContextWindows() {}
+ // Invalidate cached values in register context data structures.
+ virtual void InvalidateAllRegisters() {}
+
protected:
lldb::thread_t GetThreadHandle() const;
};
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();
More information about the lldb-commits
mailing list