[Lldb-commits] [lldb] af4f40c - [LLDB] NativeThreadLinux invalidate register cache on stop

Muhammad Omair Javaid via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 19 00:31:13 PDT 2020


Author: Muhammad Omair Javaid
Date: 2020-08-19T12:30:38+05:00
New Revision: af4f40c376f5f05ec1b7cc72840518e917eaf091

URL: https://github.com/llvm/llvm-project/commit/af4f40c376f5f05ec1b7cc72840518e917eaf091
DIFF: https://github.com/llvm/llvm-project/commit/af4f40c376f5f05ec1b7cc72840518e917eaf091.diff

LOG: [LLDB] NativeThreadLinux invalidate register cache on stop

In our discussion D79699 SVE ptrace register access support we decide to
invalidate register context cached data on every stop instead of doing
at before Step/Resume.

InvalidateAllRegisters was added to facilitate flushing of SVE register
context configuration and cached register values. It now makes more
sense to move invalidation after every stop where we initiate SVE
configuration update if needed by calling ConfigureRegisterContext.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D84501

Added: 
    

Modified: 
    lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
index 14eea2df3810..5aec98bdeca6 100644
--- a/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -241,9 +241,6 @@ Status NativeThreadLinux::Resume(uint32_t signo) {
   if (signo != LLDB_INVALID_SIGNAL_NUMBER)
     data = signo;
 
-  // Before thread resumes, clear any cached register data structures
-  GetRegisterContext().InvalidateAllRegisters();
-
   return NativeProcessLinux::PtraceWrapper(PTRACE_CONT, GetID(), nullptr,
                                            reinterpret_cast<void *>(data));
 }
@@ -265,9 +262,6 @@ Status NativeThreadLinux::SingleStep(uint32_t signo) {
   if (signo != LLDB_INVALID_SIGNAL_NUMBER)
     data = signo;
 
-  // Before thread resumes, clear any cached register data structures
-  GetRegisterContext().InvalidateAllRegisters();
-
   // If hardware single-stepping is not supported, we just do a continue. The
   // breakpoint on the next instruction has been setup in
   // NativeProcessLinux::Resume.
@@ -325,6 +319,9 @@ void NativeThreadLinux::SetStopped() {
   if (m_state == StateType::eStateStepping)
     m_step_workaround.reset();
 
+  // On every stop, clear any cached register data structures
+  GetRegisterContext().InvalidateAllRegisters();
+
   const StateType new_state = StateType::eStateStopped;
   MaybeLogStateChange(new_state);
   m_state = new_state;


        


More information about the lldb-commits mailing list