summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/DataFormatters
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/lldb/source/DataFormatters')
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/DataVisualization.cpp12
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/FormatManager.cpp111
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/LibCxx.cpp74
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/LibCxxUnorderedMap.cpp3
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/TypeCategory.cpp180
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/TypeFormat.cpp186
-rw-r--r--contrib/llvm/tools/lldb/source/DataFormatters/ValueObjectPrinter.cpp5
7 files changed, 410 insertions, 161 deletions
diff --git a/contrib/llvm/tools/lldb/source/DataFormatters/DataVisualization.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/DataVisualization.cpp
index 48d3517..c2c2206 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/DataVisualization.cpp
+++ b/contrib/llvm/tools/lldb/source/DataFormatters/DataVisualization.cpp
@@ -204,35 +204,35 @@ DataVisualization::Categories::GetCategoryAtIndex (size_t index)
bool
DataVisualization::NamedSummaryFormats::GetSummaryFormat (const ConstString &type, lldb::TypeSummaryImplSP &entry)
{
- return GetFormatManager().GetNamedSummaryNavigator().Get(type,entry);
+ return GetFormatManager().GetNamedSummaryContainer().Get(type,entry);
}
void
DataVisualization::NamedSummaryFormats::Add (const ConstString &type, const lldb::TypeSummaryImplSP &entry)
{
- GetFormatManager().GetNamedSummaryNavigator().Add(FormatManager::GetValidTypeName(type),entry);
+ GetFormatManager().GetNamedSummaryContainer().Add(FormatManager::GetValidTypeName(type),entry);
}
bool
DataVisualization::NamedSummaryFormats::Delete (const ConstString &type)
{
- return GetFormatManager().GetNamedSummaryNavigator().Delete(type);
+ return GetFormatManager().GetNamedSummaryContainer().Delete(type);
}
void
DataVisualization::NamedSummaryFormats::Clear ()
{
- GetFormatManager().GetNamedSummaryNavigator().Clear();
+ GetFormatManager().GetNamedSummaryContainer().Clear();
}
void
DataVisualization::NamedSummaryFormats::LoopThrough (TypeSummaryImpl::SummaryCallback callback, void* callback_baton)
{
- GetFormatManager().GetNamedSummaryNavigator().LoopThrough(callback, callback_baton);
+ GetFormatManager().GetNamedSummaryContainer().LoopThrough(callback, callback_baton);
}
uint32_t
DataVisualization::NamedSummaryFormats::GetCount ()
{
- return GetFormatManager().GetNamedSummaryNavigator().GetCount();
+ return GetFormatManager().GetNamedSummaryContainer().GetCount();
}
diff --git a/contrib/llvm/tools/lldb/source/DataFormatters/FormatManager.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/FormatManager.cpp
index bec2edf..751e612 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/FormatManager.cpp
+++ b/contrib/llvm/tools/lldb/source/DataFormatters/FormatManager.cpp
@@ -741,12 +741,12 @@ AddFormat (TypeCategoryImpl::SharedPointer category_sp,
TypeFormatImpl::Flags flags,
bool regex = false)
{
- lldb::TypeFormatImplSP format_sp(new TypeFormatImpl(format, flags));
+ lldb::TypeFormatImplSP format_sp(new TypeFormatImpl_Format(format, flags));
if (regex)
- category_sp->GetRegexValueNavigator()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),format_sp);
+ category_sp->GetRegexTypeFormatsContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),format_sp);
else
- category_sp->GetValueNavigator()->Add(type_name, format_sp);
+ category_sp->GetTypeFormatsContainer()->Add(type_name, format_sp);
}
@@ -761,9 +761,9 @@ AddStringSummary(TypeCategoryImpl::SharedPointer category_sp,
string));
if (regex)
- category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
+ category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
else
- category_sp->GetSummaryNavigator()->Add(type_name, summary_sp);
+ category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
}
#ifndef LLDB_DISABLE_PYTHON
@@ -782,9 +782,9 @@ AddScriptSummary(TypeCategoryImpl::SharedPointer category_sp,
funct_name,
code.c_str()));
if (regex)
- category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
+ category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
else
- category_sp->GetSummaryNavigator()->Add(type_name, summary_sp);
+ category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
}
#endif
@@ -799,9 +799,9 @@ AddCXXSummary (TypeCategoryImpl::SharedPointer category_sp,
{
lldb::TypeSummaryImplSP summary_sp(new CXXFunctionSummaryFormat(flags,funct,description));
if (regex)
- category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
+ category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
else
- category_sp->GetSummaryNavigator()->Add(type_name, summary_sp);
+ category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
}
#endif
@@ -815,9 +815,27 @@ static void AddCXXSynthetic (TypeCategoryImpl::SharedPointer category_sp,
{
lldb::SyntheticChildrenSP synth_sp(new CXXSyntheticChildren(flags,description,generator));
if (regex)
- category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())), synth_sp);
+ category_sp->GetRegexTypeSyntheticsContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())), synth_sp);
else
- category_sp->GetSyntheticNavigator()->Add(type_name,synth_sp);
+ category_sp->GetTypeSyntheticsContainer()->Add(type_name,synth_sp);
+}
+#endif
+
+#ifndef LLDB_DISABLE_PYTHON
+static void AddFilter (TypeCategoryImpl::SharedPointer category_sp,
+ std::vector<std::string> children,
+ const char* description,
+ ConstString type_name,
+ ScriptedSyntheticChildren::Flags flags,
+ bool regex = false)
+{
+ TypeFilterImplSP filter_sp(new TypeFilterImpl(flags));
+ for (auto child : children)
+ filter_sp->AddExpressionPath(child);
+ if (regex)
+ category_sp->GetRegexTypeFiltersContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())), filter_sp);
+ else
+ category_sp->GetTypeFiltersContainer()->Add(type_name,filter_sp);
}
#endif
@@ -838,26 +856,26 @@ FormatManager::LoadLibStdcppFormatters()
TypeCategoryImpl::SharedPointer gnu_category_sp = GetCategory(m_gnu_cpp_category_name);
- gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::string"),
+ gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::string"),
std_string_summary_sp);
- gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char>"),
+ gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::basic_string<char>"),
std_string_summary_sp);
- gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char,std::char_traits<char>,std::allocator<char> >"),
+ gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::basic_string<char,std::char_traits<char>,std::allocator<char> >"),
std_string_summary_sp);
- gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<char, std::char_traits<char>, std::allocator<char> >"),
+ gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::basic_string<char, std::char_traits<char>, std::allocator<char> >"),
std_string_summary_sp);
// making sure we force-pick the summary for printing wstring (_M_p is a wchar_t*)
lldb::TypeSummaryImplSP std_wstring_summary_sp(new StringSummaryFormat(stl_summary_flags,
"${var._M_dataplus._M_p%S}"));
- gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::wstring"),
+ gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::wstring"),
std_wstring_summary_sp);
- gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<wchar_t>"),
+ gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::basic_string<wchar_t>"),
std_wstring_summary_sp);
- gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >"),
+ gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >"),
std_wstring_summary_sp);
- gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >"),
+ gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >"),
std_wstring_summary_sp);
@@ -866,24 +884,24 @@ FormatManager::LoadLibStdcppFormatters()
SyntheticChildren::Flags stl_synth_flags;
stl_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
- gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
+ gnu_category_sp->GetRegexTypeSyntheticsContainer()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider")));
- gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")),
+ gnu_category_sp->GetRegexTypeSyntheticsContainer()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")),
SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdMapSynthProvider")));
- gnu_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")),
+ gnu_category_sp->GetRegexTypeSyntheticsContainer()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")),
SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.gnu_libstdcpp.StdListSynthProvider")));
stl_summary_flags.SetDontShowChildren(false);stl_summary_flags.SetSkipPointers(true);
- gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
+ gnu_category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression("^std::vector<.+>(( )?&)?$")),
TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
"size=${svar%#}")));
- gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")),
+ gnu_category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression("^std::map<.+> >(( )?&)?$")),
TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
"size=${svar%#}")));
- gnu_category_sp->GetRegexSummaryNavigator()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")),
+ gnu_category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression("^std::list<.+>(( )?&)?$")),
TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags,
"size=${svar%#}")));
@@ -891,10 +909,10 @@ FormatManager::LoadLibStdcppFormatters()
AddCXXSynthetic(gnu_category_sp, lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEndCreator, "std::map iterator synthetic children", ConstString("^std::_Rb_tree_iterator<.+>$"), stl_synth_flags, true);
- gnu_category_sp->GetSummaryNavigator()->Add(ConstString("std::vector<std::allocator<bool> >"),
+ gnu_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::vector<std::allocator<bool> >"),
TypeSummaryImplSP(new StringSummaryFormat(stl_summary_flags, "size=${svar%#}")));
- gnu_category_sp->GetSyntheticNavigator()->Add(ConstString("std::vector<std::allocator<bool> >"),
+ gnu_category_sp->GetTypeSyntheticsContainer()->Add(ConstString("std::vector<std::allocator<bool> >"),
SyntheticChildrenSP(new CXXSyntheticChildren(stl_synth_flags,"libc++ std::vector<bool> synthetic children",lldb_private::formatters::LibstdcppVectorBoolSyntheticFrontEndCreator)));
#endif
@@ -921,14 +939,14 @@ FormatManager::LoadLibcxxFormatters()
TypeCategoryImpl::SharedPointer libcxx_category_sp = GetCategory(m_libcxx_category_name);
- libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::string"),
+ libcxx_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::__1::string"),
std_string_summary_sp);
- libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >"),
+ libcxx_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >"),
std_string_summary_sp);
- libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::wstring"),
+ libcxx_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::__1::wstring"),
std_wstring_summary_sp);
- libcxx_category_sp->GetSummaryNavigator()->Add(ConstString("std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >"),
+ libcxx_category_sp->GetTypeSummariesContainer()->Add(ConstString("std::__1::basic_string<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >"),
std_wstring_summary_sp);
SyntheticChildren::Flags stl_synth_flags;
@@ -943,7 +961,7 @@ FormatManager::LoadLibcxxFormatters()
AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator, "libc++ std::multimap synthetic children", ConstString("^std::__1::multimap<.+> >(( )?&)?$"), stl_synth_flags, true);
AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEndCreator, "libc++ std::unordered containers synthetic children", ConstString("^(std::__1::)unordered_(multi)?(map|set)<.+> >$"), stl_synth_flags, true);
- libcxx_category_sp->GetRegexSyntheticNavigator()->Add(RegularExpressionSP(new RegularExpression("^(std::__1::)deque<.+>(( )?&)?$")),
+ libcxx_category_sp->GetRegexTypeSyntheticsContainer()->Add(RegularExpressionSP(new RegularExpression("^(std::__1::)deque<.+>(( )?&)?$")),
SyntheticChildrenSP(new ScriptedSyntheticChildren(stl_synth_flags,
"lldb.formatters.cpp.libcxx.stddeque_SynthProvider")));
@@ -963,13 +981,15 @@ FormatManager::LoadLibcxxFormatters()
AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider, "libc++ std::unordered containers summary provider", ConstString("^(std::__1::)unordered_(multi)?(map|set)<.+> >$"), stl_summary_flags, true);
stl_summary_flags.SetSkipPointers(true);
- AddStringSummary(libcxx_category_sp, "{${var.__ptr_%S}} (strong=${var.count} weak=${var.weak_count})}", ConstString("^std::__1::shared_ptr<.+>(( )?&)?$"), stl_summary_flags, true);
- AddStringSummary(libcxx_category_sp, "{${var.__ptr_%S}} (strong=${var.count} weak=${var.weak_count})}", ConstString("^std::__1::weak_ptr<.+>(( )?&)?$"), stl_summary_flags, true);
+
+ AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxSmartPointerSummaryProvider, "libc++ std::shared_ptr summary provider", ConstString("^std::__1::shared_ptr<.+>(( )?&)?$"), stl_summary_flags, true);
+ AddCXXSummary(libcxx_category_sp, lldb_private::formatters::LibcxxSmartPointerSummaryProvider, "libc++ std::weak_ptr summary provider", ConstString("^std::__1::weak_ptr<.+>(( )?&)?$"), stl_summary_flags, true);
AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibCxxVectorIteratorSyntheticFrontEndCreator, "std::vector iterator synthetic children", ConstString("^std::__1::__wrap_iter<.+>$"), stl_synth_flags, true);
AddCXXSynthetic(libcxx_category_sp, lldb_private::formatters::LibCxxMapIteratorSyntheticFrontEndCreator, "std::map iterator synthetic children", ConstString("^std::__1::__map_iterator<.+>$"), stl_synth_flags, true);
+ AddFilter(libcxx_category_sp, {"__a_"}, "libc++ std::atomic filter", ConstString("^std::__1::atomic<.*>$"), stl_synth_flags, true);
#endif
}
@@ -1002,9 +1022,9 @@ FormatManager::LoadSystemFormatters()
TypeCategoryImpl::SharedPointer sys_category_sp = GetCategory(m_system_category_name);
- sys_category_sp->GetSummaryNavigator()->Add(ConstString("char *"), string_format);
- sys_category_sp->GetSummaryNavigator()->Add(ConstString("unsigned char *"), string_format);
- sys_category_sp->GetRegexSummaryNavigator()->Add(any_size_char_arr, string_array_format);
+ sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("char *"), string_format);
+ sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("unsigned char *"), string_format);
+ sys_category_sp->GetRegexTypeSummariesContainer()->Add(any_size_char_arr, string_array_format);
lldb::TypeSummaryImplSP ostype_summary(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
.SetSkipPointers(true)
@@ -1015,10 +1035,10 @@ FormatManager::LoadSystemFormatters()
.SetHideItemNames(false),
"${var%O}"));
- sys_category_sp->GetSummaryNavigator()->Add(ConstString("OSType"), ostype_summary);
+ sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("OSType"), ostype_summary);
#ifndef LLDB_DISABLE_PYTHON
- // FIXME because of a bug in the FormatNavigator we need to add a summary for both X* and const X* (<rdar://problem/12717717>)
+ // FIXME because of a bug in the FormattersContainer we need to add a summary for both X* and const X* (<rdar://problem/12717717>)
AddCXXSummary(sys_category_sp, lldb_private::formatters::Char16StringSummaryProvider, "char16_t * summary provider", ConstString("char16_t *"), string_flags);
AddCXXSummary(sys_category_sp, lldb_private::formatters::Char32StringSummaryProvider, "char32_t * summary provider", ConstString("char32_t *"), string_flags);
@@ -1065,11 +1085,11 @@ FormatManager::LoadObjCFormatters()
TypeCategoryImpl::SharedPointer objc_category_sp = GetCategory(m_objc_category_name);
lldb::TypeSummaryImplSP ObjC_BOOL_summary(new CXXFunctionSummaryFormat(objc_flags, lldb_private::formatters::ObjCBOOLSummaryProvider,""));
- objc_category_sp->GetSummaryNavigator()->Add(ConstString("BOOL"),
+ objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL"),
ObjC_BOOL_summary);
- objc_category_sp->GetSummaryNavigator()->Add(ConstString("BOOL &"),
+ objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL &"),
ObjC_BOOL_summary);
- objc_category_sp->GetSummaryNavigator()->Add(ConstString("BOOL *"),
+ objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL *"),
ObjC_BOOL_summary);
#ifndef LLDB_DISABLE_PYTHON
@@ -1256,6 +1276,7 @@ FormatManager::LoadObjCFormatters()
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSString"), appkit_flags);
AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFStringRef"), appkit_flags);
+ AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__CFString"), appkit_flags);
AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFMutableStringRef"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSMutableString"), appkit_flags);
AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFConstantString"), appkit_flags);
@@ -1286,7 +1307,7 @@ FormatManager::LoadObjCFormatters()
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, "CFNumberRef summary provider", ConstString("CFNumberRef"), appkit_flags);
+ AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "CFNumberRef summary provider", ConstString("CFNumberRef"), appkit_flags);
AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFBoolean"), appkit_flags);
AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFNumber"), appkit_flags);
AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFBoolean"), appkit_flags);
@@ -1306,7 +1327,7 @@ FormatManager::LoadObjCFormatters()
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("NSCalendarDate"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("NSTimeZone"), appkit_flags);
- AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("CFTimeZoneRef"), appkit_flags);
+ AddCXXSummary(corefoundation_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("CFTimeZoneRef"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("__NSTimeZone"), appkit_flags);
// CFAbsoluteTime is actually a double rather than a pointer to an object
@@ -1318,7 +1339,7 @@ FormatManager::LoadObjCFormatters()
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSIndexSetSummaryProvider, "NSIndexSet summary provider", ConstString("NSIndexSet"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSIndexSetSummaryProvider, "NSIndexSet summary provider", ConstString("NSMutableIndexSet"), appkit_flags);
- AddStringSummary(appkit_category_sp,
+ AddStringSummary(corefoundation_category_sp,
"@\"${var.month%d}/${var.day%d}/${var.year%d} ${var.hour%d}:${var.minute%d}:${var.second}\"",
ConstString("CFGregorianDate"),
appkit_flags);
diff --git a/contrib/llvm/tools/lldb/source/DataFormatters/LibCxx.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/LibCxx.cpp
index 21e1046..6380d97 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/LibCxx.cpp
+++ b/contrib/llvm/tools/lldb/source/DataFormatters/LibCxx.cpp
@@ -26,19 +26,64 @@ using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::formatters;
+bool
+lldb_private::formatters::LibcxxSmartPointerSummaryProvider (ValueObject& valobj, Stream& stream)
+{
+ ValueObjectSP valobj_sp(valobj.GetNonSyntheticValue());
+ if (!valobj_sp)
+ return false;
+ ValueObjectSP ptr_sp(valobj_sp->GetChildMemberWithName(ConstString("__ptr_"), true));
+ ValueObjectSP count_sp(valobj_sp->GetChildAtNamePath( {ConstString("__cntrl_"),ConstString("__shared_owners_")} ));
+ ValueObjectSP weakcount_sp(valobj_sp->GetChildAtNamePath( {ConstString("__cntrl_"),ConstString("__shared_weak_owners_")} ));
+
+ if (!ptr_sp)
+ return false;
+
+ if (ptr_sp->GetValueAsUnsigned(0) == 0)
+ {
+ stream.Printf("nullptr");
+ return true;
+ }
+ else
+ {
+ bool print_pointee = false;
+ Error error;
+ ValueObjectSP pointee_sp = ptr_sp->Dereference(error);
+ if (pointee_sp && error.Success())
+ {
+ if (pointee_sp->DumpPrintableRepresentation(stream,
+ ValueObject::eValueObjectRepresentationStyleSummary,
+ lldb::eFormatInvalid,
+ ValueObject::ePrintableRepresentationSpecialCasesDisable,
+ false))
+ print_pointee = true;
+ }
+ if (!print_pointee)
+ stream.Printf("ptr = 0x%" PRIx64, ptr_sp->GetValueAsUnsigned(0));
+ }
+
+ if (count_sp)
+ stream.Printf(" strong=%" PRIu64, 1+count_sp->GetValueAsUnsigned(0));
+
+ if (weakcount_sp)
+ stream.Printf(" weak=%" PRIu64, 1+weakcount_sp->GetValueAsUnsigned(0));
+
+ return true;
+}
+
lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::LibcxxVectorBoolSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
SyntheticChildrenFrontEnd(*valobj_sp.get()),
+m_bool_type(),
m_exe_ctx_ref(),
m_count(0),
m_base_data_address(0),
-m_options()
+m_children()
{
if (valobj_sp)
+ {
Update();
- m_options.SetCoerceToId(false);
- m_options.SetUnwindOnError(true);
- m_options.SetKeepInMemory(true);
- m_options.SetUseDynamic(lldb::eDynamicCanRunTarget);
+ m_bool_type = valobj_sp->GetClangType().GetBasicTypeFromAST(lldb::eBasicTypeBool);
+ }
}
size_t
@@ -50,10 +95,16 @@ lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::CalculateNumChildre
lldb::ValueObjectSP
lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::GetChildAtIndex (size_t idx)
{
+ auto iter = m_children.find(idx),
+ end = m_children.end();
+ if (iter != end)
+ return iter->second;
if (idx >= m_count)
return ValueObjectSP();
if (m_base_data_address == 0 || m_count == 0)
return ValueObjectSP();
+ if (!m_bool_type)
+ return ValueObjectSP();
size_t byte_idx = (idx >> 3); // divide by 8 to get byte index
size_t bit_index = (idx & 7); // efficient idx % 8 for bit index
lldb::addr_t byte_location = m_base_data_address + byte_idx;
@@ -88,15 +139,15 @@ lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::GetChildAtIndex (si
return ValueObjectSP();
}
bool bit_set = ((byte & mask) != 0);
- Target& target(process_sp->GetTarget());
ValueObjectSP retval_sp;
- if (bit_set)
- target.EvaluateExpression("(bool)true", NULL, retval_sp);
- else
- target.EvaluateExpression("(bool)false", NULL, retval_sp);
+ DataBufferSP buffer_sp(new DataBufferHeap(m_bool_type.GetByteSize(),0));
+ if (bit_set && buffer_sp && buffer_sp->GetBytes())
+ *(buffer_sp->GetBytes()) = 1; // regardless of endianness, anything non-zero is true
StreamString name; name.Printf("[%zu]",idx);
+ DataExtractor data(buffer_sp, process_sp->GetByteOrder(), process_sp->GetAddressByteSize());
+ retval_sp = ValueObject::CreateValueObjectFromData(name.GetData(), data, m_exe_ctx_ref, m_bool_type);
if (retval_sp)
- retval_sp->SetName(ConstString(name.GetData()));
+ m_children[idx] = retval_sp;
return retval_sp;
}
@@ -113,6 +164,7 @@ lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::GetChildAtIndex (si
bool
lldb_private::formatters::LibcxxVectorBoolSyntheticFrontEnd::Update()
{
+ m_children.clear();
ValueObjectSP valobj_sp = m_backend.GetSP();
if (!valobj_sp)
return false;
diff --git a/contrib/llvm/tools/lldb/source/DataFormatters/LibCxxUnorderedMap.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/LibCxxUnorderedMap.cpp
index b73d3bf..05b41d0 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/LibCxxUnorderedMap.cpp
+++ b/contrib/llvm/tools/lldb/source/DataFormatters/LibCxxUnorderedMap.cpp
@@ -84,7 +84,8 @@ lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::GetChildAtInde
stream.Printf("[%zu]",idx);
DataExtractor data;
val_hash.first->GetData(data);
- ExecutionContext exe_ctx = val_hash.first->GetExecutionContextRef().Lock();
+ const bool thread_and_frame_only_if_stopped = true;
+ ExecutionContext exe_ctx = val_hash.first->GetExecutionContextRef().Lock(thread_and_frame_only_if_stopped);
return val_hash.first->CreateValueObjectFromData(stream.GetData(),
data,
exe_ctx,
diff --git a/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategory.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategory.cpp
index a02560e..322d1cf 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategory.cpp
+++ b/contrib/llvm/tools/lldb/source/DataFormatters/TypeCategory.cpp
@@ -21,15 +21,11 @@ using namespace lldb_private;
TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener* clist,
ConstString name) :
-m_value_nav(new ValueNavigator("format",clist)),
-m_regex_value_nav(new RegexValueNavigator("regex-format",clist)),
-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)),
+m_format_cont("format","regex-format",clist),
+m_summary_cont("summary","regex-summary",clist),
+m_filter_cont("filter","regex-filter",clist),
#ifndef LLDB_DISABLE_PYTHON
-m_synth_nav(new SynthNavigator("synth",clist)),
-m_regex_synth_nav(new RegexSynthNavigator("regex-synth",clist)),
+m_synth_cont("synth","regex-synth",clist),
#endif
m_enabled(false),
m_change_listener(clist),
@@ -45,9 +41,9 @@ TypeCategoryImpl::Get (ValueObject& valobj,
{
if (!IsEnabled())
return false;
- if (GetValueNavigator()->Get(candidates, entry, reason))
+ if (GetTypeFormatsContainer()->Get(candidates, entry, reason))
return true;
- bool regex = GetRegexValueNavigator()->Get(candidates, entry, reason);
+ bool regex = GetRegexTypeFormatsContainer()->Get(candidates, entry, reason);
if (regex && reason)
*reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
return regex;
@@ -61,9 +57,9 @@ TypeCategoryImpl::Get (ValueObject& valobj,
{
if (!IsEnabled())
return false;
- if (GetSummaryNavigator()->Get(candidates, entry, reason))
+ if (GetTypeSummariesContainer()->Get(candidates, entry, reason))
return true;
- bool regex = GetRegexSummaryNavigator()->Get(candidates, entry, reason);
+ bool regex = GetRegexTypeSummariesContainer()->Get(candidates, entry, reason);
if (regex && reason)
*reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
return regex;
@@ -82,16 +78,16 @@ TypeCategoryImpl::Get (ValueObject& valobj,
bool regex_filter = false;
// first find both Filter and Synth, and then check which is most recent
- if (!GetFilterNavigator()->Get(candidates, filter_sp, &reason_filter))
- regex_filter = GetRegexFilterNavigator()->Get (candidates, filter_sp, &reason_filter);
+ if (!GetTypeFiltersContainer()->Get(candidates, filter_sp, &reason_filter))
+ regex_filter = GetRegexTypeFiltersContainer()->Get (candidates, filter_sp, &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(candidates, synth, &reason_synth))
- regex_synth = GetRegexSyntheticNavigator()->Get (candidates, synth, &reason_synth);
+ if (!GetTypeSyntheticsContainer()->Get(candidates, synth, &reason_synth))
+ regex_synth = GetRegexTypeSyntheticsContainer()->Get (candidates, synth, &reason_synth);
if (!filter_sp.get() && !synth.get())
return false;
else if (!filter_sp.get() && synth.get())
@@ -137,25 +133,25 @@ void
TypeCategoryImpl::Clear (FormatCategoryItems items)
{
if ( (items & eFormatCategoryItemValue) == eFormatCategoryItemValue )
- m_value_nav->Clear();
+ GetTypeFormatsContainer()->Clear();
if ( (items & eFormatCategoryItemRegexValue) == eFormatCategoryItemRegexValue )
- m_regex_value_nav->Clear();
+ GetRegexTypeFormatsContainer()->Clear();
if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
- m_summary_nav->Clear();
+ GetTypeSummariesContainer()->Clear();
if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
- m_regex_summary_nav->Clear();
+ GetRegexTypeSummariesContainer()->Clear();
if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
- m_filter_nav->Clear();
+ GetTypeFiltersContainer()->Clear();
if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
- m_regex_filter_nav->Clear();
+ GetRegexTypeFiltersContainer()->Clear();
#ifndef LLDB_DISABLE_PYTHON
if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
- m_synth_nav->Clear();
+ GetTypeSyntheticsContainer()->Clear();
if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
- m_regex_synth_nav->Clear();
+ GetRegexTypeSyntheticsContainer()->Clear();
#endif
}
@@ -166,25 +162,25 @@ TypeCategoryImpl::Delete (ConstString name,
bool success = false;
if ( (items & eFormatCategoryItemValue) == eFormatCategoryItemValue )
- success = m_value_nav->Delete(name) || success;
+ success = GetTypeFormatsContainer()->Delete(name) || success;
if ( (items & eFormatCategoryItemRegexValue) == eFormatCategoryItemRegexValue )
- success = m_regex_value_nav->Delete(name) || success;
+ success = GetRegexTypeFormatsContainer()->Delete(name) || success;
if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
- success = m_summary_nav->Delete(name) || success;
+ success = GetTypeSummariesContainer()->Delete(name) || success;
if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
- success = m_regex_summary_nav->Delete(name) || success;
+ success = GetRegexTypeSummariesContainer()->Delete(name) || success;
if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
- success = m_filter_nav->Delete(name) || success;
+ success = GetTypeFiltersContainer()->Delete(name) || success;
if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
- success = m_regex_filter_nav->Delete(name) || success;
+ success = GetRegexTypeFiltersContainer()->Delete(name) || success;
#ifndef LLDB_DISABLE_PYTHON
if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
- success = m_synth_nav->Delete(name) || success;
+ success = GetTypeSyntheticsContainer()->Delete(name) || success;
if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
- success = m_regex_synth_nav->Delete(name) || success;
+ success = GetRegexTypeSyntheticsContainer()->Delete(name) || success;
#endif
return success;
}
@@ -195,25 +191,25 @@ TypeCategoryImpl::GetCount (FormatCategoryItems items)
uint32_t count = 0;
if ( (items & eFormatCategoryItemValue) == eFormatCategoryItemValue )
- count += m_value_nav->GetCount();
+ count += GetTypeFormatsContainer()->GetCount();
if ( (items & eFormatCategoryItemRegexValue) == eFormatCategoryItemRegexValue )
- count += m_regex_value_nav->GetCount();
+ count += GetRegexTypeFormatsContainer()->GetCount();
if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
- count += m_summary_nav->GetCount();
+ count += GetTypeSummariesContainer()->GetCount();
if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
- count += m_regex_summary_nav->GetCount();
+ count += GetRegexTypeSummariesContainer()->GetCount();
if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
- count += m_filter_nav->GetCount();
+ count += GetTypeFiltersContainer()->GetCount();
if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
- count += m_regex_filter_nav->GetCount();
+ count += GetRegexTypeFiltersContainer()->GetCount();
#ifndef LLDB_DISABLE_PYTHON
if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
- count += m_synth_nav->GetCount();
+ count += GetTypeSyntheticsContainer()->GetCount();
if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
- count += m_regex_synth_nav->GetCount();
+ count += GetRegexTypeSyntheticsContainer()->GetCount();
#endif
return count;
}
@@ -237,7 +233,7 @@ TypeCategoryImpl::AnyMatches(ConstString type_name,
if ( (items & eFormatCategoryItemValue) == eFormatCategoryItemValue )
{
- if (m_value_nav->Get(type_name, format_sp))
+ if (GetTypeFormatsContainer()->Get(type_name, format_sp))
{
if (matching_category)
*matching_category = m_name.GetCString();
@@ -248,7 +244,7 @@ TypeCategoryImpl::AnyMatches(ConstString type_name,
}
if ( (items & eFormatCategoryItemRegexValue) == eFormatCategoryItemRegexValue )
{
- if (m_regex_value_nav->Get(type_name, format_sp))
+ if (GetRegexTypeFormatsContainer()->Get(type_name, format_sp))
{
if (matching_category)
*matching_category = m_name.GetCString();
@@ -260,7 +256,7 @@ TypeCategoryImpl::AnyMatches(ConstString type_name,
if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
{
- if (m_summary_nav->Get(type_name, summary_sp))
+ if (GetTypeSummariesContainer()->Get(type_name, summary_sp))
{
if (matching_category)
*matching_category = m_name.GetCString();
@@ -271,7 +267,7 @@ TypeCategoryImpl::AnyMatches(ConstString type_name,
}
if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
{
- if (m_regex_summary_nav->Get(type_name, summary_sp))
+ if (GetRegexTypeSummariesContainer()->Get(type_name, summary_sp))
{
if (matching_category)
*matching_category = m_name.GetCString();
@@ -283,7 +279,7 @@ TypeCategoryImpl::AnyMatches(ConstString type_name,
if ( (items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter )
{
- if (m_filter_nav->Get(type_name, filter_sp))
+ if (GetTypeFiltersContainer()->Get(type_name, filter_sp))
{
if (matching_category)
*matching_category = m_name.GetCString();
@@ -294,7 +290,7 @@ TypeCategoryImpl::AnyMatches(ConstString type_name,
}
if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
{
- if (m_regex_filter_nav->Get(type_name, filter_sp))
+ if (GetRegexTypeFiltersContainer()->Get(type_name, filter_sp))
{
if (matching_category)
*matching_category = m_name.GetCString();
@@ -307,7 +303,7 @@ TypeCategoryImpl::AnyMatches(ConstString type_name,
#ifndef LLDB_DISABLE_PYTHON
if ( (items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth )
{
- if (m_synth_nav->Get(type_name, synth_sp))
+ if (GetTypeSyntheticsContainer()->Get(type_name, synth_sp))
{
if (matching_category)
*matching_category = m_name.GetCString();
@@ -318,7 +314,7 @@ TypeCategoryImpl::AnyMatches(ConstString type_name,
}
if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
{
- if (m_regex_synth_nav->Get(type_name, synth_sp))
+ if (GetRegexTypeSyntheticsContainer()->Get(type_name, synth_sp))
{
if (matching_category)
*matching_category = m_name.GetCString();
@@ -331,66 +327,66 @@ TypeCategoryImpl::AnyMatches(ConstString type_name,
return false;
}
-TypeCategoryImpl::ValueNavigator::MapValueType
+TypeCategoryImpl::FormatContainer::MapValueType
TypeCategoryImpl::GetFormatForType (lldb::TypeNameSpecifierImplSP type_sp)
{
- ValueNavigator::MapValueType retval;
+ FormatContainer::MapValueType retval;
if (type_sp)
{
if (type_sp->IsRegex())
- m_regex_value_nav->GetExact(ConstString(type_sp->GetName()),retval);
+ GetRegexTypeFormatsContainer()->GetExact(ConstString(type_sp->GetName()),retval);
else
- m_value_nav->GetExact(ConstString(type_sp->GetName()),retval);
+ GetTypeFormatsContainer()->GetExact(ConstString(type_sp->GetName()),retval);
}
return retval;
}
-TypeCategoryImpl::SummaryNavigator::MapValueType
+TypeCategoryImpl::SummaryContainer::MapValueType
TypeCategoryImpl::GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
{
- SummaryNavigator::MapValueType retval;
+ SummaryContainer::MapValueType retval;
if (type_sp)
{
if (type_sp->IsRegex())
- m_regex_summary_nav->GetExact(ConstString(type_sp->GetName()),retval);
+ GetRegexTypeSummariesContainer()->GetExact(ConstString(type_sp->GetName()),retval);
else
- m_summary_nav->GetExact(ConstString(type_sp->GetName()),retval);
+ GetTypeSummariesContainer()->GetExact(ConstString(type_sp->GetName()),retval);
}
return retval;
}
-TypeCategoryImpl::FilterNavigator::MapValueType
+TypeCategoryImpl::FilterContainer::MapValueType
TypeCategoryImpl::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
{
- FilterNavigator::MapValueType retval;
+ FilterContainer::MapValueType retval;
if (type_sp)
{
if (type_sp->IsRegex())
- m_regex_filter_nav->GetExact(ConstString(type_sp->GetName()),retval);
+ GetRegexTypeFiltersContainer()->GetExact(ConstString(type_sp->GetName()),retval);
else
- m_filter_nav->GetExact(ConstString(type_sp->GetName()),retval);
+ GetTypeFiltersContainer()->GetExact(ConstString(type_sp->GetName()),retval);
}
return retval;
}
#ifndef LLDB_DISABLE_PYTHON
-TypeCategoryImpl::SynthNavigator::MapValueType
+TypeCategoryImpl::SynthContainer::MapValueType
TypeCategoryImpl::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
{
- SynthNavigator::MapValueType retval;
+ SynthContainer::MapValueType retval;
if (type_sp)
{
if (type_sp->IsRegex())
- m_regex_synth_nav->GetExact(ConstString(type_sp->GetName()),retval);
+ GetRegexTypeSyntheticsContainer()->GetExact(ConstString(type_sp->GetName()),retval);
else
- m_synth_nav->GetExact(ConstString(type_sp->GetName()),retval);
+ GetTypeSyntheticsContainer()->GetExact(ConstString(type_sp->GetName()),retval);
}
return retval;
@@ -400,74 +396,74 @@ TypeCategoryImpl::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
lldb::TypeNameSpecifierImplSP
TypeCategoryImpl::GetTypeNameSpecifierForSummaryAtIndex (size_t index)
{
- if (index < m_summary_nav->GetCount())
- return m_summary_nav->GetTypeNameSpecifierAtIndex(index);
+ if (index < GetTypeSummariesContainer()->GetCount())
+ return GetTypeSummariesContainer()->GetTypeNameSpecifierAtIndex(index);
else
- return m_regex_summary_nav->GetTypeNameSpecifierAtIndex(index-m_summary_nav->GetCount());
+ return GetRegexTypeSummariesContainer()->GetTypeNameSpecifierAtIndex(index-GetTypeSummariesContainer()->GetCount());
}
-TypeCategoryImpl::ValueNavigator::MapValueType
+TypeCategoryImpl::FormatContainer::MapValueType
TypeCategoryImpl::GetFormatAtIndex (size_t index)
{
- if (index < m_value_nav->GetCount())
- return m_value_nav->GetAtIndex(index);
+ if (index < GetTypeFormatsContainer()->GetCount())
+ return GetTypeFormatsContainer()->GetAtIndex(index);
else
- return m_regex_value_nav->GetAtIndex(index-m_value_nav->GetCount());
+ return GetRegexTypeFormatsContainer()->GetAtIndex(index-GetTypeFormatsContainer()->GetCount());
}
-TypeCategoryImpl::SummaryNavigator::MapValueType
+TypeCategoryImpl::SummaryContainer::MapValueType
TypeCategoryImpl::GetSummaryAtIndex (size_t index)
{
- if (index < m_summary_nav->GetCount())
- return m_summary_nav->GetAtIndex(index);
+ if (index < GetTypeSummariesContainer()->GetCount())
+ return GetTypeSummariesContainer()->GetAtIndex(index);
else
- return m_regex_summary_nav->GetAtIndex(index-m_summary_nav->GetCount());
+ return GetRegexTypeSummariesContainer()->GetAtIndex(index-GetTypeSummariesContainer()->GetCount());
}
-TypeCategoryImpl::FilterNavigator::MapValueType
+TypeCategoryImpl::FilterContainer::MapValueType
TypeCategoryImpl::GetFilterAtIndex (size_t index)
{
- if (index < m_filter_nav->GetCount())
- return m_filter_nav->GetAtIndex(index);
+ if (index < GetTypeFiltersContainer()->GetCount())
+ return GetTypeFiltersContainer()->GetAtIndex(index);
else
- return m_regex_filter_nav->GetAtIndex(index-m_filter_nav->GetCount());
+ return GetRegexTypeFiltersContainer()->GetAtIndex(index-GetTypeFiltersContainer()->GetCount());
}
lldb::TypeNameSpecifierImplSP
TypeCategoryImpl::GetTypeNameSpecifierForFormatAtIndex (size_t index)
{
- if (index < m_value_nav->GetCount())
- return m_value_nav->GetTypeNameSpecifierAtIndex(index);
+ if (index < GetTypeFormatsContainer()->GetCount())
+ return GetTypeFormatsContainer()->GetTypeNameSpecifierAtIndex(index);
else
- return m_regex_value_nav->GetTypeNameSpecifierAtIndex(index-m_value_nav->GetCount());
+ return GetRegexTypeFormatsContainer()->GetTypeNameSpecifierAtIndex(index-GetTypeFormatsContainer()->GetCount());
}
lldb::TypeNameSpecifierImplSP
TypeCategoryImpl::GetTypeNameSpecifierForFilterAtIndex (size_t index)
{
- if (index < m_filter_nav->GetCount())
- return m_filter_nav->GetTypeNameSpecifierAtIndex(index);
+ if (index < GetTypeFiltersContainer()->GetCount())
+ return GetTypeFiltersContainer()->GetTypeNameSpecifierAtIndex(index);
else
- return m_regex_filter_nav->GetTypeNameSpecifierAtIndex(index-m_filter_nav->GetCount());
+ return GetRegexTypeFiltersContainer()->GetTypeNameSpecifierAtIndex(index-GetTypeFiltersContainer()->GetCount());
}
#ifndef LLDB_DISABLE_PYTHON
-TypeCategoryImpl::SynthNavigator::MapValueType
+TypeCategoryImpl::SynthContainer::MapValueType
TypeCategoryImpl::GetSyntheticAtIndex (size_t index)
{
- if (index < m_synth_nav->GetCount())
- return m_synth_nav->GetAtIndex(index);
+ if (index < GetTypeSyntheticsContainer()->GetCount())
+ return GetTypeSyntheticsContainer()->GetAtIndex(index);
else
- return m_regex_synth_nav->GetAtIndex(index-m_synth_nav->GetCount());
+ return GetRegexTypeSyntheticsContainer()->GetAtIndex(index-GetTypeSyntheticsContainer()->GetCount());
}
lldb::TypeNameSpecifierImplSP
TypeCategoryImpl::GetTypeNameSpecifierForSyntheticAtIndex (size_t index)
{
- if (index < m_synth_nav->GetCount())
- return m_synth_nav->GetTypeNameSpecifierAtIndex(index);
+ if (index < GetTypeSyntheticsContainer()->GetCount())
+ return GetTypeSyntheticsContainer()->GetTypeNameSpecifierAtIndex(index);
else
- return m_regex_synth_nav->GetTypeNameSpecifierAtIndex(index - m_synth_nav->GetCount());
+ return GetRegexTypeSyntheticsContainer()->GetTypeNameSpecifierAtIndex(index - GetTypeSyntheticsContainer()->GetCount());
}
#endif
diff --git a/contrib/llvm/tools/lldb/source/DataFormatters/TypeFormat.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/TypeFormat.cpp
index 7f18dde..a72f551 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/TypeFormat.cpp
+++ b/contrib/llvm/tools/lldb/source/DataFormatters/TypeFormat.cpp
@@ -25,21 +25,117 @@
#include "lldb/DataFormatters/TypeFormat.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/TypeList.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) :
+TypeFormatImpl::TypeFormatImpl (const Flags& flags) :
m_flags(flags),
+m_my_revision(0)
+{
+}
+
+
+TypeFormatImpl_Format::TypeFormatImpl_Format (lldb::Format f,
+ const TypeFormatImpl::Flags& flags) :
+TypeFormatImpl(flags),
m_format (f)
{
}
+bool
+TypeFormatImpl_Format::FormatObject (ValueObject *valobj,
+ std::string& dest) const
+{
+ if (!valobj)
+ return false;
+ if (valobj->GetClangType().IsAggregateType () == false)
+ {
+ const Value& value(valobj->GetValue());
+ const Value::ContextType context_type = value.GetContextType();
+ ExecutionContext exe_ctx (valobj->GetExecutionContextRef());
+ DataExtractor data;
+
+ if (context_type == Value::eContextTypeRegisterInfo)
+ {
+ const RegisterInfo *reg_info = value.GetRegisterInfo();
+ if (reg_info)
+ {
+ valobj->GetData(data);
+
+ StreamString reg_sstr;
+ data.Dump (&reg_sstr,
+ 0,
+ GetFormat(),
+ reg_info->byte_size,
+ 1,
+ UINT32_MAX,
+ LLDB_INVALID_ADDRESS,
+ 0,
+ 0,
+ exe_ctx.GetBestExecutionContextScope());
+ dest.swap(reg_sstr.GetString());
+ }
+ }
+ else
+ {
+ ClangASTType clang_type = valobj->GetClangType ();
+ if (clang_type)
+ {
+ // put custom bytes to display in the DataExtractor to override the default value logic
+ if (GetFormat() == eFormatCString)
+ {
+ lldb_private::Flags type_flags(clang_type.GetTypeInfo(NULL)); // disambiguate w.r.t. TypeFormatImpl::Flags
+ if (type_flags.Test(ClangASTType::eTypeIsPointer) && !type_flags.Test(ClangASTType::eTypeIsObjC))
+ {
+ // if we are dumping a pointer as a c-string, get the pointee data as a string
+ TargetSP target_sp(valobj->GetTargetSP());
+ if (target_sp)
+ {
+ size_t max_len = target_sp->GetMaximumSizeOfStringSummary();
+ Error error;
+ DataBufferSP buffer_sp(new DataBufferHeap(max_len+1,0));
+ Address address(valobj->GetPointerValue());
+ if (target_sp->ReadCStringFromMemory(address, (char*)buffer_sp->GetBytes(), max_len, error) && error.Success())
+ data.SetData(buffer_sp);
+ }
+ }
+ }
+ else
+ valobj->GetData(data);
+
+ StreamString sstr;
+ clang_type.DumpTypeValue (&sstr, // The stream to use for display
+ GetFormat(), // Format to display this type with
+ data, // Data to extract from
+ 0, // Byte offset into "m_data"
+ valobj->GetByteSize(), // Byte size of item in "m_data"
+ valobj->GetBitfieldBitSize(), // Bitfield bit size
+ valobj->GetBitfieldBitOffset(), // Bitfield bit offset
+ exe_ctx.GetBestExecutionContextScope());
+ // Given that we do not want to set the ValueObject's m_error
+ // for a formatting error (or else we wouldn't be able to reformat
+ // until a next update), an empty string is treated as a "false"
+ // return from here, but that's about as severe as we get
+ // ClangASTType::DumpTypeValue() should always return
+ // something, even if that something is an error message
+ if (sstr.GetString().empty())
+ dest.clear();
+ else
+ dest.swap(sstr.GetString());
+ }
+ }
+ return !dest.empty();
+ }
+ else
+ return false;
+}
+
std::string
-TypeFormatImpl::GetDescription()
+TypeFormatImpl_Format::GetDescription()
{
StreamString sstr;
sstr.Printf ("%s%s%s%s",
@@ -50,3 +146,87 @@ TypeFormatImpl::GetDescription()
return sstr.GetString();
}
+TypeFormatImpl_EnumType::TypeFormatImpl_EnumType (ConstString type_name,
+ const TypeFormatImpl::Flags& flags) :
+TypeFormatImpl(flags),
+m_enum_type(type_name),
+m_types()
+{
+}
+
+bool
+TypeFormatImpl_EnumType::FormatObject (ValueObject *valobj,
+ std::string& dest) const
+{
+ dest.clear();
+ if (!valobj)
+ return false;
+ if (valobj->GetClangType().IsAggregateType ())
+ return false;
+ ProcessSP process_sp;
+ TargetSP target_sp;
+ void* valobj_key = (process_sp = valobj->GetProcessSP()).get();
+ if (!valobj_key)
+ valobj_key = (target_sp = valobj->GetTargetSP()).get();
+ else
+ target_sp = process_sp->GetTarget().shared_from_this();
+ if (!valobj_key)
+ return false;
+ auto iter = m_types.find(valobj_key),
+ end = m_types.end();
+ ClangASTType valobj_enum_type;
+ if (iter == end)
+ {
+ // probably a redundant check
+ if (!target_sp)
+ return false;
+ const ModuleList& images(target_sp->GetImages());
+ SymbolContext sc;
+ TypeList types;
+ images.FindTypes(sc, m_enum_type, false, UINT32_MAX, types);
+ if (types.GetSize() == 0)
+ return false;
+ for (lldb::TypeSP type_sp : types.Types())
+ {
+ if (!type_sp)
+ continue;
+ if ( (type_sp->GetClangForwardType().GetTypeInfo() & ClangASTType::eTypeIsEnumeration) == ClangASTType::eTypeIsEnumeration)
+ {
+ valobj_enum_type = type_sp->GetClangFullType();
+ m_types.emplace(valobj_key,valobj_enum_type);
+ break;
+ }
+ }
+ }
+ else
+ valobj_enum_type = iter->second;
+ if (valobj_enum_type.IsValid() == false)
+ return false;
+ DataExtractor data;
+ valobj->GetData(data);
+ ExecutionContext exe_ctx (valobj->GetExecutionContextRef());
+ StreamString sstr;
+ valobj_enum_type.DumpTypeValue(&sstr,
+ lldb::eFormatEnum,
+ data,
+ 0,
+ data.GetByteSize(),
+ 0,
+ 0,
+ exe_ctx.GetBestExecutionContextScope());
+ if (!sstr.GetString().empty())
+ dest.swap(sstr.GetString());
+ return !dest.empty();
+}
+
+std::string
+TypeFormatImpl_EnumType::GetDescription()
+{
+ StreamString sstr;
+ sstr.Printf ("as type %s%s%s%s",
+ m_enum_type.AsCString("<invalid type>"),
+ Cascades() ? "" : " (not cascading)",
+ SkipsPointers() ? " (skip pointers)" : "",
+ SkipsReferences() ? " (skip references)" : "");
+ return sstr.GetString();
+}
diff --git a/contrib/llvm/tools/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/contrib/llvm/tools/lldb/source/DataFormatters/ValueObjectPrinter.cpp
index 5c7f48b..944d6d2 100644
--- a/contrib/llvm/tools/lldb/source/DataFormatters/ValueObjectPrinter.cpp
+++ b/contrib/llvm/tools/lldb/source/DataFormatters/ValueObjectPrinter.cpp
@@ -403,7 +403,6 @@ ValueObjectPrinter::ShouldPrintChildren (bool is_failed_description,
// Use a new temporary pointer depth in case we override the
// current pointer depth below...
- uint32_t curr_ptr_depth = m_ptr_depth;
if (is_ptr || is_ref)
{
@@ -413,7 +412,7 @@ ValueObjectPrinter::ShouldPrintChildren (bool is_failed_description,
if (m_valobj->GetPointerValue (&ptr_address_type) == 0)
return false;
- else if (is_ref && m_curr_depth == 0)
+ else if (is_ref && m_curr_depth == 0 && curr_ptr_depth == 0)
{
// If this is the root object (depth is zero) that we are showing
// and it is a reference, and no pointer depth has been supplied
@@ -468,7 +467,7 @@ ValueObjectPrinter::PrintChild (ValueObjectSP child_sp,
ValueObjectPrinter child_printer(child_sp.get(),
m_stream,
child_options,
- (IsPtr() || IsRef()) ? curr_ptr_depth - 1 : curr_ptr_depth,
+ (IsPtr() || IsRef()) && curr_ptr_depth >= 1 ? curr_ptr_depth - 1 : curr_ptr_depth,
m_curr_depth + 1);
child_printer.PrintValueObject();
}
OpenPOWER on IntegriCloud