aboutsummaryrefslogtreecommitdiff
path: root/source/DataFormatters/FormatManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/DataFormatters/FormatManager.cpp')
-rw-r--r--source/DataFormatters/FormatManager.cpp73
1 files changed, 57 insertions, 16 deletions
diff --git a/source/DataFormatters/FormatManager.cpp b/source/DataFormatters/FormatManager.cpp
index ae52b3309ed8..47456ba5c45b 100644
--- a/source/DataFormatters/FormatManager.cpp
+++ b/source/DataFormatters/FormatManager.cpp
@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include "lldb/DataFormatters/FormatManager.h"
// C Includes
@@ -18,7 +16,6 @@
#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"
#include "llvm/ADT/STLExtras.h"
@@ -477,7 +474,7 @@ FormatManager::GetValidatorForType (lldb::TypeNameSpecifierImplSP type_sp)
lldb::TypeCategoryImplSP
FormatManager::GetCategory (const ConstString& category_name,
- bool can_create)
+ bool can_create)
{
if (!category_name)
return GetCategory(m_default_category_name);
@@ -665,7 +662,8 @@ FormatManager::GetFormat (ValueObject& valobj,
log->Printf("[FormatManager::GetFormat] Search failed. Giving hardcoded a chance.");
retval = GetHardcodedFormat(valobj, use_dynamic);
}
- else if (valobj_type)
+
+ if (valobj_type && (!retval || !retval->NonCacheable()))
{
if (log)
log->Printf("[FormatManager::GetFormat] Caching %p for type %s",
@@ -722,7 +720,8 @@ FormatManager::GetSummaryFormat (ValueObject& valobj,
log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving hardcoded a chance.");
retval = GetHardcodedSummaryFormat(valobj, use_dynamic);
}
- else if (valobj_type)
+
+ if (valobj_type && (!retval || !retval->NonCacheable()))
{
if (log)
log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s",
@@ -780,7 +779,8 @@ FormatManager::GetSyntheticChildren (ValueObject& valobj,
log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving hardcoded a chance.");
retval = GetHardcodedSyntheticChildren(valobj, use_dynamic);
}
- else if (valobj_type)
+
+ if (valobj_type && (!retval || !retval->NonCacheable()))
{
if (log)
log->Printf("[FormatManager::GetSyntheticChildren] Caching %p for type %s",
@@ -825,7 +825,8 @@ FormatManager::GetValidator (ValueObject& valobj,
log->Printf("[FormatManager::GetValidator] Search failed. Giving hardcoded a chance.");
retval = GetHardcodedValidator(valobj, use_dynamic);
}
- else if (valobj_type)
+
+ if (valobj_type && (!retval || !retval->NonCacheable()))
{
if (log)
log->Printf("[FormatManager::GetValidator] Caching %p for type %s",
@@ -866,6 +867,7 @@ FormatManager::FormatManager() :
m_coreservices_category_name(ConstString("CoreServices")),
m_vectortypes_category_name(ConstString("VectorTypes")),
m_appkit_category_name(ConstString("AppKit")),
+ m_coremedia_category_name(ConstString("CoreMedia")),
m_hardcoded_formats(),
m_hardcoded_summaries(),
m_hardcoded_synthetics(),
@@ -876,6 +878,7 @@ FormatManager::FormatManager() :
LoadLibStdcppFormatters();
LoadLibcxxFormatters();
LoadObjCFormatters();
+ LoadCoreMediaFormatters();
LoadHardcodedFormatters();
EnableCategory(m_objc_category_name,TypeCategoryMap::Last);
@@ -883,6 +886,7 @@ FormatManager::FormatManager() :
EnableCategory(m_appkit_category_name,TypeCategoryMap::Last);
EnableCategory(m_coreservices_category_name,TypeCategoryMap::Last);
EnableCategory(m_coregraphics_category_name,TypeCategoryMap::Last);
+ EnableCategory(m_coremedia_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);
@@ -1152,19 +1156,23 @@ FormatManager::LoadSystemFormatters()
.SetShowMembersOneLiner(false)
.SetHideItemNames(false);
+ TypeSummaryImpl::Flags string_array_flags;
+ string_array_flags.SetCascades(false)
+ .SetSkipPointers(true)
+ .SetSkipReferences(false)
+ .SetDontShowChildren(true)
+ .SetDontShowValue(true)
+ .SetShowMembersOneLiner(false)
+ .SetHideItemNames(false);
+
lldb::TypeSummaryImplSP string_format(new StringSummaryFormat(string_flags, "${var%s}"));
- lldb::TypeSummaryImplSP string_array_format(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
- .SetSkipPointers(true)
- .SetSkipReferences(false)
- .SetDontShowChildren(true)
- .SetDontShowValue(true)
- .SetShowMembersOneLiner(false)
- .SetHideItemNames(false),
+ lldb::TypeSummaryImplSP string_array_format(new StringSummaryFormat(string_array_flags,
"${var%s}"));
lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
+ lldb::RegularExpressionSP any_size_wchar_arr(new RegularExpression("wchar_t \\[[0-9]+\\]"));
TypeCategoryImpl::SharedPointer sys_category_sp = GetCategory(m_system_category_name);
@@ -1190,6 +1198,7 @@ FormatManager::LoadSystemFormatters()
AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32StringSummaryProvider, "char32_t * summary provider", ConstString("char32_t *"), string_flags);
AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharStringSummaryProvider, "wchar_t * summary provider", ConstString("wchar_t *"), string_flags);
+ AddCXXSummary(sys_category_sp, lldb_private::formatters::WCharStringSummaryProvider, "wchar_t * summary provider", ConstString("wchar_t \\[[0-9]+\\]"), string_array_flags, true);
AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "unichar * summary provider", ConstString("unichar *"), string_flags);
@@ -1212,7 +1221,6 @@ FormatManager::LoadSystemFormatters()
fourchar_flags.SetCascades(true).SetSkipPointers(true).SetSkipReferences(true);
AddFormat(sys_category_sp, lldb::eFormatOSType, ConstString("FourCharCode"), fourchar_flags);
-
#endif
}
@@ -1563,6 +1571,25 @@ FormatManager::LoadObjCFormatters()
}
void
+FormatManager::LoadCoreMediaFormatters()
+{
+ TypeSummaryImpl::Flags cm_flags;
+ cm_flags.SetCascades(true)
+ .SetDontShowChildren(false)
+ .SetDontShowValue(false)
+ .SetHideItemNames(false)
+ .SetShowMembersOneLiner(false)
+ .SetSkipPointers(false)
+ .SetSkipReferences(false);
+
+ TypeCategoryImpl::SharedPointer cm_category_sp = GetCategory(m_coremedia_category_name);
+
+#ifndef LLDB_DISABLE_PYTHON
+ AddCXXSummary(cm_category_sp, lldb_private::formatters::CMTimeSummaryProvider, "CMTime summary provider", ConstString("CMTime"), cm_flags);
+#endif // LLDB_DISABLE_PYTHON
+}
+
+void
FormatManager::LoadHardcodedFormatters()
{
{
@@ -1584,6 +1611,20 @@ FormatManager::LoadHardcodedFormatters()
}
{
// insert code to load synthetics here
+ m_hardcoded_synthetics.push_back(
+ [](lldb_private::ValueObject& valobj,
+ lldb::DynamicValueType,
+ FormatManager& fmt_mgr) -> SyntheticChildren::SharedPointer {
+ static CXXSyntheticChildren::SharedPointer formatter_sp(new CXXSyntheticChildren(SyntheticChildren::Flags().SetCascades(true).SetSkipPointers(true).SetSkipReferences(true).SetNonCacheable(true),
+ "vector_type synthetic children",
+ lldb_private::formatters::VectorTypeSyntheticFrontEndCreator));
+ if (valobj.GetClangType().IsVectorType(nullptr, nullptr))
+ {
+ if (fmt_mgr.GetCategory(fmt_mgr.m_vectortypes_category_name)->IsEnabled())
+ return formatter_sp;
+ }
+ return nullptr;
+ });
}
{
// insert code to load validators here