diff options
Diffstat (limited to 'include/lldb/DataFormatters')
-rw-r--r-- | include/lldb/DataFormatters/DumpValueObjectOptions.h | 4 | ||||
-rw-r--r-- | include/lldb/DataFormatters/FormatCache.h | 6 | ||||
-rw-r--r-- | include/lldb/DataFormatters/FormatManager.h | 3 | ||||
-rw-r--r-- | include/lldb/DataFormatters/FormattersContainer.h | 151 | ||||
-rw-r--r-- | include/lldb/DataFormatters/FormattersHelpers.h | 30 | ||||
-rw-r--r-- | include/lldb/DataFormatters/TypeCategory.h | 7 | ||||
-rw-r--r-- | include/lldb/DataFormatters/TypeCategoryMap.h | 12 | ||||
-rw-r--r-- | include/lldb/DataFormatters/TypeSynthetic.h | 8 | ||||
-rw-r--r-- | include/lldb/DataFormatters/ValueObjectPrinter.h | 4 | ||||
-rw-r--r-- | include/lldb/DataFormatters/VectorIterator.h | 4 |
10 files changed, 105 insertions, 124 deletions
diff --git a/include/lldb/DataFormatters/DumpValueObjectOptions.h b/include/lldb/DataFormatters/DumpValueObjectOptions.h index f65ee7b958452..e90bd1bcadcd4 100644 --- a/include/lldb/DataFormatters/DumpValueObjectOptions.h +++ b/include/lldb/DataFormatters/DumpValueObjectOptions.h @@ -152,6 +152,9 @@ public: DumpValueObjectOptions& SetRevealEmptyAggregates (bool reveal = true); + + DumpValueObjectOptions& + SetElementCount (uint32_t element_count = 0); public: uint32_t m_max_depth = UINT32_MAX; @@ -163,6 +166,7 @@ public: lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown; PointerDepth m_max_ptr_depth; DeclPrintingHelper m_decl_printing_helper; + uint32_t m_element_count = 0; bool m_use_synthetic : 1; bool m_scope_already_checked : 1; bool m_flat_output : 1; diff --git a/include/lldb/DataFormatters/FormatCache.h b/include/lldb/DataFormatters/FormatCache.h index 9f1e078f71990..645fbc7ddf10b 100644 --- a/include/lldb/DataFormatters/FormatCache.h +++ b/include/lldb/DataFormatters/FormatCache.h @@ -13,12 +13,12 @@ // C Includes // C++ Includes #include <map> +#include <mutex> // Other libraries and framework includes // Project includes #include "lldb/lldb-public.h" #include "lldb/Core/ConstString.h" -#include "lldb/Host/Mutex.h" namespace lldb_private { class FormatCache @@ -82,8 +82,8 @@ private: }; typedef std::map<ConstString,Entry> CacheMap; CacheMap m_map; - Mutex m_mutex; - + std::recursive_mutex m_mutex; + uint64_t m_cache_hits; uint64_t m_cache_misses; diff --git a/include/lldb/DataFormatters/FormatManager.h b/include/lldb/DataFormatters/FormatManager.h index 24ba5a7f0aa55..27dc31d259d0a 100644 --- a/include/lldb/DataFormatters/FormatManager.h +++ b/include/lldb/DataFormatters/FormatManager.h @@ -15,6 +15,7 @@ #include <atomic> #include <initializer_list> #include <map> +#include <mutex> #include <vector> // Other libraries and framework includes @@ -289,7 +290,7 @@ private: std::atomic<uint32_t> m_last_revision; FormatCache m_format_cache; - Mutex m_language_categories_mutex; + std::recursive_mutex m_language_categories_mutex; LanguageCategories m_language_categories_map; NamedSummariesMap m_named_summaries_map; TypeCategoryMap m_categories_map; diff --git a/include/lldb/DataFormatters/FormattersContainer.h b/include/lldb/DataFormatters/FormattersContainer.h index dcd08211f19b8..c4694463b6769 100644 --- a/include/lldb/DataFormatters/FormattersContainer.h +++ b/include/lldb/DataFormatters/FormattersContainer.h @@ -15,6 +15,7 @@ #include <functional> #include <map> #include <memory> +#include <mutex> #include <string> // Other libraries and framework includes @@ -81,33 +82,27 @@ public: typedef std::map<KeyType, ValueSP> MapType; typedef typename MapType::iterator MapIterator; typedef std::function<bool(KeyType, const ValueSP&)> ForEachCallback; - - FormatMap(IFormatChangeListener* lst) : - m_map(), - m_map_mutex(Mutex::eMutexTypeRecursive), - listener(lst) - { - } - + + FormatMap(IFormatChangeListener *lst) : m_map(), m_map_mutex(), listener(lst) {} + void - Add(KeyType name, - const ValueSP& entry) + Add(KeyType name, const ValueSP &entry) { if (listener) entry->GetRevision() = listener->GetCurrentRevision(); else entry->GetRevision() = 0; - Mutex::Locker locker(m_map_mutex); + std::lock_guard<std::recursive_mutex> guard(m_map_mutex); m_map[name] = entry; if (listener) listener->Changed(); } - + bool - Delete (KeyType name) + Delete(KeyType name) { - Mutex::Locker locker(m_map_mutex); + std::lock_guard<std::recursive_mutex> guard(m_map_mutex); MapIterator iter = m_map.find(name); if (iter == m_map.end()) return false; @@ -116,34 +111,33 @@ public: listener->Changed(); return true; } - + void - Clear () + Clear() { - Mutex::Locker locker(m_map_mutex); + std::lock_guard<std::recursive_mutex> guard(m_map_mutex); m_map.clear(); if (listener) listener->Changed(); } - + bool - Get(KeyType name, - ValueSP& entry) + Get(KeyType name, ValueSP &entry) { - Mutex::Locker locker(m_map_mutex); + std::lock_guard<std::recursive_mutex> guard(m_map_mutex); MapIterator iter = m_map.find(name); if (iter == m_map.end()) return false; entry = iter->second; return true; } - + void - ForEach (ForEachCallback callback) + ForEach(ForEachCallback callback) { if (callback) { - Mutex::Locker locker(m_map_mutex); + std::lock_guard<std::recursive_mutex> guard(m_map_mutex); MapIterator pos, end = m_map.end(); for (pos = m_map.begin(); pos != end; pos++) { @@ -153,17 +147,17 @@ public: } } } - + uint32_t GetCount () { return m_map.size(); } - + ValueSP - GetValueAtIndex (size_t index) + GetValueAtIndex(size_t index) { - Mutex::Locker locker(m_map_mutex); + std::lock_guard<std::recursive_mutex> guard(m_map_mutex); MapIterator iter = m_map.begin(); MapIterator end = m_map.end(); while (index > 0) @@ -175,11 +169,11 @@ public: } return iter->second; } - + KeyType - GetKeyAtIndex (size_t index) + GetKeyAtIndex(size_t index) { - Mutex::Locker locker(m_map_mutex); + std::lock_guard<std::recursive_mutex> guard(m_map_mutex); MapIterator iter = m_map.begin(); MapIterator end = m_map.end(); while (index > 0) @@ -191,24 +185,24 @@ public: } return iter->first; } - + protected: - MapType m_map; - Mutex m_map_mutex; + MapType m_map; + std::recursive_mutex m_map_mutex; IFormatChangeListener* listener; - + MapType& map () { return m_map; } - - Mutex& - mutex () + + std::recursive_mutex & + mutex() { return m_map_mutex; } - + friend class FormattersContainer<KeyType, ValueType>; friend class FormatManager; }; @@ -332,24 +326,23 @@ protected: } bool - Delete_Impl (ConstString type, lldb::RegularExpressionSP *dummy) - { - Mutex& x_mutex = m_format_map.mutex(); - lldb_private::Mutex::Locker locker(x_mutex); - MapIterator pos, end = m_format_map.map().end(); - for (pos = m_format_map.map().begin(); pos != end; pos++) - { - lldb::RegularExpressionSP regex = pos->first; - if ( ::strcmp(type.AsCString(),regex->GetText()) == 0) - { - m_format_map.map().erase(pos); - if (m_format_map.listener) - m_format_map.listener->Changed(); - return true; - } - } - return false; - } + Delete_Impl(ConstString type, lldb::RegularExpressionSP *dummy) + { + std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex()); + MapIterator pos, end = m_format_map.map().end(); + for (pos = m_format_map.map().begin(); pos != end; pos++) + { + lldb::RegularExpressionSP regex = pos->first; + if (::strcmp(type.AsCString(), regex->GetText()) == 0) + { + m_format_map.map().erase(pos); + if (m_format_map.listener) + m_format_map.listener->Changed(); + return true; + } + } + return false; + } bool Get_Impl (ConstString type, MapValueType& entry, ConstString *dummy) @@ -385,36 +378,34 @@ protected: } bool - Get_Impl (ConstString key, MapValueType& value, lldb::RegularExpressionSP *dummy) - { - const char* key_cstr = key.AsCString(); - if (!key_cstr) - return false; - Mutex& x_mutex = m_format_map.mutex(); - lldb_private::Mutex::Locker locker(x_mutex); - MapIterator pos, end = m_format_map.map().end(); - for (pos = m_format_map.map().begin(); pos != end; pos++) - { - lldb::RegularExpressionSP regex = pos->first; - if (regex->Execute(key_cstr)) - { - value = pos->second; - return true; - } - } - return false; + Get_Impl(ConstString key, MapValueType &value, lldb::RegularExpressionSP *dummy) + { + const char *key_cstr = key.AsCString(); + if (!key_cstr) + return false; + std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex()); + MapIterator pos, end = m_format_map.map().end(); + for (pos = m_format_map.map().begin(); pos != end; pos++) + { + lldb::RegularExpressionSP regex = pos->first; + if (regex->Execute(key_cstr)) + { + value = pos->second; + return true; + } + } + return false; } - + bool - GetExact_Impl (ConstString key, MapValueType& value, lldb::RegularExpressionSP *dummy) + GetExact_Impl(ConstString key, MapValueType &value, lldb::RegularExpressionSP *dummy) { - Mutex& x_mutex = m_format_map.mutex(); - lldb_private::Mutex::Locker locker(x_mutex); + std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex()); MapIterator pos, end = m_format_map.map().end(); for (pos = m_format_map.map().begin(); pos != end; pos++) { lldb::RegularExpressionSP regex = pos->first; - if (strcmp(regex->GetText(),key.AsCString()) == 0) + if (strcmp(regex->GetText(), key.AsCString()) == 0) { value = pos->second; return true; diff --git a/include/lldb/DataFormatters/FormattersHelpers.h b/include/lldb/DataFormatters/FormattersHelpers.h index 4627a61e94f14..0622230f67972 100644 --- a/include/lldb/DataFormatters/FormattersHelpers.h +++ b/include/lldb/DataFormatters/FormattersHelpers.h @@ -75,35 +75,7 @@ namespace lldb_private { ScriptedSyntheticChildren::Flags flags, bool regex = false); #endif - - StackFrame* - GetViableFrame (ExecutionContext exe_ctx); - - bool - ExtractValueFromObjCExpression (ValueObject &valobj, - const char* target_type, - const char* selector, - uint64_t &value); - - bool - ExtractSummaryFromObjCExpression (ValueObject &valobj, - const char* target_type, - const char* selector, - Stream &stream, - lldb::LanguageType lang_type); - - lldb::ValueObjectSP - CallSelectorOnObject (ValueObject &valobj, - const char* return_type, - const char* selector, - uint64_t index); - - lldb::ValueObjectSP - CallSelectorOnObject (ValueObject &valobj, - const char* return_type, - const char* selector, - const char* key); - + size_t ExtractIndexFromString (const char* item_name); diff --git a/include/lldb/DataFormatters/TypeCategory.h b/include/lldb/DataFormatters/TypeCategory.h index 075d31d1cf6f7..c6d7d7b0f8782 100644 --- a/include/lldb/DataFormatters/TypeCategory.h +++ b/include/lldb/DataFormatters/TypeCategory.h @@ -14,6 +14,7 @@ // C++ Includes #include <initializer_list> #include <memory> +#include <mutex> #include <string> #include <vector> @@ -519,9 +520,9 @@ namespace lldb_private { bool m_enabled; IFormatChangeListener* m_change_listener; - - Mutex m_mutex; - + + std::recursive_mutex m_mutex; + ConstString m_name; std::vector<lldb::LanguageType> m_languages; diff --git a/include/lldb/DataFormatters/TypeCategoryMap.h b/include/lldb/DataFormatters/TypeCategoryMap.h index 8afeaf87cec5c..2cc589809a7c7 100644 --- a/include/lldb/DataFormatters/TypeCategoryMap.h +++ b/include/lldb/DataFormatters/TypeCategoryMap.h @@ -15,6 +15,7 @@ #include <functional> #include <list> #include <map> +#include <mutex> // Other libraries and framework includes // Project includes @@ -131,8 +132,8 @@ namespace lldb_private { return ptr.get() == other.get(); } }; - - Mutex m_map_mutex; + + std::recursive_mutex m_map_mutex; IFormatChangeListener* listener; MapType m_map; @@ -147,12 +148,13 @@ namespace lldb_private { { return m_active_categories; } - - Mutex& mutex () + + std::recursive_mutex & + mutex() { return m_map_mutex; } - + friend class FormattersContainer<KeyType, ValueType>; friend class FormatManager; }; diff --git a/include/lldb/DataFormatters/TypeSynthetic.h b/include/lldb/DataFormatters/TypeSynthetic.h index 90e5730288c4e..ceb600aed69a7 100644 --- a/include/lldb/DataFormatters/TypeSynthetic.h +++ b/include/lldb/DataFormatters/TypeSynthetic.h @@ -91,6 +91,11 @@ namespace lldb_private { virtual lldb::ValueObjectSP GetSyntheticValue () { return nullptr; } + // if this function returns a non-empty ConstString, then clients are expected to use the return + // as the name of the type of this ValueObject for display purposes + virtual ConstString + GetSyntheticTypeName () { return ConstString(); } + typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer; typedef std::unique_ptr<SyntheticChildrenFrontEnd> AutoPointer; @@ -607,6 +612,9 @@ namespace lldb_private { lldb::ValueObjectSP GetSyntheticValue() override; + ConstString + GetSyntheticTypeName () override; + typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer; private: diff --git a/include/lldb/DataFormatters/ValueObjectPrinter.h b/include/lldb/DataFormatters/ValueObjectPrinter.h index 23d7ee2edf502..c7591b019685c 100644 --- a/include/lldb/DataFormatters/ValueObjectPrinter.h +++ b/include/lldb/DataFormatters/ValueObjectPrinter.h @@ -153,6 +153,10 @@ protected: void PrintChildrenPostamble (bool print_dotdotdot); + lldb::ValueObjectSP + GenerateChild (ValueObject* synth_valobj, + size_t idx); + void PrintChild (lldb::ValueObjectSP child_sp, const DumpValueObjectOptions::PointerDepth& curr_ptr_depth); diff --git a/include/lldb/DataFormatters/VectorIterator.h b/include/lldb/DataFormatters/VectorIterator.h index 3d96ee4c093b9..0bacd51ca63ef 100644 --- a/include/lldb/DataFormatters/VectorIterator.h +++ b/include/lldb/DataFormatters/VectorIterator.h @@ -38,9 +38,7 @@ namespace lldb_private { size_t GetIndexOfChildWithName(const ConstString &name) override; - - ~VectorIteratorSyntheticFrontEnd() override; - + private: ExecutionContextRef m_exe_ctx_ref; ConstString m_item_name; |