diff options
author | Enrico Granata <granata.enrico@gmail.com> | 2012-02-15 02:34:21 +0000 |
---|---|---|
committer | Enrico Granata <granata.enrico@gmail.com> | 2012-02-15 02:34:21 +0000 |
commit | 061858ce61c6c3c19a964b572cbcdc8304b287b9 (patch) | |
tree | 3ae02b9436e1924547076d088193649922d3bf41 /lldb/scripts/Python/interface | |
parent | b228a86fcfd165b06919e43d28b8f1d0713c9802 (diff) | |
download | bcm5719-llvm-061858ce61c6c3c19a964b572cbcdc8304b287b9.tar.gz bcm5719-llvm-061858ce61c6c3c19a964b572cbcdc8304b287b9.zip |
<rdar://problem/10062621>
New public API for handling formatters: creating, deleting, modifying categories, and formatters, and managing type/formatter association.
This provides SB classes for each of the main object types involved in providing formatter support:
SBTypeCategory
SBTypeFilter
SBTypeFormat
SBTypeSummary
SBTypeSynthetic
plus, an SBTypeNameSpecifier class that is used on the public API layer to abstract the notion that formatters can be applied to plain type-names as well as to regular expressions
For naming consistency, this patch also renames a lot of formatters-related classes.
Plus, the changes in how flags are handled that started with summaries is now extended to other classes as well. A new enum (lldb::eTypeOption) is meant to support this on the public side.
The patch also adds several new calls to the formatter infrastructure that are used to implement by-index accessing and several other design changes required to accommodate the new API layer.
An architectural change is introduced in that backing objects for formatters now become writable. On the public API layer, CoW is implemented to prevent unwanted propagation of changes.
Lastly, there are some modifications in how the "default" category is constructed and managed in relation to other categories.
llvm-svn: 150558
Diffstat (limited to 'lldb/scripts/Python/interface')
-rw-r--r-- | lldb/scripts/Python/interface/SBDebugger.i | 31 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBTypeCategory.i | 140 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBTypeFilter.i | 69 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBTypeFormat.i | 64 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBTypeNameSpecifier.i | 57 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBTypeSummary.i | 93 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBTypeSynthetic.i | 74 |
7 files changed, 528 insertions, 0 deletions
diff --git a/lldb/scripts/Python/interface/SBDebugger.i b/lldb/scripts/Python/interface/SBDebugger.i index 1882021f5e9..5048a83d0ec 100644 --- a/lldb/scripts/Python/interface/SBDebugger.i +++ b/lldb/scripts/Python/interface/SBDebugger.i @@ -321,6 +321,37 @@ public: void SetCloseInputOnEOF (bool b); + + lldb::SBTypeCategory + GetCategory (const char* category_name); + + lldb::SBTypeCategory + CreateCategory (const char* category_name); + + bool + DeleteCategory (const char* category_name); + + uint32_t + GetNumCategories (); + + lldb::SBTypeCategory + GetCategoryAtIndex (uint32_t); + + lldb::SBTypeCategory + GetDefaultCategory(); + + lldb::SBTypeFormat + GetFormatForType (lldb::SBTypeNameSpecifier); + + lldb::SBTypeSummary + GetSummaryForType (lldb::SBTypeNameSpecifier); + + lldb::SBTypeFilter + GetFilterForType (lldb::SBTypeNameSpecifier); + + lldb::SBTypeSynthetic + GetSyntheticForType (lldb::SBTypeNameSpecifier); + }; // class SBDebugger } // namespace lldb diff --git a/lldb/scripts/Python/interface/SBTypeCategory.i b/lldb/scripts/Python/interface/SBTypeCategory.i new file mode 100644 index 00000000000..fa1a63c7df3 --- /dev/null +++ b/lldb/scripts/Python/interface/SBTypeCategory.i @@ -0,0 +1,140 @@ +//===-- SWIG Interface for SBTypeCategory---------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +namespace lldb { + + %feature("docstring", + "Represents a category that can contain formatters for types. + ") SBTypeCategory; + + class SBTypeCategory + { + public: + + SBTypeCategory(); + + SBTypeCategory (const lldb::SBTypeCategory &rhs); + + ~SBTypeCategory (); + + bool + IsValid() const; + + bool + GetEnabled (); + + void + SetEnabled (bool); + + const char* + GetName(); + + bool + GetDescription (lldb::SBStream &description, + lldb::DescriptionLevel description_level); + + uint32_t + GetNumFormats (); + + uint32_t + GetNumSummaries (); + + uint32_t + GetNumFilters (); + + uint32_t + GetNumSynthetics (); + + lldb::SBTypeNameSpecifier + GetTypeNameSpecifierForFilterAtIndex (uint32_t); + + lldb::SBTypeNameSpecifier + GetTypeNameSpecifierForFormatAtIndex (uint32_t); + + lldb::SBTypeNameSpecifier + GetTypeNameSpecifierForSummaryAtIndex (uint32_t); + + lldb::SBTypeNameSpecifier + GetTypeNameSpecifierForSyntheticAtIndex (uint32_t); + + lldb::SBTypeFilter + GetFilterForType (lldb::SBTypeNameSpecifier); + + lldb::SBTypeFormat + GetFormatForType (lldb::SBTypeNameSpecifier); + + lldb::SBTypeSummary + GetSummaryForType (lldb::SBTypeNameSpecifier); + + lldb::SBTypeSynthetic + GetSyntheticForType (lldb::SBTypeNameSpecifier); + + lldb::SBTypeFilter + GetFilterAtIndex (uint32_t); + + lldb::SBTypeFormat + GetFormatAtIndex (uint32_t); + + lldb::SBTypeSummary + GetSummaryAtIndex (uint32_t); + + lldb::SBTypeSynthetic + GetSyntheticAtIndex (uint32_t); + + bool + AddTypeFormat (lldb::SBTypeNameSpecifier, + lldb::SBTypeFormat); + + bool + DeleteTypeFormat (lldb::SBTypeNameSpecifier); + + bool + AddTypeSummary (lldb::SBTypeNameSpecifier, + lldb::SBTypeSummary); + + bool + DeleteTypeSummary (lldb::SBTypeNameSpecifier); + + bool + AddTypeFilter (lldb::SBTypeNameSpecifier, + lldb::SBTypeFilter); + + bool + DeleteTypeFilter (lldb::SBTypeNameSpecifier); + + bool + AddTypeSynthetic (lldb::SBTypeNameSpecifier, + lldb::SBTypeSynthetic); + + bool + DeleteTypeSynthetic (lldb::SBTypeNameSpecifier); + + %pythoncode %{ + __swig_getmethods__["num_formats"] = GetNumFormats + if _newclass: x = property(GetNumFormats, None) + __swig_getmethods__["num_summaries"] = GetNumSummaries + if _newclass: x = property(GetNumSummaries, None) + __swig_getmethods__["num_filters"] = GetNumFilters + if _newclass: x = property(GetNumFilters, None) + __swig_getmethods__["num_synthetics"] = GetNumSynthetics + if _newclass: x = property(GetNumSynthetics, None) + + __swig_getmethods__["name"] = GetName + if _newclass: x = property(GetName, None) + + __swig_getmethods__["enabled"] = GetEnabled + __swig_setmethods__["enabled"] = SetEnabled + if _newclass: x = property(GetEnabled, SetEnabled) + %} + + }; + + +} // namespace lldb + diff --git a/lldb/scripts/Python/interface/SBTypeFilter.i b/lldb/scripts/Python/interface/SBTypeFilter.i new file mode 100644 index 00000000000..046859a68bf --- /dev/null +++ b/lldb/scripts/Python/interface/SBTypeFilter.i @@ -0,0 +1,69 @@ +//===-- SWIG Interface for SBTypeFilter----------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +namespace lldb { + + %feature("docstring", + "Represents a filter that can be associated to one or more types. + ") SBTypeFilter; + + class SBTypeFilter + { + public: + + SBTypeFilter(); + + SBTypeFilter (uint32_t options); + + SBTypeFilter (const lldb::SBTypeFilter &rhs); + + ~SBTypeFilter (); + + bool + IsValid() const; + + bool + IsEqualTo (lldb::SBTypeFilter &rhs); + + uint32_t + GetNumberOfExpressionPaths (); + + const char* + GetExpressionPathAtIndex (uint32_t i); + + bool + ReplaceExpressionPathAtIndex (uint32_t i, const char* item); + + void + AppendExpressionPath (const char* item); + + void + Clear(); + + uint32_t + GetOptions(); + + void + SetOptions (uint32_t); + + bool + GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level); + + %pythoncode %{ + __swig_getmethods__["options"] = GetOptions + __swig_setmethods__["options"] = SetOptions + if _newclass: x = property(GetOptions, SetOptions) + + __swig_getmethods__["count"] = GetNumberOfExpressionPaths + if _newclass: x = property(GetNumberOfExpressionPaths, None) + %} + + }; + +} // namespace lldb diff --git a/lldb/scripts/Python/interface/SBTypeFormat.i b/lldb/scripts/Python/interface/SBTypeFormat.i new file mode 100644 index 00000000000..2116a02affc --- /dev/null +++ b/lldb/scripts/Python/interface/SBTypeFormat.i @@ -0,0 +1,64 @@ +//===-- SWIG Interface for SBTypeFormat----------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +namespace lldb { + + %feature("docstring", + "Represents a format that can be associated to one or more types. + ") SBTypeFormat; + + class SBTypeFormat + { + public: + + SBTypeFormat(); + + SBTypeFormat (lldb::Format format, uint32_t options = 0); + + SBTypeFormat (const lldb::SBTypeFormat &rhs); + + ~SBTypeFormat (); + + bool + IsValid() const; + + bool + IsEqualTo (lldb::SBTypeFormat &rhs); + + lldb::Format + GetFormat (); + + uint32_t + GetOptions(); + + void + SetFormat (lldb::Format); + + void + SetOptions (uint32_t); + + bool + GetDescription (lldb::SBStream &description, + lldb::DescriptionLevel description_level); + + %pythoncode %{ + __swig_getmethods__["format"] = GetFormat + __swig_setmethods__["format"] = SetFormat + if _newclass: x = property(GetFormat, SetFormat) + + __swig_getmethods__["options"] = GetOptions + __swig_setmethods__["options"] = SetOptions + if _newclass: x = property(GetOptions, SetOptions) + %} + + }; + + +} // namespace lldb + diff --git a/lldb/scripts/Python/interface/SBTypeNameSpecifier.i b/lldb/scripts/Python/interface/SBTypeNameSpecifier.i new file mode 100644 index 00000000000..f50761c602e --- /dev/null +++ b/lldb/scripts/Python/interface/SBTypeNameSpecifier.i @@ -0,0 +1,57 @@ +//===-- SWIG Interface for SBTypeNameSpecifier---------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +namespace lldb { + + %feature("docstring", + "Represents a general way to provide a type name to LLDB APIs. + ") SBTypeNameSpecifier; + + class SBTypeNameSpecifier + { + public: + + SBTypeNameSpecifier(); + + SBTypeNameSpecifier (const char* name, + bool is_regex = false); + + SBTypeNameSpecifier (const lldb::SBTypeNameSpecifier &rhs); + + ~SBTypeNameSpecifier (); + + bool + IsValid() const; + + bool + IsEqualTo (lldb::SBTypeNameSpecifier &rhs); + + const char* + GetName(); + + bool + IsRegex(); + + bool + GetDescription (lldb::SBStream &description, + lldb::DescriptionLevel description_level); + + %pythoncode %{ + __swig_getmethods__["name"] = GetName + if _newclass: x = property(GetName, None) + + __swig_getmethods__["is_regex"] = IsRegex + if _newclass: x = property(IsRegex, None) + %} + + + }; + +} // namespace lldb + diff --git a/lldb/scripts/Python/interface/SBTypeSummary.i b/lldb/scripts/Python/interface/SBTypeSummary.i new file mode 100644 index 00000000000..f96897752bf --- /dev/null +++ b/lldb/scripts/Python/interface/SBTypeSummary.i @@ -0,0 +1,93 @@ +//===-- SWIG Interface for SBTypeSummary---------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +namespace lldb { + + %feature("docstring", + "Represents a summary that can be associated to one or more types. + ") SBTypeSummary; + + class SBTypeSummary + { + public: + + SBTypeSummary(); + + static SBTypeSummary + CreateWithSummaryString (const char* data, uint32_t options = 0); + + static SBTypeSummary + CreateWithFunctionName (const char* data, uint32_t options = 0); + + static SBTypeSummary + CreateWithScriptCode (const char* data, uint32_t options = 0); + + SBTypeSummary (const lldb::SBTypeSummary &rhs); + + ~SBTypeSummary (); + + bool + IsValid() const; + + bool + IsEqualTo (lldb::SBTypeSummary &rhs); + + bool + IsFunctionCode(); + + bool + IsFunctionName(); + + bool + IsSummaryString(); + + const char* + GetData (); + + void + SetSummaryString (const char* data); + + void + SetFunctionName (const char* data); + + void + SetFunctionCode (const char* data); + + uint32_t + GetOptions (); + + void + SetOptions (uint32_t); + + bool + GetDescription (lldb::SBStream &description, + lldb::DescriptionLevel description_level); + + %pythoncode %{ + __swig_getmethods__["options"] = GetOptions + __swig_setmethods__["options"] = SetOptions + if _newclass: x = property(GetOptions, SetOptions) + + __swig_getmethods__["is_summary_string"] = IsSummaryString + if _newclass: x = property(IsSummaryString, None) + + __swig_getmethods__["is_function_name"] = IsFunctionName + if _newclass: x = property(IsFunctionName, None) + + __swig_getmethods__["is_function_code"] = IsFunctionCode + if _newclass: x = property(IsFunctionCode, None) + + __swig_getmethods__["summary_data"] = GetData + if _newclass: x = property(GetData, None) + %} + + }; + +} // namespace lldb + diff --git a/lldb/scripts/Python/interface/SBTypeSynthetic.i b/lldb/scripts/Python/interface/SBTypeSynthetic.i new file mode 100644 index 00000000000..3e785ff9b5c --- /dev/null +++ b/lldb/scripts/Python/interface/SBTypeSynthetic.i @@ -0,0 +1,74 @@ +//===-- SWIG Interface for SBTypeSynthetic-------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +namespace lldb { + + %feature("docstring", + "Represents a summary that can be associated to one or more types. + ") SBTypeSynthetic; + + class SBTypeSynthetic + { + public: + + SBTypeSynthetic(); + + static lldb::SBTypeSynthetic + CreateWithClassName (const char* data, uint32_t options = 0); + + static lldb::SBTypeSynthetic + CreateWithScriptCode (const char* data, uint32_t options = 0); + + SBTypeSynthetic (const lldb::SBTypeSynthetic &rhs); + + ~SBTypeSynthetic (); + + bool + IsValid() const; + + bool + IsEqualTo (lldb::SBTypeSynthetic &rhs); + + bool + IsClassCode(); + + const char* + GetData (); + + void + SetClassName (const char* data); + + void + SetClassCode (const char* data); + + uint32_t + GetOptions (); + + void + SetOptions (uint32_t); + + bool + GetDescription (lldb::SBStream &description, + lldb::DescriptionLevel description_level); + + %pythoncode %{ + __swig_getmethods__["options"] = GetOptions + __swig_setmethods__["options"] = SetOptions + if _newclass: x = property(GetOptions, SetOptions) + + __swig_getmethods__["contains_code"] = IsClassCode + if _newclass: x = property(IsClassCode, None) + + __swig_getmethods__["synthetic_data"] = GetData + if _newclass: x = property(GetData, None) + %} + + }; + +} // namespace lldb |