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/ABI.cpp b/source/Target/ABI.cpp
index fc55cca..f3a5404 100644
--- a/source/Target/ABI.cpp
+++ b/source/Target/ABI.cpp
@@ -9,6 +9,10 @@
#include "lldb/Target/ABI.h"
#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Target/Thread.h"
using namespace lldb;
using namespace lldb_private;
@@ -97,3 +101,28 @@
}
return false;
}
+
+ValueObjectSP
+ABI::GetReturnValueObject (Thread &thread,
+ ClangASTType &ast_type) const
+{
+ if (!ast_type.IsValid())
+ return ValueObjectSP();
+
+ Value ret_value;
+ ret_value.SetContext(Value::eContextTypeClangType,
+ ast_type.GetOpaqueQualType());
+ if (GetReturnValue (thread, ret_value))
+ {
+ return ValueObjectConstResult::Create(
+ thread.GetStackFrameAtIndex(0).get(),
+ ast_type.GetASTContext(),
+ ret_value,
+ ConstString("FunctionReturn"));
+
+ }
+ else
+ return ValueObjectSP();
+}
+
+