summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2013-01-28 23:47:25 +0000
committerEnrico Granata <egranata@apple.com>2013-01-28 23:47:25 +0000
commit5548cb50b20c97f8615f48785cb0951b430136a0 (patch)
treeafcf2917d66215a9710874657c4b1c256c543527 /lldb/source
parente233fbfc16fee2718290d159f6f7bab67ef2e15a (diff)
downloadbcm5719-llvm-5548cb50b20c97f8615f48785cb0951b430136a0.tar.gz
bcm5719-llvm-5548cb50b20c97f8615f48785cb0951b430136a0.zip
<rdar://problem/12978143>
Data formatters now cache themselves. This commit provides a new formatter cache mechanism. Upon resolving a formatter (summary or synthetic), LLDB remembers the resolution for later faster retrieval. Also moved the data formatters subsystem from the core to its own group and folder for easier management, and done some code reorganization. The ObjC runtime v1 now returns a class name if asked for the dynamic type of an object. This is required for formatters caching to work with the v1 runtime. Lastly, this commit disposes of the old hack where ValueObjects had to remember whether they were queried for formatters with their static or dynamic type. Now the ValueObjectDynamicValue class works well enough that we can use its dynamic value setting for the same purpose. llvm-svn: 173728
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/API/SBDebugger.cpp2
-rw-r--r--lldb/source/API/SBTypeCategory.cpp6
-rw-r--r--lldb/source/API/SBTypeFilter.cpp2
-rw-r--r--lldb/source/API/SBTypeFormat.cpp2
-rw-r--r--lldb/source/API/SBTypeNameSpecifier.cpp2
-rw-r--r--lldb/source/API/SBTypeSummary.cpp2
-rw-r--r--lldb/source/API/SBTypeSynthetic.cpp14
-rw-r--r--lldb/source/API/SBValue.cpp4
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectType.cpp26
-rw-r--r--lldb/source/Core/Debugger.cpp4
-rw-r--r--lldb/source/Core/Timer.cpp18
-rw-r--r--lldb/source/Core/ValueObject.cpp65
-rw-r--r--lldb/source/Core/ValueObjectDynamicValue.cpp1
-rw-r--r--lldb/source/Core/ValueObjectSyntheticFilter.cpp20
-rw-r--r--lldb/source/DataFormatters/CXXFormatterFunctions.cpp (renamed from lldb/source/Core/CXXFormatterFunctions.cpp)14
-rw-r--r--lldb/source/DataFormatters/DataVisualization.cpp (renamed from lldb/source/Core/DataVisualization.cpp)16
-rw-r--r--lldb/source/DataFormatters/FormatCache.cpp163
-rw-r--r--lldb/source/DataFormatters/FormatClasses.cpp33
-rw-r--r--lldb/source/DataFormatters/FormatManager.cpp (renamed from lldb/source/Core/FormatManager.cpp)560
-rw-r--r--lldb/source/DataFormatters/TypeCategory.cpp378
-rw-r--r--lldb/source/DataFormatters/TypeCategoryMap.cpp283
-rw-r--r--lldb/source/DataFormatters/TypeFormat.cpp50
-rw-r--r--lldb/source/DataFormatters/TypeSummary.cpp (renamed from lldb/source/Core/FormatClasses.cpp)250
-rw-r--r--lldb/source/DataFormatters/TypeSynthetic.cpp112
-rw-r--r--lldb/source/Interpreter/Args.cpp2
-rw-r--r--lldb/source/Interpreter/CommandObjectScript.cpp7
-rw-r--r--lldb/source/Interpreter/OptionGroupVariable.cpp4
-rw-r--r--lldb/source/Interpreter/OptionValueArch.cpp2
-rw-r--r--lldb/source/Interpreter/OptionValueDictionary.cpp2
-rw-r--r--lldb/source/Interpreter/OptionValueFileSpec.cpp2
-rw-r--r--lldb/source/Interpreter/OptionValueFormat.cpp2
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp15
33 files changed, 1309 insertions, 756 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index a7492450d8e..4cee580e31b 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -35,9 +35,9 @@
#include "lldb/API/SBTypeSynthetic.h"
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/State.h"
+#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/OptionGroupPlatform.h"
diff --git a/lldb/source/API/SBTypeCategory.cpp b/lldb/source/API/SBTypeCategory.cpp
index f9c18854935..03b02fababa 100644
--- a/lldb/source/API/SBTypeCategory.cpp
+++ b/lldb/source/API/SBTypeCategory.cpp
@@ -18,8 +18,8 @@
#include "lldb/API/SBTypeNameSpecifier.h"
#include "lldb/API/SBStream.h"
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Debugger.h"
+#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
@@ -233,7 +233,7 @@ SBTypeCategory::GetSyntheticForType (SBTypeNameSpecifier spec)
if (!children_sp)
return lldb::SBTypeSynthetic();
- TypeSyntheticImplSP synth_sp = STD_STATIC_POINTER_CAST(TypeSyntheticImpl,children_sp);
+ ScriptedSyntheticChildrenSP synth_sp = STD_STATIC_POINTER_CAST(ScriptedSyntheticChildren,children_sp);
return lldb::SBTypeSynthetic(synth_sp);
}
@@ -285,7 +285,7 @@ SBTypeCategory::GetSyntheticAtIndex (uint32_t index)
if (!children_sp.get())
return lldb::SBTypeSynthetic();
- TypeSyntheticImplSP synth_sp = STD_STATIC_POINTER_CAST(TypeSyntheticImpl,children_sp);
+ ScriptedSyntheticChildrenSP synth_sp = STD_STATIC_POINTER_CAST(ScriptedSyntheticChildren,children_sp);
return lldb::SBTypeSynthetic(synth_sp);
}
diff --git a/lldb/source/API/SBTypeFilter.cpp b/lldb/source/API/SBTypeFilter.cpp
index 30be1ca535a..605e92de699 100644
--- a/lldb/source/API/SBTypeFilter.cpp
+++ b/lldb/source/API/SBTypeFilter.cpp
@@ -13,7 +13,7 @@
#include "lldb/API/SBStream.h"
-#include "lldb/Core/DataVisualization.h"
+#include "lldb/DataFormatters/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/API/SBTypeFormat.cpp b/lldb/source/API/SBTypeFormat.cpp
index b222fe9c646..34ab404a206 100644
--- a/lldb/source/API/SBTypeFormat.cpp
+++ b/lldb/source/API/SBTypeFormat.cpp
@@ -13,7 +13,7 @@
#include "lldb/API/SBStream.h"
-#include "lldb/Core/DataVisualization.h"
+#include "lldb/DataFormatters/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/API/SBTypeNameSpecifier.cpp b/lldb/source/API/SBTypeNameSpecifier.cpp
index eac906a8bdd..d417499ecbd 100644
--- a/lldb/source/API/SBTypeNameSpecifier.cpp
+++ b/lldb/source/API/SBTypeNameSpecifier.cpp
@@ -14,7 +14,7 @@
#include "lldb/API/SBStream.h"
#include "lldb/API/SBType.h"
-#include "lldb/Core/DataVisualization.h"
+#include "lldb/DataFormatters/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/API/SBTypeSummary.cpp b/lldb/source/API/SBTypeSummary.cpp
index df219a696ca..aaa09c289cb 100644
--- a/lldb/source/API/SBTypeSummary.cpp
+++ b/lldb/source/API/SBTypeSummary.cpp
@@ -13,7 +13,7 @@
#include "lldb/API/SBStream.h"
-#include "lldb/Core/DataVisualization.h"
+#include "lldb/DataFormatters/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/API/SBTypeSynthetic.cpp b/lldb/source/API/SBTypeSynthetic.cpp
index 2d69f0b09eb..e8c167b762a 100644
--- a/lldb/source/API/SBTypeSynthetic.cpp
+++ b/lldb/source/API/SBTypeSynthetic.cpp
@@ -13,7 +13,7 @@
#include "lldb/API/SBStream.h"
-#include "lldb/Core/DataVisualization.h"
+#include "lldb/DataFormatters/DataVisualization.h"
using namespace lldb;
using namespace lldb_private;
@@ -30,7 +30,7 @@ SBTypeSynthetic::CreateWithClassName (const char* data, uint32_t options)
{
if (!data || data[0] == 0)
return SBTypeSynthetic();
- return SBTypeSynthetic(TypeSyntheticImplSP(new TypeSyntheticImpl(options, data, "")));
+ return SBTypeSynthetic(ScriptedSyntheticChildrenSP(new ScriptedSyntheticChildren(options, data, "")));
}
SBTypeSynthetic
@@ -38,7 +38,7 @@ SBTypeSynthetic::CreateWithScriptCode (const char* data, uint32_t options)
{
if (!data || data[0] == 0)
return SBTypeSynthetic();
- return SBTypeSynthetic(TypeSyntheticImplSP(new TypeSyntheticImpl(options, "", data)));
+ return SBTypeSynthetic(ScriptedSyntheticChildrenSP(new ScriptedSyntheticChildren(options, "", data)));
}
SBTypeSynthetic::SBTypeSynthetic (const lldb::SBTypeSynthetic &rhs) :
@@ -172,19 +172,19 @@ SBTypeSynthetic::operator != (lldb::SBTypeSynthetic &rhs)
return m_opaque_sp != rhs.m_opaque_sp;
}
-lldb::TypeSyntheticImplSP
+lldb::ScriptedSyntheticChildrenSP
SBTypeSynthetic::GetSP ()
{
return m_opaque_sp;
}
void
-SBTypeSynthetic::SetSP (const lldb::TypeSyntheticImplSP &TypeSynthetic_impl_sp)
+SBTypeSynthetic::SetSP (const lldb::ScriptedSyntheticChildrenSP &TypeSynthetic_impl_sp)
{
m_opaque_sp = TypeSynthetic_impl_sp;
}
-SBTypeSynthetic::SBTypeSynthetic (const lldb::TypeSyntheticImplSP &TypeSynthetic_impl_sp) :
+SBTypeSynthetic::SBTypeSynthetic (const lldb::ScriptedSyntheticChildrenSP &TypeSynthetic_impl_sp) :
m_opaque_sp(TypeSynthetic_impl_sp)
{
}
@@ -197,7 +197,7 @@ SBTypeSynthetic::CopyOnWrite_Impl()
if (m_opaque_sp.unique())
return true;
- TypeSyntheticImplSP new_sp(new TypeSyntheticImpl(m_opaque_sp->GetOptions(),
+ ScriptedSyntheticChildrenSP new_sp(new ScriptedSyntheticChildren(m_opaque_sp->GetOptions(),
m_opaque_sp->GetPythonClassName(),
m_opaque_sp->GetPythonCode()));
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index dffd34c920b..d3a34685b79 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -20,7 +20,6 @@
#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"
@@ -30,6 +29,7 @@
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/Declaration.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -740,7 +740,7 @@ SBValue::GetTypeSynthetic ()
if (children_sp && children_sp->IsScripted())
{
- TypeSyntheticImplSP synth_sp = STD_STATIC_POINTER_CAST(TypeSyntheticImpl,children_sp);
+ ScriptedSyntheticChildrenSP synth_sp = STD_STATIC_POINTER_CAST(ScriptedSyntheticChildren,children_sp);
synthetic.SetSP(synth_sp);
}
}
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 266753b641a..6c3b2457e0c 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -16,7 +16,6 @@
#include <string>
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/StreamFile.h"
@@ -25,6 +24,7 @@
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectVariable.h"
+#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp
index 771be93814b..45f9e7c2535 100644
--- a/lldb/source/Commands/CommandObjectType.cpp
+++ b/lldb/source/Commands/CommandObjectType.cpp
@@ -17,13 +17,13 @@
// C++ Includes
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/InputReaderEZ.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StringList.h"
+#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandObject.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@@ -1961,7 +1961,7 @@ protected:
if (argc == 1 && strcmp(command.GetArgumentAtIndex(0),"*") == 0)
{
// we want to make sure to enable "system" last and "default" first
- DataVisualization::Categories::Enable(ConstString("default"), CategoryMap::First);
+ DataVisualization::Categories::Enable(ConstString("default"), TypeCategoryMap::First);
uint32_t num_categories = DataVisualization::Categories::GetCount();
for (uint32_t i = 0; i < num_categories; i++)
{
@@ -1972,10 +1972,10 @@ protected:
::strcmp(category_sp->GetName(), "default") == 0 )
continue;
else
- DataVisualization::Categories::Enable(category_sp, CategoryMap::Default);
+ DataVisualization::Categories::Enable(category_sp, TypeCategoryMap::Default);
}
}
- DataVisualization::Categories::Enable(ConstString("system"), CategoryMap::Last);
+ DataVisualization::Categories::Enable(ConstString("system"), TypeCategoryMap::Last);
}
else
{
@@ -3385,10 +3385,10 @@ public:
// everything should be fine now, let's add the synth provider class
SyntheticChildrenSP synth_provider;
- synth_provider.reset(new TypeSyntheticImpl(SyntheticChildren::Flags().SetCascades(options->m_cascade).
- SetSkipPointers(options->m_skip_pointers).
- SetSkipReferences(options->m_skip_references),
- class_name_str.c_str()));
+ synth_provider.reset(new ScriptedSyntheticChildren(SyntheticChildren::Flags().SetCascades(options->m_cascade).
+ SetSkipPointers(options->m_skip_pointers).
+ SetSkipReferences(options->m_skip_references),
+ class_name_str.c_str()));
lldb::TypeCategoryImplSP category;
@@ -3504,11 +3504,11 @@ CommandObjectTypeSynthAdd::Execute_PythonClass (Args& command, CommandReturnObje
SyntheticChildrenSP entry;
- TypeSyntheticImpl* impl = new TypeSyntheticImpl(SyntheticChildren::Flags().
- SetCascades(m_options.m_cascade).
- SetSkipPointers(m_options.m_skip_pointers).
- SetSkipReferences(m_options.m_skip_references),
- m_options.m_class_name.c_str());
+ ScriptedSyntheticChildren* impl = new ScriptedSyntheticChildren(SyntheticChildren::Flags().
+ SetCascades(m_options.m_cascade).
+ SetSkipPointers(m_options.m_skip_pointers).
+ SetSkipReferences(m_options.m_skip_references),
+ m_options.m_class_name.c_str());
entry.reset(impl);
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index e7e0e203f4d..7617914c24f 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -20,8 +20,6 @@
#include "lldb/lldb-private.h"
#include "lldb/Core/ConnectionFileDescriptor.h"
-#include "lldb/Core/DataVisualization.h"
-#include "lldb/Core/FormatManager.h"
#include "lldb/Core/InputReader.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
@@ -33,6 +31,8 @@
#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectVariable.h"
+#include "lldb/DataFormatters/DataVisualization.h"
+#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Host/DynamicLibrary.h"
#include "lldb/Host/Terminal.h"
#include "lldb/Interpreter/CommandInterpreter.h"
diff --git a/lldb/source/Core/Timer.cpp b/lldb/source/Core/Timer.cpp
index a5747ce17f4..b1416bdaf62 100644
--- a/lldb/source/Core/Timer.cpp
+++ b/lldb/source/Core/Timer.cpp
@@ -25,7 +25,7 @@ uint32_t Timer::g_depth = 0;
uint32_t Timer::g_display_depth = 0;
FILE * Timer::g_file = NULL;
typedef std::vector<Timer *> TimerStack;
-typedef std::map<const char *, uint64_t> CategoryMap;
+typedef std::map<const char *, uint64_t> TimerCategoryMap;
static pthread_key_t g_key;
static Mutex &
@@ -35,10 +35,10 @@ GetCategoryMutex()
return g_category_mutex;
}
-static CategoryMap &
+static TimerCategoryMap &
GetCategoryMap()
{
- static CategoryMap g_category_map;
+ static TimerCategoryMap g_category_map;
return g_category_map;
}
@@ -153,7 +153,7 @@ Timer::~Timer()
// Keep total results for each category so we can dump results.
Mutex::Locker locker (GetCategoryMutex());
- CategoryMap &category_map = GetCategoryMap();
+ TimerCategoryMap &category_map = GetCategoryMap();
category_map[m_category] += timer_nsec_uint;
}
if (g_depth > 0)
@@ -214,7 +214,7 @@ Timer::SetDisplayDepth (uint32_t depth)
* - returns whether a person is less than another person
*/
static bool
-CategoryMapIteratorSortCriterion (const CategoryMap::const_iterator& lhs, const CategoryMap::const_iterator& rhs)
+CategoryMapIteratorSortCriterion (const TimerCategoryMap::const_iterator& lhs, const TimerCategoryMap::const_iterator& rhs)
{
return lhs->second > rhs->second;
}
@@ -224,7 +224,7 @@ void
Timer::ResetCategoryTimes ()
{
Mutex::Locker locker (GetCategoryMutex());
- CategoryMap &category_map = GetCategoryMap();
+ TimerCategoryMap &category_map = GetCategoryMap();
category_map.clear();
}
@@ -232,9 +232,9 @@ void
Timer::DumpCategoryTimes (Stream *s)
{
Mutex::Locker locker (GetCategoryMutex());
- CategoryMap &category_map = GetCategoryMap();
- std::vector<CategoryMap::const_iterator> sorted_iterators;
- CategoryMap::const_iterator pos, end = category_map.end();
+ TimerCategoryMap &category_map = GetCategoryMap();
+ std::vector<TimerCategoryMap::const_iterator> sorted_iterators;
+ TimerCategoryMap::const_iterator pos, end = category_map.end();
for (pos = category_map.begin(); pos != end; ++pos)
{
sorted_iterators.push_back (pos);
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 5ea8e7d6b8d..b9a0a13b904 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -21,7 +21,6 @@
// Project includes
#include "lldb/Core/DataBufferHeap.h"
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
@@ -34,6 +33,8 @@
#include "lldb/Core/ValueObjectMemory.h"
#include "lldb/Core/ValueObjectSyntheticFilter.h"
+#include "lldb/DataFormatters/DataVisualization.h"
+
#include "lldb/Host/Endian.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -83,7 +84,6 @@ ValueObject::ValueObject (ValueObject &parent) :
m_deref_valobj(NULL),
m_format (eFormatDefault),
m_last_format_mgr_revision(0),
- m_last_format_mgr_dynamic(parent.m_last_format_mgr_dynamic),
m_type_summary_sp(),
m_type_format_sp(),
m_synthetic_children_sp(),
@@ -129,7 +129,6 @@ ValueObject::ValueObject (ExecutionContextScope *exe_scope,
m_deref_valobj(NULL),
m_format (eFormatDefault),
m_last_format_mgr_revision(0),
- m_last_format_mgr_dynamic(eNoDynamicValues),
m_type_summary_sp(),
m_type_format_sp(),
m_synthetic_children_sp(),
@@ -161,17 +160,11 @@ ValueObject::~ValueObject ()
bool
ValueObject::UpdateValueIfNeeded (bool update_format)
{
- return UpdateValueIfNeeded(m_last_format_mgr_dynamic, update_format);
-}
-
-bool
-ValueObject::UpdateValueIfNeeded (DynamicValueType use_dynamic, bool update_format)
-{
bool did_change_formats = false;
if (update_format)
- did_change_formats = UpdateFormatsIfNeeded(use_dynamic);
+ did_change_formats = UpdateFormatsIfNeeded();
// If this is a constant value, then our success is predicated on whether
// we have an error or not
@@ -238,7 +231,7 @@ ValueObject::UpdateValueIfNeeded (DynamicValueType use_dynamic, bool update_form
}
bool
-ValueObject::UpdateFormatsIfNeeded(DynamicValueType use_dynamic)
+ValueObject::UpdateFormatsIfNeeded()
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
if (log)
@@ -250,17 +243,15 @@ ValueObject::UpdateFormatsIfNeeded(DynamicValueType use_dynamic)
bool any_change = false;
- if ( (m_last_format_mgr_revision != DataVisualization::GetCurrentRevision()) ||
- m_last_format_mgr_dynamic != use_dynamic)
+ if ( (m_last_format_mgr_revision != DataVisualization::GetCurrentRevision()))
{
SetValueFormat(DataVisualization::ValueFormats::GetFormat (*this, eNoDynamicValues));
- SetSummaryFormat(DataVisualization::GetSummaryFormat (*this, use_dynamic));
+ SetSummaryFormat(DataVisualization::GetSummaryFormat (*this, GetDynamicValueType()));
#ifndef LLDB_DISABLE_PYTHON
- SetSyntheticChildren(DataVisualization::GetSyntheticChildren (*this, use_dynamic));
+ SetSyntheticChildren(DataVisualization::GetSyntheticChildren (*this, GetDynamicValueType()));
#endif
m_last_format_mgr_revision = DataVisualization::GetCurrentRevision();
- m_last_format_mgr_dynamic = use_dynamic;
any_change = true;
}
@@ -2033,42 +2024,6 @@ ValueObject::GetSyntheticBitFieldChild (uint32_t from, uint32_t to, bool can_cre
}
ValueObjectSP
-ValueObject::GetSyntheticArrayRangeChild (uint32_t from, uint32_t to, bool can_create)
-{
- ValueObjectSP synthetic_child_sp;
- if (IsArrayType () || IsPointerType ())
- {
- char index_str[64];
- snprintf(index_str, sizeof(index_str), "[%i-%i]", from, to);
- ConstString index_const_str(index_str);
- // Check if we have already created a synthetic array member in this
- // valid object. If we have we will re-use it.
- synthetic_child_sp = GetSyntheticChild (index_const_str);
- if (!synthetic_child_sp)
- {
- ValueObjectSynthetic *synthetic_child;
-
- // We haven't made a synthetic array member for INDEX yet, so
- // lets make one and cache it for any future reference.
- SyntheticArrayView *view = new SyntheticArrayView(SyntheticChildren::Flags());
- view->AddRange(from,to);
- SyntheticChildrenSP view_sp(view);
- synthetic_child = new ValueObjectSynthetic(*this, view_sp);
-
- // Cache the value if we got one back...
- if (synthetic_child)
- {
- AddSyntheticChild(index_const_str, synthetic_child);
- synthetic_child_sp = synthetic_child->GetSP();
- synthetic_child_sp->SetName(ConstString(index_str));
- synthetic_child_sp->m_is_bitfield_for_scalar = true;
- }
- }
- }
- return synthetic_child_sp;
-}
-
-ValueObjectSP
ValueObject::GetSyntheticChildAtOffset(uint32_t offset, const ClangASTType& type, bool can_create)
{
@@ -2168,7 +2123,7 @@ ValueObject::CalculateSyntheticValue (bool use_synthetic)
lldb::SyntheticChildrenSP current_synth_sp(m_synthetic_children_sp);
- if (!UpdateFormatsIfNeeded(m_last_format_mgr_dynamic) && m_synthetic_value)
+ if (!UpdateFormatsIfNeeded() && m_synthetic_value)
return;
if (m_synthetic_children_sp.get() == NULL)
@@ -2243,7 +2198,7 @@ ValueObject::GetSyntheticValue (bool use_synthetic)
bool
ValueObject::HasSyntheticValue()
{
- UpdateFormatsIfNeeded(m_last_format_mgr_dynamic);
+ UpdateFormatsIfNeeded();
if (m_synthetic_children_sp.get() == NULL)
return false;
@@ -3285,7 +3240,7 @@ DumpValueObject_Impl (Stream &s,
{
if (valobj)
{
- bool update_success = valobj->UpdateValueIfNeeded (options.m_use_dynamic, true);
+ bool update_success = valobj->UpdateValueIfNeeded (true);
const char *root_valobj_name =
options.m_root_valobj_name.empty() ?
diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp
index 1af293660fc..06a7eedc349 100644
--- a/lldb/source/Core/ValueObjectDynamicValue.cpp
+++ b/lldb/source/Core/ValueObjectDynamicValue.cpp
@@ -41,7 +41,6 @@ ValueObjectDynamicValue::ValueObjectDynamicValue (ValueObject &parent, lldb::Dyn
m_dynamic_type_info(),
m_use_dynamic (use_dynamic)
{
- m_last_format_mgr_dynamic = use_dynamic;
SetName (parent.GetName());
}
diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp
index 8ca0ea99111..cb3fcfef1b8 100644
--- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp
+++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp
@@ -15,8 +15,8 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/FormatClasses.h"
#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormatClasses.h"
using namespace lldb_private;
@@ -39,7 +39,7 @@ public:
return lldb::ValueObjectSP();
}
- uint32_t
+ size_t
GetIndexOfChildWithName (const ConstString &name)
{
return UINT32_MAX;
@@ -95,6 +95,12 @@ ValueObjectSynthetic::GetTypeName()
return m_parent->GetTypeName();
}
+ConstString
+ValueObjectSynthetic::GetQualifiedTypeName()
+{
+ return m_parent->GetQualifiedTypeName();
+}
+
size_t
ValueObjectSynthetic::CalculateNumChildren()
{
@@ -104,6 +110,16 @@ ValueObjectSynthetic::CalculateNumChildren()
return (m_synthetic_children_count = m_synth_filter_ap->CalculateNumChildren());
}
+lldb::ValueObjectSP
+ValueObjectSynthetic::GetDynamicValue (lldb::DynamicValueType valueType)
+{
+ if (!m_parent)
+ return lldb::ValueObjectSP();
+ if (m_parent->IsDynamic() && m_parent->GetDynamicValueType() == valueType)
+ return m_parent->GetSP();
+ return ValueObject::GetDynamicValue(valueType);
+}
+
bool
ValueObjectSynthetic::MightHaveChildren()
{
diff --git a/lldb/source/Core/CXXFormatterFunctions.cpp b/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
index 81e72e5418c..a3819025128 100644
--- a/lldb/source/Core/CXXFormatterFunctions.cpp
+++ b/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
@@ -9,7 +9,7 @@
#include "lldb/lldb-python.h"
-#include "lldb/Core/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/CXXFormatterFunctions.h"
// needed to get ConvertUTF16/32ToUTF8
#define CLANG_NEEDS_THESE_ONE_DAY
@@ -1192,7 +1192,7 @@ ExtractIndexFromString (const char* item_name)
return idx;
}
-uint32_t
+size_t
lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
{
if (!m_data_32 && !m_data_64)
@@ -1230,7 +1230,7 @@ lldb_private::formatters::NSArrayISyntheticFrontEnd::~NSArrayISyntheticFrontEnd
{
}
-uint32_t
+size_t
lldb_private::formatters::NSArrayISyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
{
const char* item_name = name.GetCString();
@@ -1385,7 +1385,7 @@ lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::MightHaveChildren
return true;
}
-uint32_t
+size_t
lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
{
return 0;
@@ -1482,7 +1482,7 @@ lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::MightHaveChi
return true;
}
-uint32_t
+size_t
lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
{
return 0;
@@ -1510,7 +1510,7 @@ lldb_private::formatters::NSDictionaryISyntheticFrontEnd::~NSDictionaryISyntheti
m_data_64 = NULL;
}
-uint32_t
+size_t
lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
{
const char* item_name = name.GetCString();
@@ -1658,7 +1658,7 @@ lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::~NSDictionaryMSyntheti
m_data_64 = NULL;
}
-uint32_t
+size_t
lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
{
const char* item_name = name.GetCString();
diff --git a/lldb/source/Core/DataVisualization.cpp b/lldb/source/DataFormatters/DataVisualization.cpp
index cef3e04aa71..c1ef359049b 100644
--- a/lldb/source/Core/DataVisualization.cpp
+++ b/lldb/source/DataFormatters/DataVisualization.cpp
@@ -9,7 +9,7 @@
#include "lldb/lldb-python.h"
-#include "lldb/Core/DataVisualization.h"
+#include "lldb/DataFormatters/DataVisualization.h"
// C Includes
// C++ Includes
@@ -80,20 +80,20 @@ DataVisualization::ValueFormats::LoopThrough (TypeFormatImpl::ValueCallback call
GetFormatManager().GetValueNavigator().LoopThrough(callback, callback_baton);
}
-uint32_t
+size_t
DataVisualization::ValueFormats::GetCount ()
{
return GetFormatManager().GetValueNavigator().GetCount();
}
lldb::TypeNameSpecifierImplSP
-DataVisualization::ValueFormats::GetTypeNameSpecifierForFormatAtIndex (uint32_t index)
+DataVisualization::ValueFormats::GetTypeNameSpecifierForFormatAtIndex (size_t index)
{
return GetFormatManager().GetValueNavigator().GetTypeNameSpecifierAtIndex(index);
}
lldb::TypeFormatImplSP
-DataVisualization::ValueFormats::GetFormatAtIndex (uint32_t index)
+DataVisualization::ValueFormats::GetFormatAtIndex (size_t index)
{
return GetFormatManager().GetValueNavigator().GetAtIndex(index);
}
@@ -135,7 +135,7 @@ DataVisualization::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
}
#ifndef LLDB_DISABLE_PYTHON
-lldb::TypeSyntheticImplSP
+lldb::ScriptedSyntheticChildrenSP
DataVisualization::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
{
return GetFormatManager().GetSyntheticForType(type_sp);
@@ -191,7 +191,7 @@ DataVisualization::Categories::Clear (const ConstString &category)
void
DataVisualization::Categories::Enable (const ConstString& category,
- CategoryMap::Position pos)
+ TypeCategoryMap::Position pos)
{
if (GetFormatManager().GetCategory(category)->IsEnabled())
GetFormatManager().DisableCategory(category);
@@ -207,7 +207,7 @@ DataVisualization::Categories::Disable (const ConstString& category)
void
DataVisualization::Categories::Enable (const lldb::TypeCategoryImplSP& category,
- CategoryMap::Position pos)
+ TypeCategoryMap::Position pos)
{
if (category.get())
{
@@ -237,7 +237,7 @@ DataVisualization::Categories::GetCount ()
}
lldb::TypeCategoryImplSP
-DataVisualization::Categories::GetCategoryAtIndex (uint32_t index)
+DataVisualization::Categories::GetCategoryAtIndex (size_t index)
{
return GetFormatManager().GetCategoryAtIndex(index);
}
diff --git a/lldb/source/DataFormatters/FormatCache.cpp b/lldb/source/DataFormatters/FormatCache.cpp
new file mode 100644
index 00000000000..8a816e42344
--- /dev/null
+++ b/lldb/source/DataFormatters/FormatCache.cpp
@@ -0,0 +1,163 @@
+//===-- FormatCache.cpp ------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// C Includes
+
+// C++ Includes
+
+// Other libraries and framework includes
+
+// Project includes
+#include "lldb/DataFormatters/FormatCache.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+FormatCache::Entry::Entry () :
+m_summary_cached(false),
+m_synthetic_cached(false),
+m_summary_sp(nullptr),
+m_synthetic_sp(nullptr)
+{}
+
+FormatCache::Entry::Entry (lldb::TypeSummaryImplSP summary_sp) : FormatCache::Entry()
+{
+ SetSummary (summary_sp);
+}
+
+FormatCache::Entry::Entry (lldb::SyntheticChildrenSP synthetic_sp) : FormatCache::Entry()
+{
+ SetSynthetic (synthetic_sp);
+}
+
+FormatCache::Entry::Entry (lldb::TypeSummaryImplSP summary_sp,lldb::SyntheticChildrenSP synthetic_sp) : FormatCache::Entry()
+{
+ SetSummary (summary_sp);
+ SetSynthetic (synthetic_sp);
+}
+
+bool
+FormatCache::Entry::IsSummaryCached ()
+{
+ return m_summary_cached;
+}
+
+bool
+FormatCache::Entry::IsSyntheticCached ()
+{
+ return m_synthetic_cached;
+}
+
+lldb::TypeSummaryImplSP
+FormatCache::Entry::GetSummary ()
+{
+ return m_summary_sp;
+}
+
+lldb::SyntheticChildrenSP
+FormatCache::Entry::GetSynthetic ()
+{
+ return m_synthetic_sp;
+}
+
+void
+FormatCache::Entry::SetSummary (lldb::TypeSummaryImplSP summary_sp)
+{
+ m_summary_cached = true;
+ m_summary_sp = summary_sp;
+}
+
+void
+FormatCache::Entry::SetSynthetic (lldb::SyntheticChildrenSP synthetic_sp)
+{
+ m_synthetic_cached = true;
+ m_synthetic_sp = synthetic_sp;
+}
+
+FormatCache::FormatCache () :
+m_map(),
+m_mutex (Mutex::eMutexTypeRecursive)
+#ifdef LLDB_CONFIGURATION_DEBUG
+,m_cache_hits(0),m_cache_misses(0)
+#endif
+{
+}
+
+FormatCache::Entry&
+FormatCache::GetEntry (const ConstString& type)
+{
+ auto i = m_map.find(type),
+ e = m_map.end();
+ if (i != e)
+ return i->second;
+ m_map[type] = FormatCache::Entry();
+ return m_map[type];
+}
+
+bool
+FormatCache::GetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp)
+{
+ Mutex::Locker lock(m_mutex);
+ auto entry = GetEntry(type);
+ if (entry.IsSummaryCached())
+ {
+#ifdef LLDB_CONFIGURATION_DEBUG
+ m_cache_hits++;
+#endif
+ summary_sp = entry.GetSummary();
+ return true;
+ }
+#ifdef LLDB_CONFIGURATION_DEBUG
+ m_cache_misses++;
+#endif
+ summary_sp.reset();
+ return false;
+}
+
+bool
+FormatCache::GetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp)
+{
+ Mutex::Locker lock(m_mutex);
+ auto entry = GetEntry(type);
+ if (entry.IsSyntheticCached())
+ {
+#ifdef LLDB_CONFIGURATION_DEBUG
+ m_cache_hits++;
+#endif
+ synthetic_sp = entry.GetSynthetic();
+ return true;
+ }
+#ifdef LLDB_CONFIGURATION_DEBUG
+ m_cache_misses++;
+#endif
+ synthetic_sp.reset();
+ return false;
+}
+
+void
+FormatCache::SetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp)
+{
+ Mutex::Locker lock(m_mutex);
+ GetEntry(type).SetSummary(summary_sp);
+}
+
+void
+FormatCache::SetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp)
+{
+ Mutex::Locker lock(m_mutex);
+ GetEntry(type).SetSynthetic(synthetic_sp);
+}
+
+void
+FormatCache::Clear ()
+{
+ Mutex::Locker lock(m_mutex);
+ m_map.clear();
+}
+
diff --git a/lldb/source/DataFormatters/FormatClasses.cpp b/lldb/source/DataFormatters/FormatClasses.cpp
new file mode 100644
index 00000000000..c67f86a7493
--- /dev/null
+++ b/lldb/source/DataFormatters/FormatClasses.cpp
@@ -0,0 +1,33 @@
+//===-- FormatClasses.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/lldb-python.h"
+
+// C Includes
+
+// C++ Includes
+
+// Other libraries and framework includes
+
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/Core/Timer.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Target.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
diff --git a/lldb/source/Core/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index 2a84b806124..7ea8fbb85b0 100644
--- a/lldb/source/Core/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -9,15 +9,18 @@
#include "lldb/lldb-python.h"
-#include "lldb/Core/FormatManager.h"
+#include "lldb/DataFormatters/FormatManager.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/CXXFormatterFunctions.h"
#include "lldb/Core/Debugger.h"
+#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/Interpreter/ScriptInterpreterPython.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Platform.h"
using namespace lldb;
using namespace lldb_private;
@@ -151,8 +154,6 @@ FormatManager::GetFormatAsFormatChar (lldb::Format format)
}
return '\0';
}
-
-
const char *
FormatManager::GetFormatAsCString (Format format)
@@ -162,300 +163,6 @@ FormatManager::GetFormatAsCString (Format format)
return NULL;
}
-TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener* clist,
- ConstString name) :
- m_summary_nav(new SummaryNavigator("summary",clist)),
- m_regex_summary_nav(new RegexSummaryNavigator("regex-summary",clist)),
- m_filter_nav(new FilterNavigator("filter",clist)),
- m_regex_filter_nav(new RegexFilterNavigator("regex-filter",clist)),
-#ifndef LLDB_DISABLE_PYTHON
- m_synth_nav(new SynthNavigator("synth",clist)),
- m_regex_synth_nav(new RegexSynthNavigator("regex-synth",clist)),
-#endif
- m_enabled(false),
- m_change_listener(clist),
- m_mutex(Mutex::eMutexTypeRecursive),
- m_name(name)
-{}
-
-bool
-TypeCategoryImpl::Get (ValueObject& valobj,
- lldb::TypeSummaryImplSP& entry,
- lldb::DynamicValueType use_dynamic,
- uint32_t* reason)
-{
- if (!IsEnabled())
- return false;
- if (GetSummaryNavigator()->Get(valobj, entry, use_dynamic, reason))
- return true;
- bool regex = GetRegexSummaryNavigator()->Get(valobj, entry, use_dynamic, reason);
- if (regex && reason)
- *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
- return regex;
-}
-
-bool
-TypeCategoryImpl::Get(ValueObject& valobj,
- lldb::SyntheticChildrenSP& entry_sp,
- lldb::DynamicValueType use_dynamic,
- uint32_t* reason)
-{
- if (!IsEnabled())
- return false;
- TypeFilterImpl::SharedPointer filter_sp;
- uint32_t reason_filter = 0;
- bool regex_filter = false;
- // first find both Filter and Synth, and then check which is most recent
-
- if (!GetFilterNavigator()->Get(valobj, filter_sp, use_dynamic, &reason_filter))
- regex_filter = GetRegexFilterNavigator()->Get (valobj, filter_sp, use_dynamic, &reason_filter);
-
-#ifndef LLDB_DISABLE_PYTHON
- bool regex_synth = false;
- uint32_t reason_synth = 0;
- bool pick_synth = false;
- TypeSyntheticImpl::SharedPointer synth;
- if (!GetSyntheticNavigator()->Get(valobj, synth, use_dynamic, &reason_synth))
- regex_synth = GetRegexSyntheticNavigator()->Get (valobj, synth, use_dynamic, &reason_synth);
- if (!filter_sp.get() && !synth.get())
- return false;
- else if (!filter_sp.get() && synth.get())
- pick_synth = true;
-
- else if (filter_sp.get() && !synth.get())
- pick_synth = false;
-
- else /*if (filter_sp.get() && synth.get())*/
- {
- if (filter_sp->GetRevision() > synth->GetRevision())
- pick_synth = false;
- else
- pick_synth = true;
- }
- if (pick_synth)
- {
- if (regex_synth && reason)
- *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
- entry_sp = synth;
- return true;
- }
- else
- {
- if (regex_filter && reason)
- *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
- entry_sp = filter_sp;
- return true;
- }
-
-#else
- if (filter_sp)
- {
- entry_sp = filter_sp;
- return true;
- }
-#endif
-
- return false;
-
-}
-
-void
-TypeCategoryImpl::Clear (FormatCategoryItems items)
-{
- if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
- m_summary_nav->Clear();
- if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
- m_regex_summary_nav->Clear();
- if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
- m_filter_nav->Clear();
- if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
- m_regex_filter_nav->Clear();
-#ifndef LLDB_DISABLE_PYTHON
- if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
- m_synth_nav->Clear();
- if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
- m_regex_synth_nav->Clear();
-#endif
-}
-
-bool
-TypeCategoryImpl::Delete (ConstString name,
- FormatCategoryItems items)
-{
- bool success = false;
- if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
- success = m_summary_nav->Delete(name) || success;
- if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
- success = m_regex_summary_nav->Delete(name) || success;
- if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
- success = m_filter_nav->Delete(name) || success;
- if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
- success = m_regex_filter_nav->Delete(name) || success;
-#ifndef LLDB_DISABLE_PYTHON
- if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
- success = m_synth_nav->Delete(name) || success;
- if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
- success = m_regex_synth_nav->Delete(name) || success;
-#endif
- return success;
-}
-
-uint32_t
-TypeCategoryImpl::GetCount (FormatCategoryItems items)
-{
- uint32_t count = 0;
- if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
- count += m_summary_nav->GetCount();
- if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
- count += m_regex_summary_nav->GetCount();
- if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
- count += m_filter_nav->GetCount();
- if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
- count += m_regex_filter_nav->GetCount();
-#ifndef LLDB_DISABLE_PYTHON
- if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
- count += m_synth_nav->GetCount();
- if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
- count += m_regex_synth_nav->GetCount();
-#endif
- return count;
-}
-
-bool
-TypeCategoryImpl::AnyMatches(ConstString type_name,
- FormatCategoryItems items,
- bool only_enabled,
- const char** matching_category,
- FormatCategoryItems* matching_type)
-{
- if (!IsEnabled() && only_enabled)
- return false;
-
- lldb::TypeSummaryImplSP summary;
- TypeFilterImpl::SharedPointer filter;
-#ifndef LLDB_DISABLE_PYTHON
- TypeSyntheticImpl::SharedPointer synth;
-#endif
-
- if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
- {
- if (m_summary_nav->Get(type_name, summary))
- {
- if (matching_category)
- *matching_category = m_name.GetCString();
- if (matching_type)
- *matching_type = eFormatCategoryItemSummary;
- return true;
- }
- }
- if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
- {
- if (m_regex_summary_nav->Get(type_name, summary))
- {
- if (matching_category)
- *matching_category = m_name.GetCString();
- if (matching_type)
- *matching_type = eFormatCategoryItemRegexSummary;
- return true;
- }
- }
- if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
- {
- if (m_filter_nav->Get(type_name, filter))
- {
- if (matching_category)
- *matching_category = m_name.GetCString();
- if (matching_type)
- *matching_type = eFormatCategoryItemFilter;
- return true;
- }
- }
- if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
- {
- if (m_regex_filter_nav->Get(type_name, filter))
- {
- if (matching_category)
- *matching_category = m_name.GetCString();
- if (matching_type)
- *matching_type = eFormatCategoryItemRegexFilter;
- return true;
- }
- }
-#ifndef LLDB_DISABLE_PYTHON
- if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
- {
- if (m_synth_nav->Get(type_name, synth))
- {
- if (matching_category)
- *matching_category = m_name.GetCString();
- if (matching_type)
- *matching_type = eFormatCategoryItemSynth;
- return true;
- }
- }
- if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
- {
- if (m_regex_synth_nav->Get(type_name, synth))
- {
- if (matching_category)
- *matching_category = m_name.GetCString();
- if (matching_type)
- *matching_type = eFormatCategoryItemRegexSynth;
- return true;
- }
- }
-#endif
- return false;
-}
-
-bool
-CategoryMap::AnyMatches (ConstString type_name,
- TypeCategoryImpl::FormatCategoryItems items,
- bool only_enabled,
- const char** matching_category,
- TypeCategoryImpl::FormatCategoryItems* matching_type)
-{
- Mutex::Locker locker(m_map_mutex);
-
- MapIterator pos, end = m_map.end();
- for (pos = m_map.begin(); pos != end; pos++)
- {
- if (pos->second->AnyMatches(type_name,
- items,
- only_enabled,
- matching_category,
- matching_type))
- return true;
- }
- return false;
-}
-
-lldb::TypeSummaryImplSP
-CategoryMap::GetSummaryFormat (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic)
-{
- Mutex::Locker locker(m_map_mutex);
-
- uint32_t reason_why;
- ActiveCategoriesIterator begin, end = m_active_categories.end();
-
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
-
- for (begin = m_active_categories.begin(); begin != end; begin++)
- {
- lldb::TypeCategoryImplSP category_sp = *begin;
- lldb::TypeSummaryImplSP current_format;
- if (log)
- log->Printf("[CategoryMap::GetSummaryFormat] Trying to use category %s\n", category_sp->GetName());
- if (!category_sp->Get(valobj, current_format, use_dynamic, &reason_why))
- continue;
- return current_format;
- }
- if (log)
- log->Printf("[CategoryMap::GetSummaryFormat] nothing found - returning empty SP\n");
- return lldb::TypeSummaryImplSP();
-}
-
lldb::TypeSummaryImplSP
FormatManager::GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
{
@@ -509,12 +216,12 @@ FormatManager::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
}
#ifndef LLDB_DISABLE_PYTHON
-lldb::TypeSyntheticImplSP
+lldb::ScriptedSyntheticChildrenSP
FormatManager::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
{
if (!type_sp)
- return lldb::TypeSyntheticImplSP();
- lldb::TypeSyntheticImplSP synth_chosen_sp;
+ return lldb::ScriptedSyntheticChildrenSP();
+ lldb::ScriptedSyntheticChildrenSP synth_chosen_sp;
uint32_t num_categories = m_categories_map.GetCount();
lldb::TypeCategoryImplSP category_sp;
uint32_t prio_category = UINT32_MAX;
@@ -525,7 +232,7 @@ FormatManager::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
category_sp = GetCategoryAtIndex(category_id);
if (category_sp->IsEnabled() == false)
continue;
- lldb::TypeSyntheticImplSP synth_current_sp((TypeSyntheticImpl*)category_sp->GetSyntheticForType(type_sp).get());
+ lldb::ScriptedSyntheticChildrenSP synth_current_sp((ScriptedSyntheticChildren*)category_sp->GetSyntheticForType(type_sp).get());
if (synth_current_sp && (synth_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
{
prio_category = category_sp->GetEnabledPosition();
@@ -543,7 +250,7 @@ FormatManager::GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_s
if (!type_sp)
return lldb::SyntheticChildrenSP();
lldb::TypeFilterImplSP filter_sp = GetFilterForType(type_sp);
- lldb::TypeSyntheticImplSP synth_sp = GetSyntheticForType(type_sp);
+ lldb::ScriptedSyntheticChildrenSP synth_sp = GetSyntheticForType(type_sp);
if (filter_sp->GetRevision() > synth_sp->GetRevision())
return lldb::SyntheticChildrenSP(filter_sp.get());
else
@@ -551,88 +258,6 @@ FormatManager::GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_s
}
#endif
-#ifndef LLDB_DISABLE_PYTHON
-lldb::SyntheticChildrenSP
-CategoryMap::GetSyntheticChildren (ValueObject& valobj,
- lldb::DynamicValueType use_dynamic)
-{
- Mutex::Locker locker(m_map_mutex);
-
- uint32_t reason_why;
-
- ActiveCategoriesIterator begin, end = m_active_categories.end();
-
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
-
- for (begin = m_active_categories.begin(); begin != end; begin++)
- {
- lldb::TypeCategoryImplSP category_sp = *begin;
- lldb::SyntheticChildrenSP current_format;
- if (log)
- log->Printf("[CategoryMap::GetSyntheticChildren] Trying to use category %s\n", category_sp->GetName());
- if (!category_sp->Get(valobj, current_format, use_dynamic, &reason_why))
- continue;
- return current_format;
- }
- if (log)
- log->Printf("[CategoryMap::GetSyntheticChildren] nothing found - returning empty SP\n");
- return lldb::SyntheticChildrenSP();
-}
-#endif
-
-void
-CategoryMap::LoopThrough(CallbackType callback, void* param)
-{
- if (callback)
- {
- Mutex::Locker locker(m_map_mutex);
-
- // loop through enabled categories in respective order
- {
- ActiveCategoriesIterator begin, end = m_active_categories.end();
- for (begin = m_active_categories.begin(); begin != end; begin++)
- {
- lldb::TypeCategoryImplSP category = *begin;
- ConstString type = ConstString(category->GetName());
- if (!callback(param, category))
- break;
- }
- }
-
- // loop through disabled categories in just any order
- {
- MapIterator pos, end = m_map.end();
- for (pos = m_map.begin(); pos != end; pos++)
- {
- if (pos->second->IsEnabled())
- continue;
- KeyType type = pos->first;
- if (!callback(param, pos->second))
- break;
- }
- }
- }
-}
-
-TypeCategoryImplSP
-CategoryMap::GetAtIndex (size_t index)
-{
- Mutex::Locker locker(m_map_mutex);
-
- if (index < m_map.size())
- {
- MapIterator pos, end = m_map.end();
- for (pos = m_map.begin(); pos != end; pos++)
- {
- if (index == 0)
- return pos->second;
- index--;
- }
- }
-
- return TypeCategoryImplSP();
-}
-
lldb::TypeCategoryImplSP
FormatManager::GetCategory (const ConstString& category_name,
bool can_create)
@@ -686,7 +311,103 @@ FormatManager::GetValidTypeName (const ConstString& type)
return ::GetValidTypeName_Impl(type);
}
-FormatManager::FormatManager() :
+ConstString
+GetTypeForCache (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic)
+{
+ if (use_dynamic == lldb::eNoDynamicValues)
+ {
+ if (valobj.IsDynamic())
+ {
+ if (valobj.GetStaticValue())
+ return valobj.GetStaticValue()->GetQualifiedTypeName();
+ else
+ return ConstString();
+ }
+ else
+ return valobj.GetQualifiedTypeName();
+ }
+ if (valobj.IsDynamic())
+ return valobj.GetQualifiedTypeName();
+ if (valobj.GetDynamicValue(use_dynamic))
+ return valobj.GetDynamicValue(use_dynamic)->GetQualifiedTypeName();
+ return ConstString();
+}
+
+#define USE_CACHE 1
+lldb::TypeSummaryImplSP
+FormatManager::GetSummaryFormat (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic)
+{
+ TypeSummaryImplSP retval;
+#if USE_CACHE
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+ ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
+ if (valobj_type)
+ {
+ if (log)
+ log->Printf("[FormatManager::GetSummaryFormat] Looking into cache for type %s", valobj_type.AsCString("<invalid>"));
+ if (m_format_cache.GetSummary(valobj_type,retval))
+ return retval;
+ if (log)
+ log->Printf("[FormatManager::GetSummaryFormat] Cache search failed. Going normal route");
+ }
+#endif
+ retval = m_categories_map.GetSummaryFormat(valobj, use_dynamic);
+#if USE_CACHE
+ if (valobj_type)
+ {
+ if (log)
+ log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s",retval.get(),valobj_type.AsCString("<invalid>"));
+ m_format_cache.SetSummary(valobj_type,retval);
+ }
+#ifdef LLDB_CONFIGURATION_DEBUG
+ if (log)
+ log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
+#endif
+#endif
+ return retval;
+}
+
+#ifndef LLDB_DISABLE_PYTHON
+lldb::SyntheticChildrenSP
+FormatManager::GetSyntheticChildren (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic)
+{
+ SyntheticChildrenSP retval;
+#if USE_CACHE
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+ ConstString valobj_type(GetTypeForCache(valobj, use_dynamic));
+ if (valobj_type)
+ {
+ if (log)
+ log->Printf("[FormatManager::GetSyntheticChildren] Looking into cache for type %s\n", valobj_type.AsCString("<invalid>"));
+ if (m_format_cache.GetSynthetic(valobj_type,retval))
+ return retval;
+ if (log)
+ log->Printf("[FormatManager::GetSyntheticChildren] Cache search failed. Going normal route\n");
+ }
+#endif
+ retval = m_categories_map.GetSyntheticChildren(valobj, use_dynamic);
+#if USE_CACHE
+ if (valobj_type)
+ {
+ if (log)
+ log->Printf("[FormatManager::GetSyntheticChildren] Caching %p for type %s\n",retval.get(),valobj_type.AsCString("<invalid>"));
+ m_format_cache.SetSynthetic(valobj_type,retval);
+ }
+#ifdef LLDB_CONFIGURATION_DEBUG
+ if (log)
+ log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %llu - Cache Misses: %llu", m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
+#endif
+#endif
+ return retval;
+}
+#endif
+#undef USE_CACHE
+
+FormatManager::FormatManager() :
+ m_format_cache(),
m_value_nav("format",this),
m_named_summaries_map(this),
m_last_revision(0),
@@ -702,21 +423,20 @@ FormatManager::FormatManager() :
m_vectortypes_category_name(ConstString("VectorTypes")),
m_appkit_category_name(ConstString("AppKit"))
{
-
LoadSystemFormatters();
LoadLibStdcppFormatters();
LoadLibcxxFormatters();
LoadObjCFormatters();
- EnableCategory(m_objc_category_name,CategoryMap::Last);
- EnableCategory(m_corefoundation_category_name,CategoryMap::Last);
- EnableCategory(m_appkit_category_name,CategoryMap::Last);
- EnableCategory(m_coreservices_category_name,CategoryMap::Last);
- EnableCategory(m_coregraphics_category_name,CategoryMap::Last);
- EnableCategory(m_gnu_cpp_category_name,CategoryMap::Last);
- EnableCategory(m_libcxx_category_name,CategoryMap::Last);
- EnableCategory(m_vectortypes_category_name,CategoryMap::Last);
- EnableCategory(m_system_category_name,CategoryMap::Last);
+ EnableCategory(m_objc_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_corefoundation_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_appkit_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_coreservices_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_coregraphics_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_gnu_cpp_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_libcxx_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_vectortypes_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_system_category_name,TypeCategoryMap::Last);
}
static void
@@ -769,7 +489,7 @@ static void AddCXXSynthetic (TypeCategoryImpl::SharedPointer category_sp,
CXXSyntheticChildren::CreateFrontEndCallback generator,
const char* description,
ConstString type_name,
- TypeSyntheticImpl::Flags flags)
+ ScriptedSyntheticChildren::Flags flags)
{
lldb::SyntheticChildrenSP synth_sp(new CXXSyntheticChildren(flags,description,generator));
category_sp->GetSyntheticNavigator()->Add(type_name,synth_sp);
@@ -822,13 +542,13 @@ FormatManager::LoadLibStdcppFormatters()
stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdMapSynthProvider")));
gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
stl_summary_flags.SetDontShowChildren(false);
@@ -879,22 +599,22 @@ FormatManager::LoadLibcxxFormatters()
stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::vector<.+>(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.libcxx.stdvector_SynthProvider")));
libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::list<.+>(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.libcxx.stdlist_SynthProvider")));
libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::__1::map<.+> >(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.libcxx.stdmap_SynthProvider")));
libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::__1::)deque<.+>(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.libcxx.stddeque_SynthProvider")));
libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::__1::)shared_ptr<.+>(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.libcxx.stdsharedptr_SynthProvider")));
libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::__1::)weak_ptr<.+>(( )?&)?$")),
- SyntheticChildrenSP(new TypeSyntheticImpl(stl_synth_flags,
+ SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.libcxx.stdsharedptr_SynthProvider")));
stl_summary_flags.SetDontShowChildren(false);stl_summary_flags.SetSkipPointers(true);
@@ -1141,18 +861,18 @@ FormatManager::LoadObjCFormatters()
appkit_flags.SetDontShowChildren(true);
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayM"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayI"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSArray"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSMutableArray"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSCFArray"), TypeSyntheticImpl::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayM"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayI"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSArray"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSMutableArray"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSCFArray"), ScriptedSyntheticChildren::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryM"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryI"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSDictionary"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSMutableDictionary"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFDictionaryRef"), TypeSyntheticImpl::Flags());
- AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFMutableDictionaryRef"), TypeSyntheticImpl::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryM"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryI"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSDictionary"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSMutableDictionary"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFDictionaryRef"), ScriptedSyntheticChildren::Flags());
+ AddCXXSynthetic(appkit_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFMutableDictionaryRef"), ScriptedSyntheticChildren::Flags());
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBag.CFBag_SummaryProvider", ConstString("CFBagRef"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBag.CFBag_SummaryProvider", ConstString("__CFBag"), appkit_flags);
@@ -1182,15 +902,14 @@ FormatManager::LoadObjCFormatters()
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFDataRef"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFMutableDataRef"), appkit_flags);
- AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSException.NSException_SummaryProvider", ConstString("NSException"), appkit_flags);
-
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSMachPort.NSMachPort_SummaryProvider", ConstString("NSMachPort"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSNotification.NSNotification_SummaryProvider", ConstString("NSNotification"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSNotification.NSNotification_SummaryProvider", ConstString("NSConcreteNotification"), appkit_flags);
AddStringSummary(appkit_category_sp, "domain: ${var._domain} - code: ${var._code}", ConstString("NSError"), appkit_flags);
-
+ AddStringSummary(appkit_category_sp,"name:${var.name%S} reason:${var.reason%S}",ConstString("NSException"),appkit_flags);
+
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSNumber"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFBoolean"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFNumber"), appkit_flags);
@@ -1202,6 +921,7 @@ FormatManager::LoadObjCFormatters()
AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSTask summary provider", ConstString("NSTask"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider, "NSValue summary provider", ConstString("NSValue"), appkit_flags);
+
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSSet.NSSet_SummaryProvider", ConstString("NSSet"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSSet.NSSet_SummaryProvider2", ConstString("CFSetRef"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSSet.NSSet_SummaryProvider2", ConstString("CFMutableSetRef"), appkit_flags);
diff --git a/lldb/source/DataFormatters/TypeCategory.cpp b/lldb/source/DataFormatters/TypeCategory.cpp
new file mode 100644
index 00000000000..ffbded40dba
--- /dev/null
+++ b/lldb/source/DataFormatters/TypeCategory.cpp
@@ -0,0 +1,378 @@
+//===-- TypeCategory.cpp -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/DataFormatters/TypeCategory.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+
+using namespace lldb;
+using namespace lldb_private;
+
+TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener* clist,
+ ConstString name) :
+m_summary_nav(new SummaryNavigator("summary",clist)),
+m_regex_summary_nav(new RegexSummaryNavigator("regex-summary",clist)),
+m_filter_nav(new FilterNavigator("filter",clist)),
+m_regex_filter_nav(new RegexFilterNavigator("regex-filter",clist)),
+#ifndef LLDB_DISABLE_PYTHON
+m_synth_nav(new SynthNavigator("synth",clist)),
+m_regex_synth_nav(new RegexSynthNavigator("regex-synth",clist)),
+#endif
+m_enabled(false),
+m_change_listener(clist),
+m_mutex(Mutex::eMutexTypeRecursive),
+m_name(name)
+{}
+
+bool
+TypeCategoryImpl::Get (ValueObject& valobj,
+ lldb::TypeSummaryImplSP& entry,
+ lldb::DynamicValueType use_dynamic,
+ uint32_t* reason)
+{
+ if (!IsEnabled())
+ return false;
+ if (GetSummaryNavigator()->Get(valobj, entry, use_dynamic, reason))
+ return true;
+ bool regex = GetRegexSummaryNavigator()->Get(valobj, entry, use_dynamic, reason);
+ if (regex && reason)
+ *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
+ return regex;
+}
+
+bool
+TypeCategoryImpl::Get(ValueObject& valobj,
+ lldb::SyntheticChildrenSP& entry_sp,
+ lldb::DynamicValueType use_dynamic,
+ uint32_t* reason)
+{
+ if (!IsEnabled())
+ return false;
+ TypeFilterImpl::SharedPointer filter_sp;
+ uint32_t reason_filter = 0;
+ bool regex_filter = false;
+ // first find both Filter and Synth, and then check which is most recent
+
+ if (!GetFilterNavigator()->Get(valobj, filter_sp, use_dynamic, &reason_filter))
+ regex_filter = GetRegexFilterNavigator()->Get (valobj, filter_sp, use_dynamic, &reason_filter);
+
+#ifndef LLDB_DISABLE_PYTHON
+ bool regex_synth = false;
+ uint32_t reason_synth = 0;
+ bool pick_synth = false;
+ ScriptedSyntheticChildren::SharedPointer synth;
+ if (!GetSyntheticNavigator()->Get(valobj, synth, use_dynamic, &reason_synth))
+ regex_synth = GetRegexSyntheticNavigator()->Get (valobj, synth, use_dynamic, &reason_synth);
+ if (!filter_sp.get() && !synth.get())
+ return false;
+ else if (!filter_sp.get() && synth.get())
+ pick_synth = true;
+
+ else if (filter_sp.get() && !synth.get())
+ pick_synth = false;
+
+ else /*if (filter_sp.get() && synth.get())*/
+ {
+ if (filter_sp->GetRevision() > synth->GetRevision())
+ pick_synth = false;
+ else
+ pick_synth = true;
+ }
+ if (pick_synth)
+ {
+ if (regex_synth && reason)
+ *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
+ entry_sp = synth;
+ return true;
+ }
+ else
+ {
+ if (regex_filter && reason)
+ *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
+ entry_sp = filter_sp;
+ return true;
+ }
+
+#else
+ if (filter_sp)
+ {
+ entry_sp = filter_sp;
+ return true;
+ }
+#endif
+
+ return false;
+
+}
+
+void
+TypeCategoryImpl::Clear (FormatCategoryItems items)
+{
+ if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
+ m_summary_nav->Clear();
+ if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
+ m_regex_summary_nav->Clear();
+ if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
+ m_filter_nav->Clear();
+ if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
+ m_regex_filter_nav->Clear();
+#ifndef LLDB_DISABLE_PYTHON
+ if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
+ m_synth_nav->Clear();
+ if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
+ m_regex_synth_nav->Clear();
+#endif
+}
+
+bool
+TypeCategoryImpl::Delete (ConstString name,
+ FormatCategoryItems items)
+{
+ bool success = false;
+ if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
+ success = m_summary_nav->Delete(name) || success;
+ if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
+ success = m_regex_summary_nav->Delete(name) || success;
+ if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
+ success = m_filter_nav->Delete(name) || success;
+ if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
+ success = m_regex_filter_nav->Delete(name) || success;
+#ifndef LLDB_DISABLE_PYTHON
+ if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
+ success = m_synth_nav->Delete(name) || success;
+ if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
+ success = m_regex_synth_nav->Delete(name) || success;
+#endif
+ return success;
+}
+
+uint32_t
+TypeCategoryImpl::GetCount (FormatCategoryItems items)
+{
+ uint32_t count = 0;
+ if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
+ count += m_summary_nav->GetCount();
+ if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
+ count += m_regex_summary_nav->GetCount();
+ if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
+ count += m_filter_nav->GetCount();
+ if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
+ count += m_regex_filter_nav->GetCount();
+#ifndef LLDB_DISABLE_PYTHON
+ if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
+ count += m_synth_nav->GetCount();
+ if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
+ count += m_regex_synth_nav->GetCount();
+#endif
+ return count;
+}
+
+bool
+TypeCategoryImpl::AnyMatches(ConstString type_name,
+ FormatCategoryItems items,
+ bool only_enabled,
+ const char** matching_category,
+ FormatCategoryItems* matching_type)
+{
+ if (!IsEnabled() && only_enabled)
+ return false;
+
+ lldb::TypeSummaryImplSP summary;
+ TypeFilterImpl::SharedPointer filter;
+#ifndef LLDB_DISABLE_PYTHON
+ ScriptedSyntheticChildren::SharedPointer synth;
+#endif
+
+ if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
+ {
+ if (m_summary_nav->Get(type_name, summary))
+ {
+ if (matching_category)
+ *matching_category = m_name.GetCString();
+ if (matching_type)
+ *matching_type = eFormatCategoryItemSummary;
+ return true;
+ }
+ }
+ if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
+ {
+ if (m_regex_summary_nav->Get(type_name, summary))
+ {
+ if (matching_category)
+ *matching_category = m_name.GetCString();
+ if (matching_type)
+ *matching_type = eFormatCategoryItemRegexSummary;
+ return true;
+ }
+ }
+ if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
+ {
+ if (m_filter_nav->Get(type_name, filter))
+ {
+ if (matching_category)
+ *matching_category = m_name.GetCString();
+ if (matching_type)
+ *matching_type = eFormatCategoryItemFilter;
+ return true;
+ }
+ }
+ if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
+ {
+ if (m_regex_filter_nav->Get(type_name, filter))
+ {
+ if (matching_category)
+ *matching_category = m_name.GetCString();
+ if (matching_type)
+ *matching_type = eFormatCategoryItemRegexFilter;
+ return true;
+ }
+ }
+#ifndef LLDB_DISABLE_PYTHON
+ if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
+ {
+ if (m_synth_nav->Get(type_name, synth))
+ {
+ if (matching_category)
+ *matching_category = m_name.GetCString();
+ if (matching_type)
+ *matching_type = eFormatCategoryItemSynth;
+ return true;
+ }
+ }
+ if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
+ {
+ if (m_regex_synth_nav->Get(type_name, synth))
+ {
+ if (matching_category)
+ *matching_category = m_name.GetCString();
+ if (matching_type)
+ *matching_type = eFormatCategoryItemRegexSynth;
+ return true;
+ }
+ }
+#endif
+ return false;
+}
+
+TypeCategoryImpl::SummaryNavigator::MapValueType
+TypeCategoryImpl::GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
+{
+ SummaryNavigator::MapValueType retval;
+
+ if (type_sp)
+ {
+ if (type_sp->IsRegex())
+ m_regex_summary_nav->GetExact(ConstString(type_sp->GetName()),retval);
+ else
+ m_summary_nav->GetExact(ConstString(type_sp->GetName()),retval);
+ }
+
+ return retval;
+}
+
+TypeCategoryImpl::FilterNavigator::MapValueType
+TypeCategoryImpl::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
+{
+ FilterNavigator::MapValueType retval;
+
+ if (type_sp)
+ {
+ if (type_sp->IsRegex())
+ m_regex_filter_nav->GetExact(ConstString(type_sp->GetName()),retval);
+ else
+ m_filter_nav->GetExact(ConstString(type_sp->GetName()),retval);
+ }
+
+ return retval;
+}
+
+#ifndef LLDB_DISABLE_PYTHON
+TypeCategoryImpl::SynthNavigator::MapValueType
+TypeCategoryImpl::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
+{
+ SynthNavigator::MapValueType retval;
+
+ if (type_sp)
+ {
+ if (type_sp->IsRegex())
+ m_regex_synth_nav->GetExact(ConstString(type_sp->GetName()),retval);
+ else
+ m_synth_nav->GetExact(ConstString(type_sp->GetName()),retval);
+ }
+
+ return retval;
+}
+#endif
+
+lldb::TypeNameSpecifierImplSP
+TypeCategoryImpl::GetTypeNameSpecifierForSummaryAtIndex (size_t index)
+{
+ if (index < m_summary_nav->GetCount())
+ return m_summary_nav->GetTypeNameSpecifierAtIndex(index);
+ else
+ return m_regex_summary_nav->GetTypeNameSpecifierAtIndex(index-m_summary_nav->GetCount());
+}
+
+TypeCategoryImpl::SummaryNavigator::MapValueType
+TypeCategoryImpl::GetSummaryAtIndex (size_t index)
+{
+ if (index < m_summary_nav->GetCount())
+ return m_summary_nav->GetAtIndex(index);
+ else
+ return m_regex_summary_nav->GetAtIndex(index-m_summary_nav->GetCount());
+}
+
+TypeCategoryImpl::FilterNavigator::MapValueType
+TypeCategoryImpl::GetFilterAtIndex (size_t index)
+{
+ if (index < m_filter_nav->GetCount())
+ return m_filter_nav->GetAtIndex(index);
+ else
+ return m_regex_filter_nav->GetAtIndex(index-m_filter_nav->GetCount());
+}
+
+lldb::TypeNameSpecifierImplSP
+TypeCategoryImpl::GetTypeNameSpecifierForFilterAtIndex (size_t index)
+{
+ if (index < m_filter_nav->GetCount())
+ return m_filter_nav->GetTypeNameSpecifierAtIndex(index);
+ else
+ return m_regex_filter_nav->GetTypeNameSpecifierAtIndex(index-m_filter_nav->GetCount());
+}
+
+TypeCategoryImpl::SynthNavigator::MapValueType
+TypeCategoryImpl::GetSyntheticAtIndex (size_t index)
+{
+ if (index < m_synth_nav->GetCount())
+ return m_synth_nav->GetAtIndex(index);
+ else
+ return m_regex_synth_nav->GetAtIndex(index-m_synth_nav->GetCount());
+}
+
+lldb::TypeNameSpecifierImplSP
+TypeCategoryImpl::GetTypeNameSpecifierForSyntheticAtIndex (size_t index)
+{
+ if (index < m_synth_nav->GetCount())
+ return m_synth_nav->GetTypeNameSpecifierAtIndex(index);
+ else
+ return m_regex_synth_nav->GetTypeNameSpecifierAtIndex(index - m_synth_nav->GetCount());
+}
+
+void
+TypeCategoryImpl::Enable (bool value, uint32_t position)
+{
+ Mutex::Locker locker(m_mutex);
+ m_enabled = value;
+ m_enabled_position = position;
+ if (m_change_listener)
+ m_change_listener->Changed();
+}
diff --git a/lldb/source/DataFormatters/TypeCategoryMap.cpp b/lldb/source/DataFormatters/TypeCategoryMap.cpp
new file mode 100644
index 00000000000..6e66e6744b4
--- /dev/null
+++ b/lldb/source/DataFormatters/TypeCategoryMap.cpp
@@ -0,0 +1,283 @@
+//===-- TypeCategoryMap.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/DataFormatters/TypeCategoryMap.h"
+
+// C Includes
+// C++ Includes
+// Other libraries and framework includes
+// Project includes
+
+using namespace lldb;
+using namespace lldb_private;
+
+TypeCategoryMap::TypeCategoryMap (IFormatChangeListener* lst) :
+m_map_mutex(Mutex::eMutexTypeRecursive),
+listener(lst),
+m_map(),
+m_active_categories()
+{
+ ConstString default_cs("default");
+ lldb::TypeCategoryImplSP default_sp = lldb::TypeCategoryImplSP(new TypeCategoryImpl(listener, default_cs));
+ Add(default_cs,default_sp);
+ Enable(default_cs,First);
+}
+
+void
+TypeCategoryMap::Add (KeyType name, const ValueSP& entry)
+{
+ Mutex::Locker locker(m_map_mutex);
+ m_map[name] = entry;
+ if (listener)
+ listener->Changed();
+}
+
+bool
+TypeCategoryMap::Delete (KeyType name)
+{
+ Mutex::Locker locker(m_map_mutex);
+ MapIterator iter = m_map.find(name);
+ if (iter == m_map.end())
+ return false;
+ m_map.erase(name);
+ Disable(name);
+ if (listener)
+ listener->Changed();
+ return true;
+}
+
+bool
+TypeCategoryMap::Enable (KeyType category_name, Position pos)
+{
+ Mutex::Locker locker(m_map_mutex);
+ ValueSP category;
+ if (!Get(category_name,category))
+ return false;
+ return Enable(category, pos);
+}
+
+bool
+TypeCategoryMap::Disable (KeyType category_name)
+{
+ Mutex::Locker locker(m_map_mutex);
+ ValueSP category;
+ if (!Get(category_name,category))
+ return false;
+ return Disable(category);
+}
+
+bool
+TypeCategoryMap::Enable (ValueSP category, Position pos)
+{
+ Mutex::Locker locker(m_map_mutex);
+ if (category.get())
+ {
+ Position pos_w = pos;
+ if (pos == First || m_active_categories.size() == 0)
+ m_active_categories.push_front(category);
+ else if (pos == Last || pos == m_active_categories.size())
+ m_active_categories.push_back(category);
+ else if (pos < m_active_categories.size())
+ {
+ ActiveCategoriesList::iterator iter = m_active_categories.begin();
+ while (pos_w)
+ {
+ pos_w--,iter++;
+ }
+ m_active_categories.insert(iter,category);
+ }
+ else
+ return false;
+ category->Enable(true,
+ pos);
+ return true;
+ }
+ return false;
+}
+
+bool
+TypeCategoryMap::Disable (ValueSP category)
+{
+ Mutex::Locker locker(m_map_mutex);
+ if (category.get())
+ {
+ m_active_categories.remove_if(delete_matching_categories(category));
+ category->Disable();
+ return true;
+ }
+ return false;
+}
+
+void
+TypeCategoryMap::Clear ()
+{
+ Mutex::Locker locker(m_map_mutex);
+ m_map.clear();
+ m_active_categories.clear();
+ if (listener)
+ listener->Changed();
+}
+
+bool
+TypeCategoryMap::Get (KeyType name, ValueSP& entry)
+{
+ Mutex::Locker locker(m_map_mutex);
+ MapIterator iter = m_map.find(name);
+ if (iter == m_map.end())
+ return false;
+ entry = iter->second;
+ return true;
+}
+
+bool
+TypeCategoryMap::Get (uint32_t pos, ValueSP& entry)
+{
+ Mutex::Locker locker(m_map_mutex);
+ MapIterator iter = m_map.begin();
+ MapIterator end = m_map.end();
+ while (pos > 0)
+ {
+ iter++;
+ pos--;
+ if (iter == end)
+ return false;
+ }
+ entry = iter->second;
+ return false;
+}
+
+bool
+TypeCategoryMap::AnyMatches (ConstString type_name,
+ TypeCategoryImpl::FormatCategoryItems items,
+ bool only_enabled,
+ const char** matching_category,
+ TypeCategoryImpl::FormatCategoryItems* matching_type)
+{
+ Mutex::Locker locker(m_map_mutex);
+
+ MapIterator pos, end = m_map.end();
+ for (pos = m_map.begin(); pos != end; pos++)
+ {
+ if (pos->second->AnyMatches(type_name,
+ items,
+ only_enabled,
+ matching_category,
+ matching_type))
+ return true;
+ }
+ return false;
+}
+
+lldb::TypeSummaryImplSP
+TypeCategoryMap::GetSummaryFormat (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic)
+{
+ Mutex::Locker locker(m_map_mutex);
+
+ uint32_t reason_why;
+ ActiveCategoriesIterator begin, end = m_active_categories.end();
+
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+
+ for (begin = m_active_categories.begin(); begin != end; begin++)
+ {
+ lldb::TypeCategoryImplSP category_sp = *begin;
+ lldb::TypeSummaryImplSP current_format;
+ if (log)
+ log->Printf("[CategoryMap::GetSummaryFormat] Trying to use category %s\n", category_sp->GetName());
+ if (!category_sp->Get(valobj, current_format, use_dynamic, &reason_why))
+ continue;
+ return current_format;
+ }
+ if (log)
+ log->Printf("[CategoryMap::GetSummaryFormat] nothing found - returning empty SP\n");
+ return lldb::TypeSummaryImplSP();
+}
+
+#ifndef LLDB_DISABLE_PYTHON
+lldb::SyntheticChildrenSP
+TypeCategoryMap::GetSyntheticChildren (ValueObject& valobj,
+ lldb::DynamicValueType use_dynamic)
+{
+ Mutex::Locker locker(m_map_mutex);
+
+ uint32_t reason_why;
+
+ ActiveCategoriesIterator begin, end = m_active_categories.end();
+
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
+
+ for (begin = m_active_categories.begin(); begin != end; begin++)
+ {
+ lldb::TypeCategoryImplSP category_sp = *begin;
+ lldb::SyntheticChildrenSP current_format;
+ if (log)
+ log->Printf("[CategoryMap::GetSyntheticChildren] Trying to use category %s\n", category_sp->GetName());
+ if (!category_sp->Get(valobj, current_format, use_dynamic, &reason_why))
+ continue;
+ return current_format;
+ }
+ if (log)
+ log->Printf("[CategoryMap::GetSyntheticChildren] nothing found - returning empty SP\n");
+ return lldb::SyntheticChildrenSP();
+}
+#endif
+
+void
+TypeCategoryMap::LoopThrough(CallbackType callback, void* param)
+{
+ if (callback)
+ {
+ Mutex::Locker locker(m_map_mutex);
+
+ // loop through enabled categories in respective order
+ {
+ ActiveCategoriesIterator begin, end = m_active_categories.end();
+ for (begin = m_active_categories.begin(); begin != end; begin++)
+ {
+ lldb::TypeCategoryImplSP category = *begin;
+ ConstString type = ConstString(category->GetName());
+ if (!callback(param, category))
+ break;
+ }
+ }
+
+ // loop through disabled categories in just any order
+ {
+ MapIterator pos, end = m_map.end();
+ for (pos = m_map.begin(); pos != end; pos++)
+ {
+ if (pos->second->IsEnabled())
+ continue;
+ KeyType type = pos->first;
+ if (!callback(param, pos->second))
+ break;
+ }
+ }
+ }
+}
+
+TypeCategoryImplSP
+TypeCategoryMap::GetAtIndex (uint32_t index)
+{
+ Mutex::Locker locker(m_map_mutex);
+
+ if (index < m_map.size())
+ {
+ MapIterator pos, end = m_map.end();
+ for (pos = m_map.begin(); pos != end; pos++)
+ {
+ if (index == 0)
+ return pos->second;
+ index--;
+ }
+ }
+
+ return TypeCategoryImplSP();
+}
diff --git a/lldb/source/DataFormatters/TypeFormat.cpp b/lldb/source/DataFormatters/TypeFormat.cpp
new file mode 100644
index 00000000000..1dda8bc1b02
--- /dev/null
+++ b/lldb/source/DataFormatters/TypeFormat.cpp
@@ -0,0 +1,50 @@
+//===-- TypeFormat.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// C Includes
+
+// C++ Includes
+
+// Other libraries and framework includes
+
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/Core/Timer.h"
+#include "lldb/DataFormatters/TypeFormat.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Target.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+TypeFormatImpl::TypeFormatImpl (lldb::Format f,
+ const Flags& flags) :
+m_flags(flags),
+m_format (f)
+{
+}
+
+std::string
+TypeFormatImpl::GetDescription()
+{
+ StreamString sstr;
+ sstr.Printf ("%s%s%s%s\n",
+ FormatManager::GetFormatAsCString (GetFormat()),
+ Cascades() ? "" : " (not cascading)",
+ SkipsPointers() ? " (skip pointers)" : "",
+ SkipsReferences() ? " (skip references)" : "");
+ return sstr.GetString();
+}
+
diff --git a/lldb/source/Core/FormatClasses.cpp b/lldb/source/DataFormatters/TypeSummary.cpp
index cc25f38e561..8ead75a1953 100644
--- a/lldb/source/Core/FormatClasses.cpp
+++ b/lldb/source/DataFormatters/TypeSummary.cpp
@@ -1,4 +1,4 @@
-//===-- FormatClasses.cpp ----------------------------------------*- C++ -*-===//
+//===-- TypeSummary.cpp ----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
// C Includes
// C++ Includes
@@ -20,9 +18,9 @@
#include "lldb/lldb-enumerations.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/FormatClasses.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Core/Timer.h"
+#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Target/StackFrame.h"
@@ -31,43 +29,24 @@
using namespace lldb;
using namespace lldb_private;
-TypeFormatImpl::TypeFormatImpl (lldb::Format f,
- const Flags& flags) :
- m_flags(flags),
- m_format (f)
-{
-}
-
-std::string
-TypeFormatImpl::GetDescription()
-{
- StreamString sstr;
- sstr.Printf ("%s%s%s%s\n",
- FormatManager::GetFormatAsCString (GetFormat()),
- Cascades() ? "" : " (not cascading)",
- SkipsPointers() ? " (skip pointers)" : "",
- SkipsReferences() ? " (skip references)" : "");
- return sstr.GetString();
-}
-
-TypeSummaryImpl::TypeSummaryImpl(const TypeSummaryImpl::Flags& flags) :
- m_flags(flags)
+TypeSummaryImpl::TypeSummaryImpl (const TypeSummaryImpl::Flags& flags) :
+m_flags(flags)
{
}
-StringSummaryFormat::StringSummaryFormat(const TypeSummaryImpl::Flags& flags,
- const char *format_cstr) :
- TypeSummaryImpl(flags),
- m_format()
+StringSummaryFormat::StringSummaryFormat (const TypeSummaryImpl::Flags& flags,
+ const char *format_cstr) :
+TypeSummaryImpl(flags),
+m_format()
{
- if (format_cstr)
- m_format.assign(format_cstr);
+ if (format_cstr)
+ m_format.assign(format_cstr);
}
bool
-StringSummaryFormat::FormatObject(ValueObject *valobj,
- std::string& retval)
+StringSummaryFormat::FormatObject (ValueObject *valobj,
+ std::string& retval)
{
if (!valobj)
{
@@ -144,7 +123,7 @@ StringSummaryFormat::FormatObject(ValueObject *valobj,
}
std::string
-StringSummaryFormat::GetDescription()
+StringSummaryFormat::GetDescription ()
{
StreamString sstr;
@@ -162,15 +141,15 @@ StringSummaryFormat::GetDescription()
CXXFunctionSummaryFormat::CXXFunctionSummaryFormat (const TypeSummaryImpl::Flags& flags,
Callback impl,
const char* description) :
- TypeSummaryImpl(flags),
- m_impl(impl),
- m_description(description ? description : "")
+TypeSummaryImpl(flags),
+m_impl(impl),
+m_description(description ? description : "")
{
}
-
+
bool
-CXXFunctionSummaryFormat::FormatObject(ValueObject *valobj,
- std::string& dest)
+CXXFunctionSummaryFormat::FormatObject (ValueObject *valobj,
+ std::string& dest)
{
dest.clear();
StreamString stream;
@@ -181,7 +160,7 @@ CXXFunctionSummaryFormat::FormatObject(ValueObject *valobj,
}
std::string
-CXXFunctionSummaryFormat::GetDescription()
+CXXFunctionSummaryFormat::GetDescription ()
{
StreamString sstr;
sstr.Printf ("`%s (%p) `%s%s%s%s%s%s%s", m_description.c_str(),m_impl,
@@ -198,51 +177,51 @@ CXXFunctionSummaryFormat::GetDescription()
#ifndef LLDB_DISABLE_PYTHON
-ScriptSummaryFormat::ScriptSummaryFormat(const TypeSummaryImpl::Flags& flags,
- const char * function_name,
- const char * python_script) :
- TypeSummaryImpl(flags),
- m_function_name(),
- m_python_script(),
- m_script_function_sp()
+ScriptSummaryFormat::ScriptSummaryFormat (const TypeSummaryImpl::Flags& flags,
+ const char * function_name,
+ const char * python_script) :
+TypeSummaryImpl(flags),
+m_function_name(),
+m_python_script(),
+m_script_function_sp()
{
- if (function_name)
- m_function_name.assign(function_name);
- if (python_script)
- m_python_script.assign(python_script);
+ if (function_name)
+ m_function_name.assign(function_name);
+ if (python_script)
+ m_python_script.assign(python_script);
}
bool
-ScriptSummaryFormat::FormatObject(ValueObject *valobj,
- std::string& retval)
+ScriptSummaryFormat::FormatObject (ValueObject *valobj,
+ std::string& retval)
{
Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__);
-
+
TargetSP target_sp(valobj->GetTargetSP());
-
+
if (!target_sp)
{
retval.assign("error: no target");
return false;
}
-
+
ScriptInterpreter *script_interpreter = target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
-
+
if (!script_interpreter)
{
retval.assign("error: no ScriptInterpreter");
return false;
}
-
+
return script_interpreter->GetScriptedSummary(m_function_name.c_str(),
valobj->GetSP(),
m_script_function_sp,
retval);
-
+
}
std::string
-ScriptSummaryFormat::GetDescription()
+ScriptSummaryFormat::GetDescription ()
{
StreamString sstr;
sstr.Printf ("%s%s%s%s%s%s%s\n%s", Cascades() ? "" : " (not cascading)",
@@ -258,152 +237,3 @@ ScriptSummaryFormat::GetDescription()
}
#endif // #ifndef LLDB_DISABLE_PYTHON
-
-std::string
-TypeFilterImpl::GetDescription()
-{
- StreamString sstr;
- sstr.Printf("%s%s%s {\n",
- Cascades() ? "" : " (not cascading)",
- SkipsPointers() ? " (skip pointers)" : "",
- SkipsReferences() ? " (skip references)" : "");
-
- for (int i = 0; i < GetCount(); i++)
- {
- sstr.Printf(" %s\n",
- GetExpressionPathAtIndex(i));
- }
-
- sstr.Printf("}");
- return sstr.GetString();
-}
-
-std::string
-CXXSyntheticChildren::GetDescription()
-{
- StreamString sstr;
- sstr.Printf("%s%s%s Generator at %p - %s\n",
- Cascades() ? "" : " (not cascading)",
- SkipsPointers() ? " (skip pointers)" : "",
- SkipsReferences() ? " (skip references)" : "",
- m_create_callback,
- m_description.c_str());
-
- return sstr.GetString();
-}
-
-std::string
-SyntheticArrayView::GetDescription()
-{
- StreamString sstr;
- sstr.Printf("%s%s%s {\n",
- Cascades() ? "" : " (not cascading)",
- SkipsPointers() ? " (skip pointers)" : "",
- SkipsReferences() ? " (skip references)" : "");
-
- SyntheticArrayRange* ptr = &m_head;
- while (ptr && ptr != m_tail)
- {
- if (ptr->GetLow() == ptr->GetHigh())
- sstr.Printf(" [%d]\n",
- ptr->GetLow());
- else
- sstr.Printf(" [%d-%d]\n",
- ptr->GetLow(),
- ptr->GetHigh());
- ptr = ptr->GetNext();
- }
-
- sstr.Printf("}");
- return sstr.GetString();
-}
-
-#ifndef LLDB_DISABLE_PYTHON
-
-TypeSyntheticImpl::FrontEnd::FrontEnd(std::string pclass, ValueObject &backend) :
- SyntheticChildrenFrontEnd(backend),
- m_python_class(pclass),
- m_wrapper_sp(),
- m_interpreter(NULL)
-{
- if (backend == LLDB_INVALID_UID)
- return;
-
- TargetSP target_sp = backend.GetTargetSP();
-
- if (!target_sp)
- return;
-
- m_interpreter = target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
-
- if (m_interpreter != NULL)
- m_wrapper_sp = m_interpreter->CreateSyntheticScriptedProvider(m_python_class.c_str(), backend.GetSP());
-}
-
-TypeSyntheticImpl::FrontEnd::~FrontEnd()
-{
-}
-
-lldb::ValueObjectSP
-TypeSyntheticImpl::FrontEnd::GetChildAtIndex (size_t idx)
-{
- if (!m_wrapper_sp || !m_interpreter)
- return lldb::ValueObjectSP();
-
- return m_interpreter->GetChildAtIndex(m_wrapper_sp, idx);
-}
-
-std::string
-TypeSyntheticImpl::GetDescription()
-{
- StreamString sstr;
- sstr.Printf("%s%s%s Python class %s",
- Cascades() ? "" : " (not cascading)",
- SkipsPointers() ? " (skip pointers)" : "",
- SkipsReferences() ? " (skip references)" : "",
- m_python_class.c_str());
-
- return sstr.GetString();
-}
-
-#endif // #ifndef LLDB_DISABLE_PYTHON
-
-int
-SyntheticArrayView::GetRealIndexForIndex(size_t i)
-{
- if (i >= GetCount())
- return -1;
-
- SyntheticArrayRange* ptr = &m_head;
-
- int residual = i;
-
- while(ptr && ptr != m_tail)
- {
- if (residual >= ptr->GetSelfCount())
- {
- residual -= ptr->GetSelfCount();
- ptr = ptr->GetNext();
- }
-
- return ptr->GetLow() + residual;
- }
-
- return -1;
-}
-
-uint32_t
-SyntheticArrayView::FrontEnd::GetIndexOfChildWithName (const ConstString &name_cs)
-{
- const char* name_cstr = name_cs.GetCString();
- if (*name_cstr != '[')
- return UINT32_MAX;
- std::string name(name_cstr+1);
- if (name[name.size()-1] != ']')
- return UINT32_MAX;
- name = name.erase(name.size()-1,1);
- int index = Args::StringToSInt32 (name.c_str(), -1);
- if (index < 0)
- return UINT32_MAX;
- return index;
-}
diff --git a/lldb/source/DataFormatters/TypeSynthetic.cpp b/lldb/source/DataFormatters/TypeSynthetic.cpp
new file mode 100644
index 00000000000..e2e0bffb5b0
--- /dev/null
+++ b/lldb/source/DataFormatters/TypeSynthetic.cpp
@@ -0,0 +1,112 @@
+//===-- TypeSynthetic.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// C Includes
+
+// C++ Includes
+
+// Other libraries and framework includes
+
+// Project includes
+#include "lldb/lldb-public.h"
+#include "lldb/lldb-enumerations.h"
+
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/StreamString.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Target.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+std::string
+TypeFilterImpl::GetDescription()
+{
+ StreamString sstr;
+ sstr.Printf("%s%s%s {\n",
+ Cascades() ? "" : " (not cascading)",
+ SkipsPointers() ? " (skip pointers)" : "",
+ SkipsReferences() ? " (skip references)" : "");
+
+ for (int i = 0; i < GetCount(); i++)
+ {
+ sstr.Printf(" %s\n",
+ GetExpressionPathAtIndex(i));
+ }
+
+ sstr.Printf("}");
+ return sstr.GetString();
+}
+
+std::string
+CXXSyntheticChildren::GetDescription()
+{
+ StreamString sstr;
+ sstr.Printf("%s%s%s Generator at %p - %s\n",
+ Cascades() ? "" : " (not cascading)",
+ SkipsPointers() ? " (skip pointers)" : "",
+ SkipsReferences() ? " (skip references)" : "",
+ m_create_callback,
+ m_description.c_str());
+
+ return sstr.GetString();
+}
+
+#ifndef LLDB_DISABLE_PYTHON
+
+ScriptedSyntheticChildren::FrontEnd::FrontEnd(std::string pclass, ValueObject &backend) :
+SyntheticChildrenFrontEnd(backend),
+m_python_class(pclass),
+m_wrapper_sp(),
+m_interpreter(NULL)
+{
+ if (backend == LLDB_INVALID_UID)
+ return;
+
+ TargetSP target_sp = backend.GetTargetSP();
+
+ if (!target_sp)
+ return;
+
+ m_interpreter = target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+
+ if (m_interpreter != NULL)
+ m_wrapper_sp = m_interpreter->CreateSyntheticScriptedProvider(m_python_class.c_str(), backend.GetSP());
+}
+
+ScriptedSyntheticChildren::FrontEnd::~FrontEnd()
+{
+}
+
+lldb::ValueObjectSP
+ScriptedSyntheticChildren::FrontEnd::GetChildAtIndex (size_t idx)
+{
+ if (!m_wrapper_sp || !m_interpreter)
+ return lldb::ValueObjectSP();
+
+ return m_interpreter->GetChildAtIndex(m_wrapper_sp, idx);
+}
+
+std::string
+ScriptedSyntheticChildren::GetDescription()
+{
+ StreamString sstr;
+ sstr.Printf("%s%s%s Python class %s",
+ Cascades() ? "" : " (not cascading)",
+ SkipsPointers() ? " (skip pointers)" : "",
+ SkipsReferences() ? " (skip references)" : "",
+ m_python_class.c_str());
+
+ return sstr.GetString();
+}
+
+#endif // #ifndef LLDB_DISABLE_PYTHON
diff --git a/lldb/source/Interpreter/Args.cpp b/lldb/source/Interpreter/Args.cpp
index 006e7c8e73f..76aa316c6ff 100644
--- a/lldb/source/Interpreter/Args.cpp
+++ b/lldb/source/Interpreter/Args.cpp
@@ -16,10 +16,10 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Args.h"
-#include "lldb/Core/FormatManager.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StreamString.h"
+#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Target/Process.h"
diff --git a/lldb/source/Interpreter/CommandObjectScript.cpp b/lldb/source/Interpreter/CommandObjectScript.cpp
index 204270fa584..a757817e935 100644
--- a/lldb/source/Interpreter/CommandObjectScript.cpp
+++ b/lldb/source/Interpreter/CommandObjectScript.cpp
@@ -16,13 +16,14 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Interpreter/Args.h"
+#include "lldb/DataFormatters/DataVisualization.h"
+
+#include "lldb/Interpreter/Args.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Interpreter/CommandInterpreter.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/Interpreter/OptionGroupVariable.cpp b/lldb/source/Interpreter/OptionGroupVariable.cpp
index 891e19ac577..316747eff03 100644
--- a/lldb/source/Interpreter/OptionGroupVariable.cpp
+++ b/lldb/source/Interpreter/OptionGroupVariable.cpp
@@ -15,10 +15,10 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/Error.h"
-#include "lldb/Target/Target.h"
+#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Target/Target.h"
#include "lldb/Utility/Utils.h"
using namespace lldb;
diff --git a/lldb/source/Interpreter/OptionValueArch.cpp b/lldb/source/Interpreter/OptionValueArch.cpp
index 49984bb28e5..92fedffe75e 100644
--- a/lldb/source/Interpreter/OptionValueArch.cpp
+++ b/lldb/source/Interpreter/OptionValueArch.cpp
@@ -15,8 +15,8 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/FormatManager.h"
#include "lldb/Core/State.h"
+#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandCompletions.h"
diff --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp
index 7806856df52..61f8aba431a 100644
--- a/lldb/source/Interpreter/OptionValueDictionary.cpp
+++ b/lldb/source/Interpreter/OptionValueDictionary.cpp
@@ -16,8 +16,8 @@
// Other libraries and framework includes
#include "llvm/ADT/StringRef.h"
// Project includes
-#include "lldb/Core/FormatManager.h"
#include "lldb/Core/State.h"
+#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/OptionValueString.h"
diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp
index 96bc0e0bccc..c1bcae2fc6c 100644
--- a/lldb/source/Interpreter/OptionValueFileSpec.cpp
+++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp
@@ -15,8 +15,8 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/FormatManager.h"
#include "lldb/Core/State.h"
+#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandCompletions.h"
diff --git a/lldb/source/Interpreter/OptionValueFormat.cpp b/lldb/source/Interpreter/OptionValueFormat.cpp
index cba407befc1..34d36725fbb 100644
--- a/lldb/source/Interpreter/OptionValueFormat.cpp
+++ b/lldb/source/Interpreter/OptionValueFormat.cpp
@@ -15,8 +15,8 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/FormatManager.h"
#include "lldb/Core/Stream.h"
+#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Interpreter/Args.h"
using namespace lldb;
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
index 782b74a43fe..71a6073de03 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
@@ -49,13 +49,26 @@ AppleObjCRuntimeV1::AppleObjCRuntimeV1(Process *process) :
{
}
+// for V1 runtime we just try to return a class name as that is the minimum level of support
+// required for the data formatters to work
bool
AppleObjCRuntimeV1::GetDynamicTypeAndAddress (ValueObject &in_value,
lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address)
{
- return false;
+ class_type_or_name.Clear();
+ if (CouldHaveDynamicValue(in_value))
+ {
+ auto class_descriptor(GetClassDescriptor(in_value));
+ if (class_descriptor && class_descriptor->IsValid() && class_descriptor->GetClassName())
+ {
+ const addr_t object_ptr = in_value.GetPointerValue();
+ address.SetRawAddress(object_ptr);
+ class_type_or_name.SetName(class_descriptor->GetClassName());
+ }
+ }
+ return class_type_or_name.IsEmpty() == false;
}
//------------------------------------------------------------------
OpenPOWER on IntegriCloud