summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/ValueObject.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2010-09-10 23:12:17 +0000
committerJim Ingham <jingham@apple.com>2010-09-10 23:12:17 +0000
commit53c47f1e2f61c5ab5060970e49fc5dfc3cdaac9f (patch)
tree97b684cb5064d6b325eaaa5d6d9ea9b720087b88 /lldb/source/Core/ValueObject.cpp
parentcc766a20d35a336802f0c7ba344956b90d1f715d (diff)
downloadbcm5719-llvm-53c47f1e2f61c5ab5060970e49fc5dfc3cdaac9f.tar.gz
bcm5719-llvm-53c47f1e2f61c5ab5060970e49fc5dfc3cdaac9f.zip
Move the "Object Description" into the ValueObject, and the add an API to
SBValue to access it. For now this is just the result of ObjC NSPrintForDebugger, but could be extended. Also store the results of the ObjC Object Printer in a Stream, not a ConstString. llvm-svn: 113660
Diffstat (limited to 'lldb/source/Core/ValueObject.cpp')
-rw-r--r--lldb/source/Core/ValueObject.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index e14875b10d6..c822e325b69 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -24,6 +24,7 @@
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/Type.h"
+#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Thread.h"
@@ -48,6 +49,7 @@ ValueObject::ValueObject () :
m_old_value_str (),
m_location_str (),
m_summary_str (),
+ m_object_desc_str (),
m_children (),
m_synthetic_children (),
m_value_is_valid (false),
@@ -96,6 +98,7 @@ ValueObject::UpdateValueIfNeeded (ExecutionContextScope *exe_scope)
}
m_location_str.clear();
m_summary_str.clear();
+ m_object_desc_str.clear();
const bool value_was_valid = GetValueIsValid();
SetValueDidChange (false);
@@ -499,6 +502,48 @@ ValueObject::GetSummaryAsCString (ExecutionContextScope *exe_scope)
return m_summary_str.c_str();
}
+const char *
+ValueObject::GetObjectDescription (ExecutionContextScope *exe_scope)
+{
+ if (!m_object_desc_str.empty())
+ return m_object_desc_str.c_str();
+
+ if (!ClangASTContext::IsPointerType (GetOpaqueClangQualType()))
+ return NULL;
+
+ if (!GetValueIsValid())
+ return NULL;
+
+ Process *process = exe_scope->CalculateProcess();
+
+ if (!process)
+ return NULL;
+
+ Scalar scalar;
+
+ if (!ClangASTType::GetValueAsScalar (GetClangAST(),
+ GetOpaqueClangQualType(),
+ GetDataExtractor(),
+ 0,
+ GetByteSize(),
+ scalar))
+ return NULL;
+
+ ExecutionContext exe_ctx;
+ exe_scope->Calculate(exe_ctx);
+
+ Value val(scalar);
+ val.SetContext(Value::eContextTypeOpaqueClangQualType,
+ ClangASTContext::GetVoidPtrType(GetClangAST(), false));
+
+ StreamString s;
+ // FIXME: Check the runtime this object belongs to and get the appropriate object printer for the object kind.
+ if (process->GetObjCObjectPrinter().PrintObject(s, val, exe_ctx))
+ {
+ m_object_desc_str.append (s.GetData());
+ }
+ return m_object_desc_str.c_str();
+}
const char *
ValueObject::GetValueAsCString (ExecutionContextScope *exe_scope)
OpenPOWER on IntegriCloud