Add the ability to capture the return value in a thread's stop info, and print it
as part of the thread format output.
Currently this is only done for the ThreadPlanStepOut.
Add a convenience API ABI::GetReturnValueObject.
Change the ValueObject::EvaluationPoint to BE an ExecutionContextScope, rather than
trying to hand out one of its subsidiary object's pointers.  That way this will always
be good.


git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146806 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/StopInfo.cpp b/source/Target/StopInfo.cpp
index 4e089d4..f90968f 100644
--- a/source/Target/StopInfo.cpp
+++ b/source/Target/StopInfo.cpp
@@ -722,9 +722,10 @@
 {
 public:
 
-    StopInfoThreadPlan (ThreadPlanSP &plan_sp) :
+    StopInfoThreadPlan (ThreadPlanSP &plan_sp, ValueObjectSP &return_valobj_sp) :
         StopInfo (plan_sp->GetThread(), LLDB_INVALID_UID),
-        m_plan_sp (plan_sp)
+        m_plan_sp (plan_sp),
+        m_return_valobj_sp (return_valobj_sp)
     {
     }
     
@@ -749,9 +750,16 @@
         }
         return m_description.c_str();
     }
+    
+    ValueObjectSP
+    GetReturnValueObject()
+    {
+        return m_return_valobj_sp;
+    }
 
 private:
     ThreadPlanSP m_plan_sp;
+    ValueObjectSP m_return_valobj_sp;
 };
 } // namespace lldb_private
 
@@ -786,9 +794,9 @@
 }
 
 StopInfoSP
-StopInfo::CreateStopReasonWithPlan (ThreadPlanSP &plan_sp)
+StopInfo::CreateStopReasonWithPlan (ThreadPlanSP &plan_sp, ValueObjectSP return_valobj_sp)
 {
-    return StopInfoSP (new StopInfoThreadPlan (plan_sp));
+    return StopInfoSP (new StopInfoThreadPlan (plan_sp, return_valobj_sp));
 }
 
 StopInfoSP
@@ -796,3 +804,15 @@
 {
     return StopInfoSP (new StopInfoException (thread, description));
 }
+
+ValueObjectSP
+StopInfo::GetReturnValueObject(StopInfoSP &stop_info_sp)
+{
+    if (stop_info_sp && stop_info_sp->GetStopReason() == eStopReasonPlanComplete)
+    {
+        StopInfoThreadPlan *plan_stop_info = static_cast<StopInfoThreadPlan *>(stop_info_sp.get());
+        return plan_stop_info->GetReturnValueObject();
+    }
+    else
+        return ValueObjectSP();
+}