[Lldb-commits] [lldb] 2a2464e - [lldb] Lower GetRealStopInfo into ThreadPlanCallFunction (NFC)

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 15 17:59:49 PST 2021


Author: Dave Lee
Date: 2021-02-15T17:59:24-08:00
New Revision: 2a2464eb7651dc89290e9e3bf6928c99453bed99

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

LOG: [lldb] Lower GetRealStopInfo into ThreadPlanCallFunction (NFC)

`GetRealStopInfo` has only one call site, and in that call site a reference to the
concrete thread plan is available (`ThreadPlanCallUserExpression`), from which
`GetRealStopInfo` can be called.

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

Added: 
    

Modified: 
    lldb/include/lldb/Target/ThreadPlan.h
    lldb/include/lldb/Target/ThreadPlanCallFunction.h
    lldb/source/Expression/LLVMUserExpression.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Target/ThreadPlan.h b/lldb/include/lldb/Target/ThreadPlan.h
index 74d49ceb0e0a..caa6c5fe63aa 100644
--- a/lldb/include/lldb/Target/ThreadPlan.h
+++ b/lldb/include/lldb/Target/ThreadPlan.h
@@ -431,15 +431,6 @@ class ThreadPlan : public std::enable_shared_from_this<ThreadPlan>,
       m_tracer_sp->Log();
   }
 
-  // Some thread plans hide away the actual stop info which caused any
-  // particular stop.  For instance the ThreadPlanCallFunction restores the
-  // original stop reason so that stopping and calling a few functions won't
-  // lose the history of the run. This call can be implemented to get you back
-  // to the real stop info.
-  virtual lldb::StopInfoSP GetRealStopInfo() { 
-    return GetThread().GetStopInfo();
-  }
-
   // If the completion of the thread plan stepped out of a function, the return
   // value of the function might have been captured by the thread plan
   // (currently only ThreadPlanStepOut does this.) If so, the ReturnValueObject

diff  --git a/lldb/include/lldb/Target/ThreadPlanCallFunction.h b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
index 8874c6c6c729..24c5736f44c3 100644
--- a/lldb/include/lldb/Target/ThreadPlanCallFunction.h
+++ b/lldb/include/lldb/Target/ThreadPlanCallFunction.h
@@ -81,7 +81,7 @@ class ThreadPlanCallFunction : public ThreadPlan {
   // stop reason. But if something bad goes wrong, it is nice to be able to
   // tell the user what really happened.
 
-  lldb::StopInfoSP GetRealStopInfo() override {
+  virtual lldb::StopInfoSP GetRealStopInfo() {
     if (m_real_stop_info_sp)
       return m_real_stop_info_sp;
     else

diff  --git a/lldb/source/Expression/LLVMUserExpression.cpp b/lldb/source/Expression/LLVMUserExpression.cpp
index 187b427e66aa..527dff8bf60f 100644
--- a/lldb/source/Expression/LLVMUserExpression.cpp
+++ b/lldb/source/Expression/LLVMUserExpression.cpp
@@ -188,9 +188,8 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager,
         execution_result == lldb::eExpressionHitBreakpoint) {
       const char *error_desc = nullptr;
 
-      if (call_plan_sp) {
-        lldb::StopInfoSP real_stop_info_sp = call_plan_sp->GetRealStopInfo();
-        if (real_stop_info_sp)
+      if (user_expression_plan) {
+        if (auto real_stop_info_sp = user_expression_plan->GetRealStopInfo())
           error_desc = real_stop_info_sp->GetDescription();
       }
       if (error_desc)


        


More information about the lldb-commits mailing list