summaryrefslogtreecommitdiffstats
path: root/lldb/source/API
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2011-12-17 01:35:57 +0000
committerJim Ingham <jingham@apple.com>2011-12-17 01:35:57 +0000
commit73ca05a2a0c6ce957f9679e76b35ee06dc1559d4 (patch)
tree20b0f08ba2a6812f994fdea521bf436ea25453ce /lldb/source/API
parent903231bc58b27bbd1b74622b013fa277ceaeb16f (diff)
downloadbcm5719-llvm-73ca05a2a0c6ce957f9679e76b35ee06dc1559d4.tar.gz
bcm5719-llvm-73ca05a2a0c6ce957f9679e76b35ee06dc1559d4.zip
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. llvm-svn: 146806
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/SBThread.cpp28
-rw-r--r--lldb/source/API/SBValue.cpp12
2 files changed, 32 insertions, 8 deletions
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 69924ad6ad0..9ea28772978 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -31,10 +31,10 @@
#include "lldb/API/SBAddress.h"
-#include "lldb/API/SBFrame.h"
-// DONT THINK THIS IS NECESSARY: #include "lldb/API/SBSourceManager.h"
#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBFrame.h"
#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBValue.h"
using namespace lldb;
using namespace lldb_private;
@@ -316,6 +316,30 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
return 0;
}
+SBValue
+SBThread::GetStopReturnValue ()
+{
+ ValueObjectSP return_valobj_sp;
+ if (m_opaque_sp)
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetProcess().GetTarget().GetAPIMutex());
+ StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo ();
+ if (stop_info_sp)
+ {
+ return_valobj_sp = StopInfo::GetReturnValueObject (stop_info_sp);
+ }
+ }
+
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf ("SBThread(%p)::GetStopReturnValue () => %s", m_opaque_sp.get(),
+ return_valobj_sp.get()
+ ? return_valobj_sp->GetValueAsCString()
+ : "<no return value>");
+
+ return SBValue (return_valobj_sp);
+}
+
void
SBThread::SetThread (const ThreadSP& lldb_object_sp)
{
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index c9f78e2cf1f..daaeea089ca 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -380,7 +380,7 @@ SBValue::CreateValueFromExpression (const char *name, const char* expression)
{
ValueObjectSP result_valobj_sp;
m_opaque_sp->GetUpdatePoint().GetTargetSP()->EvaluateExpression (expression,
- m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateStackFrame(),
+ m_opaque_sp->GetExecutionContextScope()->CalculateStackFrame(),
eExecutionPolicyOnlyWhenNeeded,
true, // unwind on error
true, // keep in memory
@@ -410,7 +410,7 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType t
lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
- ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (m_opaque_sp->GetUpdatePoint().GetExecutionContextScope(),
+ ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (m_opaque_sp->GetExecutionContextScope(),
real_type.m_opaque_sp->GetASTContext(),
real_type.m_opaque_sp->GetOpaqueQualType(),
ConstString(name),
@@ -871,9 +871,9 @@ SBValue::GetThread()
SBThread result;
if (m_opaque_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetExecutionContextScope())
+ if (m_opaque_sp->GetExecutionContextScope())
{
- result = SBThread(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateThread()->GetSP());
+ result = SBThread(m_opaque_sp->GetExecutionContextScope()->CalculateThread()->GetSP());
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -893,9 +893,9 @@ SBValue::GetFrame()
SBFrame result;
if (m_opaque_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetExecutionContextScope())
+ if (m_opaque_sp->GetExecutionContextScope())
{
- result.SetFrame (m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateStackFrame()->GetSP());
+ result.SetFrame (m_opaque_sp->GetExecutionContextScope()->CalculateStackFrame()->GetSP());
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
OpenPOWER on IntegriCloud