Adding formatters for several useful Objective-C/Cocoa data types. The new categories are not enabled at startup, but can be manually activated if desired.
Adding new API calls to SBValue to be able to retrieve the associated formatters
Some refactoring to FormatNavigator::Get() in order to shrink its size down to more manageable terms (a future, massive, refactoring effort will still be needed)
Test cases added for the above
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@150784 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index 2369d6b..7eb56a8 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -8,10 +8,16 @@
//===----------------------------------------------------------------------===//
#include "lldb/API/SBValue.h"
+
#include "lldb/API/SBStream.h"
+#include "lldb/API/SBTypeFilter.h"
+#include "lldb/API/SBTypeFormat.h"
+#include "lldb/API/SBTypeSummary.h"
+#include "lldb/API/SBTypeSynthetic.h"
#include "lldb/Breakpoint/Watchpoint.h"
#include "lldb/Core/DataExtractor.h"
+#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Scalar.h"
@@ -371,6 +377,86 @@
return success;
}
+lldb::SBTypeFormat
+SBValue::GetTypeFormat ()
+{
+ lldb::SBTypeFormat format;
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
+ {
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ if (value_sp->UpdateValueIfNeeded(true))
+ {
+ lldb::TypeFormatImplSP format_sp = value_sp->GetValueFormat();
+ if (format_sp)
+ format.SetSP(format_sp);
+ }
+ }
+ return format;
+}
+
+lldb::SBTypeSummary
+SBValue::GetTypeSummary ()
+{
+ lldb::SBTypeSummary summary;
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
+ {
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ if (value_sp->UpdateValueIfNeeded(true))
+ {
+ lldb::TypeSummaryImplSP summary_sp = value_sp->GetSummaryFormat();
+ if (summary_sp)
+ summary.SetSP(summary_sp);
+ }
+ }
+ return summary;
+}
+
+lldb::SBTypeFilter
+SBValue::GetTypeFilter ()
+{
+ lldb::SBTypeFilter filter;
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
+ {
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ if (value_sp->UpdateValueIfNeeded(true))
+ {
+ lldb::SyntheticChildrenSP synthetic_sp = value_sp->GetSyntheticChildren();
+
+ if (synthetic_sp && !synthetic_sp->IsScripted())
+ {
+ TypeFilterImplSP filter_sp = std::tr1::static_pointer_cast<TypeFilterImpl>(synthetic_sp);
+ filter.SetSP(filter_sp);
+ }
+ }
+ }
+ return filter;
+}
+
+lldb::SBTypeSynthetic
+SBValue::GetTypeSynthetic ()
+{
+ lldb::SBTypeSynthetic synthetic;
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
+ {
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ if (value_sp->UpdateValueIfNeeded(true))
+ {
+ lldb::SyntheticChildrenSP children_sp = value_sp->GetSyntheticChildren();
+
+ if (children_sp && children_sp->IsScripted())
+ {
+ TypeSyntheticImplSP synth_sp = std::tr1::static_pointer_cast<TypeSyntheticImpl>(children_sp);
+ synthetic.SetSP(synth_sp);
+ }
+ }
+ }
+ return synthetic;
+}
+
lldb::SBValue
SBValue::CreateChildAtOffset (const char *name, uint32_t offset, SBType type)
{