[Lldb-commits] [PATCH] D96687: [lldb] Lower GetRealStopInfo into ThreadPlanCallFunction (NFC)

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sun Feb 14 23:18:06 PST 2021


kastiglione created this revision.
kastiglione added a reviewer: jingham.
kastiglione requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

`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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96687

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


Index: lldb/source/Expression/LLVMUserExpression.cpp
===================================================================
--- lldb/source/Expression/LLVMUserExpression.cpp
+++ lldb/source/Expression/LLVMUserExpression.cpp
@@ -188,9 +188,8 @@
         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)
Index: lldb/include/lldb/Target/ThreadPlanCallFunction.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlanCallFunction.h
+++ lldb/include/lldb/Target/ThreadPlanCallFunction.h
@@ -79,7 +79,7 @@
   // 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
Index: lldb/include/lldb/Target/ThreadPlan.h
===================================================================
--- lldb/include/lldb/Target/ThreadPlan.h
+++ lldb/include/lldb/Target/ThreadPlan.h
@@ -429,15 +429,6 @@
       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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96687.323672.patch
Type: text/x-patch
Size: 2153 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210215/b3712fe9/attachment-0001.bin>


More information about the lldb-commits mailing list