[Lldb-commits] [lldb] r279540 - Implementation "step out" plans shouldn't gather the return value.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 23 10:55:21 PDT 2016


Author: jingham
Date: Tue Aug 23 12:55:21 2016
New Revision: 279540

URL: http://llvm.org/viewvc/llvm-project?rev=279540&view=rev
Log:
Implementation "step out" plans shouldn't gather the return value.

When, for instance, "step-in" steps into a function that it doesn't want
to stop in (e.g. has no debug info) it will push a step-out plan to implement
the step out so it can then continue stepping.  These step out's don't use
the result of the function stepped out of, so they shouldn't spend the time 
to compute it.

Modified:
    lldb/trunk/include/lldb/Target/ThreadPlanStepOut.h
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Target/ThreadPlanStepOut.cpp

Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepOut.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanStepOut.h?rev=279540&r1=279539&r2=279540&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadPlanStepOut.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanStepOut.h Tue Aug 23 12:55:21 2016
@@ -32,7 +32,8 @@ public:
                        Vote run_vote,
                        uint32_t frame_idx,
                        LazyBool step_out_avoids_code_without_debug_info,
-                       bool continue_to_next_branch = false);
+                       bool continue_to_next_branch = false,
+                       bool gather_return_value = true);
 
     ~ThreadPlanStepOut() override;
 
@@ -46,11 +47,12 @@ public:
     void DidPush() override;
     bool IsPlanStale() override;
     
-    lldb::ValueObjectSP GetReturnValueObject() override
+    lldb::ValueObjectSP 
+    GetReturnValueObject() override
     {
         return m_return_valobj_sp;
     }
-
+    
 protected:
     void
     SetFlagsToDefault() override
@@ -65,18 +67,19 @@ protected:
 private:
     static uint32_t s_default_flag_values;  // These are the default flag values for the ThreadPlanStepThrough.
     
-    lldb::addr_t m_step_from_insn;
-    StackID  m_step_out_to_id;
-    StackID  m_immediate_step_from_id;
-    lldb::break_id_t m_return_bp_id;
-    lldb::addr_t m_return_addr;
-    bool m_stop_others;
-    lldb::ThreadPlanSP m_step_out_to_inline_plan_sp;    // This plan implements step out to the real function containing
+    lldb::addr_t        m_step_from_insn;
+    StackID             m_step_out_to_id;
+    StackID             m_immediate_step_from_id;
+    lldb::break_id_t    m_return_bp_id;
+    lldb::addr_t        m_return_addr;
+    bool                m_stop_others;
+    lldb::ThreadPlanSP  m_step_out_to_inline_plan_sp;    // This plan implements step out to the real function containing
                                                         // an inlined frame so we can then step out of that.
-    lldb::ThreadPlanSP m_step_through_inline_plan_sp;   // This plan then steps past the inlined frame(s).
-    lldb::ThreadPlanSP m_step_out_further_plan_sp;      // This plan keeps stepping out if ShouldStopHere told us to.
-    Function *m_immediate_step_from_function;
+    lldb::ThreadPlanSP  m_step_through_inline_plan_sp;   // This plan then steps past the inlined frame(s).
+    lldb::ThreadPlanSP  m_step_out_further_plan_sp;      // This plan keeps stepping out if ShouldStopHere told us to.
+    Function           *m_immediate_step_from_function;
     lldb::ValueObjectSP m_return_valobj_sp;
+    bool                m_calculate_return_value;
 
     friend lldb::ThreadPlanSP
     Thread::QueueThreadPlanForStepOut (bool abort_other_plans,

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=279540&r1=279539&r2=279540&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Tue Aug 23 12:55:21 2016
@@ -1626,6 +1626,7 @@ Thread::QueueThreadPlanForStepOutNoShoul
                                               uint32_t frame_idx,
                                               bool continue_to_next_branch)
 {
+    const bool calculate_return_value = false; // No need to calculate the return value here.
     ThreadPlanSP thread_plan_sp(new ThreadPlanStepOut (*this,
                                                         addr_context, 
                                                         first_insn, 
@@ -1634,7 +1635,8 @@ Thread::QueueThreadPlanForStepOutNoShoul
                                                         run_vote, 
                                                         frame_idx,
                                                         eLazyBoolNo,
-                                                        continue_to_next_branch));
+                                                        continue_to_next_branch,
+                                                        calculate_return_value));
 
     ThreadPlanStepOut *new_plan = static_cast<ThreadPlanStepOut *>(thread_plan_sp.get());
     new_plan->ClearShouldStopHereCallbacks();

Modified: lldb/trunk/source/Target/ThreadPlanStepOut.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOut.cpp?rev=279540&r1=279539&r2=279540&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOut.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOut.cpp Tue Aug 23 12:55:21 2016
@@ -46,7 +46,8 @@ ThreadPlanStepOut::ThreadPlanStepOut
     Vote run_vote,
     uint32_t frame_idx,
     LazyBool step_out_avoids_code_without_debug_info,
-    bool continue_to_next_branch
+    bool continue_to_next_branch,
+    bool gather_return_value
 ) :
     ThreadPlan (ThreadPlan::eKindStepOut, "Step out", thread, stop_vote, run_vote),
     ThreadPlanShouldStopHere (this),
@@ -54,7 +55,8 @@ ThreadPlanStepOut::ThreadPlanStepOut
     m_return_bp_id (LLDB_INVALID_BREAK_ID),
     m_return_addr (LLDB_INVALID_ADDRESS),
     m_stop_others (stop_others),
-    m_immediate_step_from_function(nullptr)
+    m_immediate_step_from_function(nullptr),
+    m_calculate_return_value(gather_return_value)
 {
     SetFlagsToDefault();
     SetupAvoidNoDebug(step_out_avoids_code_without_debug_info);
@@ -538,6 +540,9 @@ ThreadPlanStepOut::CalculateReturnValue
     if (m_return_valobj_sp)
         return;
         
+    if (!m_calculate_return_value)
+        return;
+        
     if (m_immediate_step_from_function != nullptr)
     {
         CompilerType return_compiler_type = m_immediate_step_from_function->GetCompilerType().GetFunctionReturnType();




More information about the lldb-commits mailing list