[Lldb-commits] [lldb] r222459 - "nexti" should not step over inlined functions.

Jim Ingham jingham at apple.com
Thu Nov 20 14:04:45 PST 2014


Author: jingham
Date: Thu Nov 20 16:04:45 2014
New Revision: 222459

URL: http://llvm.org/viewvc/llvm-project?rev=222459&view=rev
Log:
"nexti" should not step over inlined functions.

<rdar://problem/16705325>

Modified:
    lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp

Modified: lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp?rev=222459&r1=222458&r2=222459&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp Thu Nov 20 16:04:45 2014
@@ -150,7 +150,16 @@ ThreadPlanStepInstruction::ShouldStop (E
     {
         Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
         
-        StackID cur_frame_zero_id = m_thread.GetStackFrameAtIndex(0)->GetStackID();
+        StackFrameSP cur_frame_sp = m_thread.GetStackFrameAtIndex(0);
+        if (!cur_frame_sp)
+        {
+            if (log)
+                log->Printf ("ThreadPlanStepInstruction couldn't get the 0th frame, stopping.");
+            SetPlanComplete();
+            return true;
+        }
+
+        StackID cur_frame_zero_id = cur_frame_sp->GetStackID();
         
         if (cur_frame_zero_id == m_stack_id || m_stack_id < cur_frame_zero_id)
         {
@@ -180,6 +189,24 @@ ThreadPlanStepInstruction::ShouldStop (E
             {
                 if (return_frame->GetStackID() != m_parent_frame_id || m_start_has_symbol)
                 {
+                    // next-instruction shouldn't step out of inlined functions.  But we may have stepped into a
+                    // real function that starts with an inlined function, and we do want to step out of that...
+
+                    if (cur_frame_sp->IsInlined())
+                    {
+                        StackFrameSP parent_frame_sp = m_thread.GetFrameWithStackID(m_stack_id);
+
+                        if(parent_frame_sp && parent_frame_sp->GetConcreteFrameIndex() == cur_frame_sp->GetConcreteFrameIndex())
+                        {
+                            SetPlanComplete();
+                            if (log)
+                            {
+                                log->Printf("Frame we stepped into is inlined into the frame we were stepping from, stopping.");
+                            }
+                            return true;
+                        }
+                    }
+
                     if (log)
                     {
                         StreamString s;





More information about the lldb-commits mailing list