diff --git a/lldb/include/lldb/DataFormatters/TypeFormat.h b/lldb/include/lldb/DataFormatters/TypeFormat.h index 1090d7843e53..8aa7c60b4938 100644 --- a/lldb/include/lldb/DataFormatters/TypeFormat.h +++ b/lldb/include/lldb/DataFormatters/TypeFormat.h @@ -115,6 +115,22 @@ namespace lldb_private { return *this; } + bool + GetNonCacheable () const + { + return (m_flags & lldb::eTypeOptionNonCacheable) == lldb::eTypeOptionNonCacheable; + } + + Flags& + SetNonCacheable (bool value = true) + { + if (value) + m_flags |= lldb::eTypeOptionNonCacheable; + else + m_flags &= ~lldb::eTypeOptionNonCacheable; + return *this; + } + uint32_t GetValue () { @@ -153,6 +169,11 @@ namespace lldb_private { { return m_flags.GetSkipReferences(); } + bool + NonCacheable () const + { + return m_flags.GetNonCacheable(); + } void SetCascades (bool value) @@ -171,6 +192,12 @@ namespace lldb_private { { m_flags.SetSkipReferences(value); } + + void + SetNonCacheable (bool value) + { + m_flags.SetNonCacheable(value); + } uint32_t GetOptions () diff --git a/lldb/include/lldb/DataFormatters/TypeSummary.h b/lldb/include/lldb/DataFormatters/TypeSummary.h index fbbeddf4ac59..c2838eac27f1 100644 --- a/lldb/include/lldb/DataFormatters/TypeSummary.h +++ b/lldb/include/lldb/DataFormatters/TypeSummary.h @@ -211,6 +211,22 @@ namespace lldb_private { return *this; } + bool + GetNonCacheable () const + { + return (m_flags & lldb::eTypeOptionNonCacheable) == lldb::eTypeOptionNonCacheable; + } + + Flags& + SetNonCacheable (bool value = true) + { + if (value) + m_flags |= lldb::eTypeOptionNonCacheable; + else + m_flags &= ~lldb::eTypeOptionNonCacheable; + return *this; + } + uint32_t GetValue () { @@ -252,6 +268,11 @@ namespace lldb_private { { return m_flags.GetSkipReferences(); } + bool + NonCacheable () const + { + return m_flags.GetNonCacheable(); + } virtual bool DoesPrintChildren (ValueObject* valobj) const @@ -319,6 +340,12 @@ namespace lldb_private { m_flags.SetHideItemNames(value); } + virtual void + SetNonCacheable (bool value) + { + m_flags.SetNonCacheable(value); + } + uint32_t GetOptions () { diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h b/lldb/include/lldb/DataFormatters/TypeSynthetic.h index c2b1a66cba01..ff6691c9a1b8 100644 --- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h +++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h @@ -236,6 +236,22 @@ namespace lldb_private { return *this; } + bool + GetNonCacheable () const + { + return (m_flags & lldb::eTypeOptionNonCacheable) == lldb::eTypeOptionNonCacheable; + } + + Flags& + SetNonCacheable (bool value = true) + { + if (value) + m_flags |= lldb::eTypeOptionNonCacheable; + else + m_flags &= ~lldb::eTypeOptionNonCacheable; + return *this; + } + uint32_t GetValue () { @@ -277,6 +293,11 @@ namespace lldb_private { { return m_flags.GetSkipReferences(); } + bool + NonCacheable () const + { + return m_flags.GetNonCacheable(); + } void SetCascades (bool value) @@ -296,6 +317,12 @@ namespace lldb_private { m_flags.SetSkipReferences(value); } + void + SetNonCacheable (bool value) + { + m_flags.SetNonCacheable(value); + } + uint32_t GetOptions () { diff --git a/lldb/include/lldb/DataFormatters/TypeValidator.h b/lldb/include/lldb/DataFormatters/TypeValidator.h index b501e47943fa..d06fac01f824 100644 --- a/lldb/include/lldb/DataFormatters/TypeValidator.h +++ b/lldb/include/lldb/DataFormatters/TypeValidator.h @@ -115,6 +115,22 @@ public: return *this; } + bool + GetNonCacheable () const + { + return (m_flags & lldb::eTypeOptionNonCacheable) == lldb::eTypeOptionNonCacheable; + } + + Flags& + SetNonCacheable (bool value = true) + { + if (value) + m_flags |= lldb::eTypeOptionNonCacheable; + else + m_flags &= ~lldb::eTypeOptionNonCacheable; + return *this; + } + uint32_t GetValue () { @@ -153,6 +169,11 @@ public: { return m_flags.GetSkipReferences(); } + bool + NonCacheable () const + { + return m_flags.GetNonCacheable(); + } void SetCascades (bool value) @@ -172,6 +193,12 @@ public: m_flags.SetSkipReferences(value); } + void + SetNonCacheable (bool value) + { + m_flags.SetNonCacheable(value); + } + uint32_t GetOptions () { diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index ea8910525866..28614ffb23e1 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -736,7 +736,8 @@ namespace lldb { eTypeOptionHideChildren = (1u << 3), eTypeOptionHideValue = (1u << 4), eTypeOptionShowOneLiner = (1u << 5), - eTypeOptionHideNames = (1u << 6) + eTypeOptionHideNames = (1u << 6), + eTypeOptionNonCacheable = (1u << 7) }; //---------------------------------------------------------------------- diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index 5e0adcb28d1b..47456ba5c45b 100644 --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -662,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", @@ -719,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", @@ -777,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", @@ -822,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", @@ -1611,7 +1615,7 @@ FormatManager::LoadHardcodedFormatters() [](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), + 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))