[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
Mon Apr 20 08:35:39 PDT 2026
https://github.com/ayushsahay1837 updated https://github.com/llvm/llvm-project/pull/192430
>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 1/2] [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();
>From e3143384475cdc5ea5b8d34c2e80cdc28da65a8b Mon Sep 17 00:00:00 2001
From: Ayush Sahay <asahay at qti.qualcomm.com>
Date: Mon, 20 Apr 2026 20:15:58 +0530
Subject: [PATCH 2/2] Pull up InvalidateAllRegisters
---
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h | 3 ---
.../Process/Utility/NativeRegisterContextRegisterInfo.h | 3 +++
.../Process/Windows/Common/NativeRegisterContextWindows.h | 3 ---
3 files changed, 3 insertions(+), 6 deletions(-)
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/NativeRegisterContextWindows.h b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.h
index d7d8a3a4d9c18..2b71f639d562e 100644
--- a/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.h
+++ b/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows.h
@@ -28,9 +28,6 @@ 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;
};
More information about the lldb-commits
mailing list