aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/DataFormatters
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/DataFormatters')
-rw-r--r--include/lldb/DataFormatters/CXXFormatterFunctions.h114
-rw-r--r--include/lldb/DataFormatters/FormatManager.h27
-rw-r--r--include/lldb/DataFormatters/TypeFormat.h9
-rw-r--r--include/lldb/DataFormatters/TypeSummary.h18
-rw-r--r--include/lldb/DataFormatters/ValueObjectPrinter.h2
5 files changed, 48 insertions, 122 deletions
diff --git a/include/lldb/DataFormatters/CXXFormatterFunctions.h b/include/lldb/DataFormatters/CXXFormatterFunctions.h
index c53ef9589eea..753ffa1bae1b 100644
--- a/include/lldb/DataFormatters/CXXFormatterFunctions.h
+++ b/include/lldb/DataFormatters/CXXFormatterFunctions.h
@@ -19,6 +19,7 @@
#include "lldb/DataFormatters/FormatClasses.h"
#include "lldb/DataFormatters/TypeSynthetic.h"
#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Target.h"
#include "clang/AST/ASTContext.h"
@@ -26,6 +27,9 @@
namespace lldb_private {
namespace formatters
{
+ StackFrame*
+ GetViableFrame (ExecutionContext exe_ctx);
+
bool
ExtractValueFromObjCExpression (ValueObject &valobj,
const char* target_type,
@@ -140,6 +144,9 @@ namespace lldb_private {
NSStringSummaryProvider (ValueObject& valobj, Stream& stream);
bool
+ NSTaggedString_SummaryProvider (ObjCLanguageRuntime::ClassDescriptorSP descriptor, Stream& stream);
+
+ bool
NSAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream);
bool
@@ -176,113 +183,6 @@ namespace lldb_private {
extern template bool
ObjCSELSummaryProvider<false> (ValueObject&, Stream&);
- class NSArrayMSyntheticFrontEnd : public SyntheticChildrenFrontEnd
- {
- private:
- struct DataDescriptor_32
- {
- uint32_t _used;
- uint32_t _priv1 : 2 ;
- uint32_t _size : 30;
- uint32_t _priv2 : 2;
- uint32_t offset : 30;
- uint32_t _priv3;
- uint32_t _data;
- };
- struct DataDescriptor_64
- {
- uint64_t _used;
- uint64_t _priv1 : 2 ;
- uint64_t _size : 62;
- uint64_t _priv2 : 2;
- uint64_t offset : 62;
- uint32_t _priv3;
- uint64_t _data;
- };
- public:
- NSArrayMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
- virtual size_t
- CalculateNumChildren ();
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx);
-
- virtual bool
- Update();
-
- virtual bool
- MightHaveChildren ();
-
- virtual size_t
- GetIndexOfChildWithName (const ConstString &name);
-
- virtual
- ~NSArrayMSyntheticFrontEnd ();
- private:
- ExecutionContextRef m_exe_ctx_ref;
- uint8_t m_ptr_size;
- DataDescriptor_32 *m_data_32;
- DataDescriptor_64 *m_data_64;
- ClangASTType m_id_type;
- std::vector<lldb::ValueObjectSP> m_children;
- };
-
- class NSArrayISyntheticFrontEnd : public SyntheticChildrenFrontEnd
- {
- public:
- NSArrayISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
- virtual size_t
- CalculateNumChildren ();
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx);
-
- virtual bool
- Update();
-
- virtual bool
- MightHaveChildren ();
-
- virtual size_t
- GetIndexOfChildWithName (const ConstString &name);
-
- virtual
- ~NSArrayISyntheticFrontEnd ();
- private:
- ExecutionContextRef m_exe_ctx_ref;
- uint8_t m_ptr_size;
- uint64_t m_items;
- lldb::addr_t m_data_ptr;
- ClangASTType m_id_type;
- std::vector<lldb::ValueObjectSP> m_children;
- };
-
- class NSArrayCodeRunningSyntheticFrontEnd : public SyntheticChildrenFrontEnd
- {
- public:
- NSArrayCodeRunningSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
- virtual size_t
- CalculateNumChildren ();
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex (size_t idx);
-
- virtual bool
- Update();
-
- virtual bool
- MightHaveChildren ();
-
- virtual size_t
- GetIndexOfChildWithName (const ConstString &name);
-
- virtual
- ~NSArrayCodeRunningSyntheticFrontEnd ();
- };
-
SyntheticChildrenFrontEnd* NSArraySyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
class NSDictionaryISyntheticFrontEnd : public SyntheticChildrenFrontEnd
diff --git a/include/lldb/DataFormatters/FormatManager.h b/include/lldb/DataFormatters/FormatManager.h
index 24ec877ee515..0b9144dffa17 100644
--- a/include/lldb/DataFormatters/FormatManager.h
+++ b/include/lldb/DataFormatters/FormatManager.h
@@ -25,6 +25,7 @@
#include "lldb/DataFormatters/TypeCategoryMap.h"
#include <atomic>
+#include <functional>
namespace lldb_private {
@@ -39,6 +40,14 @@ class FormatManager : public IFormatChangeListener
typedef TypeCategoryMap::MapType::iterator CategoryMapIterator;
public:
+ template <typename FormatterType>
+ using HardcodedFormatterFinder = std::function<typename FormatterType::SharedPointer (lldb_private::ValueObject&,
+ lldb::DynamicValueType,
+ FormatManager&)>;
+
+ template <typename FormatterType>
+ using HardcodedFormatterFinders = std::vector<HardcodedFormatterFinder<FormatterType>>;
+
typedef TypeCategoryMap::CallbackType CategoryCallback;
FormatManager ();
@@ -260,6 +269,19 @@ private:
ConstString m_vectortypes_category_name;
ConstString m_appkit_category_name;
+ HardcodedFormatterFinders<TypeFormatImpl> m_hardcoded_formats;
+ HardcodedFormatterFinders<TypeSummaryImpl> m_hardcoded_summaries;
+ HardcodedFormatterFinders<SyntheticChildren> m_hardcoded_synthetics;
+
+ lldb::TypeFormatImplSP
+ GetHardcodedFormat (ValueObject&,lldb::DynamicValueType);
+
+ lldb::TypeSummaryImplSP
+ GetHardcodedSummaryFormat (ValueObject&,lldb::DynamicValueType);
+
+ lldb::SyntheticChildrenSP
+ GetHardcodedSyntheticChildren (ValueObject&,lldb::DynamicValueType);
+
TypeCategoryMap&
GetCategories ()
{
@@ -281,8 +303,11 @@ private:
void
LoadObjCFormatters ();
+
+ void
+ LoadHardcodedFormatters ();
};
} // namespace lldb_private
-
+
#endif // lldb_FormatManager_h_
diff --git a/include/lldb/DataFormatters/TypeFormat.h b/include/lldb/DataFormatters/TypeFormat.h
index 20fa8f2d4e7f..1090d7843e53 100644
--- a/include/lldb/DataFormatters/TypeFormat.h
+++ b/include/lldb/DataFormatters/TypeFormat.h
@@ -14,6 +14,7 @@
// C++ Includes
#include <string>
+#include <unordered_map>
// Other libraries and framework includes
@@ -135,7 +136,7 @@ namespace lldb_private {
typedef std::shared_ptr<TypeFormatImpl> SharedPointer;
typedef bool(*ValueCallback)(void*, ConstString, const lldb::TypeFormatImplSP&);
- virtual ~TypeFormatImpl () = default;
+ virtual ~TypeFormatImpl ();
bool
Cascades () const
@@ -229,7 +230,7 @@ namespace lldb_private {
typedef std::shared_ptr<TypeFormatImpl_Format> SharedPointer;
typedef bool(*ValueCallback)(void*, ConstString, const TypeFormatImpl_Format::SharedPointer&);
- virtual ~TypeFormatImpl_Format () = default;
+ virtual ~TypeFormatImpl_Format ();
lldb::Format
GetFormat () const
@@ -272,7 +273,7 @@ namespace lldb_private {
typedef std::shared_ptr<TypeFormatImpl_EnumType> SharedPointer;
typedef bool(*ValueCallback)(void*, ConstString, const TypeFormatImpl_EnumType::SharedPointer&);
- ~TypeFormatImpl_EnumType () = default;
+ ~TypeFormatImpl_EnumType ();
ConstString
GetTypeName ()
@@ -301,7 +302,7 @@ namespace lldb_private {
protected:
ConstString m_enum_type;
- mutable std::map<void*,ClangASTType> m_types;
+ mutable std::unordered_map<void*,ClangASTType> m_types;
private:
DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_EnumType);
diff --git a/include/lldb/DataFormatters/TypeSummary.h b/include/lldb/DataFormatters/TypeSummary.h
index 1c195ab2ba4d..699494336cc6 100644
--- a/include/lldb/DataFormatters/TypeSummary.h
+++ b/include/lldb/DataFormatters/TypeSummary.h
@@ -225,14 +225,14 @@ namespace lldb_private {
return m_flags.GetSkipReferences();
}
- bool
- DoesPrintChildren () const
+ virtual bool
+ DoesPrintChildren (ValueObject* valobj) const
{
return !m_flags.GetDontShowChildren();
}
- bool
- DoesPrintValue () const
+ virtual bool
+ DoesPrintValue (ValueObject* valobj) const
{
return !m_flags.GetDontShowValue();
}
@@ -243,8 +243,8 @@ namespace lldb_private {
return m_flags.GetShowMembersOneLiner();
}
- bool
- HideNames () const
+ virtual bool
+ HideNames (ValueObject* valobj) const
{
return m_flags.GetHideItemNames();
}
@@ -267,13 +267,13 @@ namespace lldb_private {
m_flags.SetSkipReferences(value);
}
- void
+ virtual void
SetDoesPrintChildren (bool value)
{
m_flags.SetDontShowChildren(!value);
}
- void
+ virtual void
SetDoesPrintValue (bool value)
{
m_flags.SetDontShowValue(!value);
@@ -285,7 +285,7 @@ namespace lldb_private {
m_flags.SetShowMembersOneLiner(value);
}
- void
+ virtual void
SetHideNames (bool value)
{
m_flags.SetHideItemNames(value);
diff --git a/include/lldb/DataFormatters/ValueObjectPrinter.h b/include/lldb/DataFormatters/ValueObjectPrinter.h
index 375bb50c876d..bfe2d9c402d3 100644
--- a/include/lldb/DataFormatters/ValueObjectPrinter.h
+++ b/include/lldb/DataFormatters/ValueObjectPrinter.h
@@ -386,7 +386,7 @@ private:
std::string m_summary;
std::string m_error;
- friend class StringSummaryFormat;
+ friend struct StringSummaryFormat;
DISALLOW_COPY_AND_ASSIGN(ValueObjectPrinter);
};