Author: jingham
Date: Tue Sep  8 13:40:59 2015
New Revision: 247046

URL: http://llvm.org/viewvc/llvm-project?rev=247046&view=rev
Log:
SBThread::StepOutOfFrame should check that the SBStackFrame it gets passed
is valid, and that its thread is the same as this SBThread.

Modified:
    lldb/trunk/source/API/SBThread.cpp

Modified: lldb/trunk/source/API/SBThread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=247046&r1=247045&r2=247046&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Tue Sep  8 13:40:59 2015
@@ -826,7 +826,6 @@ SBThread::StepOut ()
     Mutex::Locker api_locker;
     ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
 
-
     if (log)
         log->Printf ("SBThread(%p)::StepOut ()",
                      static_cast<void*>(exe_ctx.GetThreadPtr()));
@@ -861,6 +860,14 @@ SBThread::StepOutOfFrame (lldb::SBFrame
     Mutex::Locker api_locker;
     ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
 
+    if (!sb_frame.IsValid())
+    {
+        if (log)
+            log->Printf("SBThread(%p)::StepOutOfFrame passed an invalid frame, 
returning.",
+                        static_cast<void*>(exe_ctx.GetThreadPtr()));
+        return;
+    }
+    
     StackFrameSP frame_sp (sb_frame.GetFrameSP());
     if (log)
     {
@@ -877,6 +884,13 @@ SBThread::StepOutOfFrame (lldb::SBFrame
         bool abort_other_plans = false;
         bool stop_other_threads = false;
         Thread *thread = exe_ctx.GetThreadPtr();
+        if (sb_frame.GetThread().GetThreadID() != thread->GetID())
+        {
+            log->Printf("SBThread(%p)::StepOutOfFrame passed a frame from 
another thread (0x" PRIx64 " vrs. 0x" PRIx64 ", returning.",
+                        static_cast<void*>(exe_ctx.GetThreadPtr()),
+                        sb_frame.GetThread().GetThreadID(),
+                        thread->GetID());
+        }
 
         ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut 
(abort_other_plans,
                                                                     NULL,


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to