aboutsummaryrefslogtreecommitdiff
path: root/lldb/bindings
diff options
context:
space:
mode:
authorMed Ismail Bennani <ismail@bennani.ma>2023-08-31 20:34:56 +0100
committerMed Ismail Bennani <ismail@bennani.ma>2023-08-31 20:35:10 +0100
commit6813ef37377e8d8fadf6efe01e1ed80cc53b9c86 (patch)
treeec78789e9c73e18684266e0a019e42a8d472a2f3 /lldb/bindings
parentb80fa58bdc54d80d7482549f9d17106c6f544a16 (diff)
downloadllvm-6813ef37377e8d8fadf6efe01e1ed80cc53b9c86.zip
llvm-6813ef37377e8d8fadf6efe01e1ed80cc53b9c86.tar.gz
llvm-6813ef37377e8d8fadf6efe01e1ed80cc53b9c86.tar.bz2
Re-land "[lldb/docs] Silence warnings when generating website"
This patch re-lands f0731d5b61ba with more fixes and improvements. First, this patch removes `__eq__` implementations from classes that didn't implemented `operator!=` on the C++ implementation. This patch removes sphinx document generation for special members such as `__len__`, since there is no straightforward way to skip class that don't implement them. We also don't want to introduce a change in behavior by implementing artifical special members for classes that are missing them. Finally, this patch improve the ergonomics of some classes by implementing special members where it makes sense, i.e. `hex(SBFrame)` is equivalent to `SBFrame.GetPC()`. Differential Revision: https://reviews.llvm.org/D159017 Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Diffstat (limited to 'lldb/bindings')
-rw-r--r--lldb/bindings/interface/SBAddressExtensions.i4
-rw-r--r--lldb/bindings/interface/SBBreakpointListExtensions.i13
-rw-r--r--lldb/bindings/interface/SBBreakpointLocationExtensions.i11
-rw-r--r--lldb/bindings/interface/SBBreakpointNameExtensions.i11
-rw-r--r--lldb/bindings/interface/SBBroadcastExtensions.i10
-rw-r--r--lldb/bindings/interface/SBCompileUnitExtensions.i5
-rw-r--r--lldb/bindings/interface/SBDataExtensions.i2
-rw-r--r--lldb/bindings/interface/SBDeclarationExtensions.i5
-rw-r--r--lldb/bindings/interface/SBErrorExtensions.i3
-rw-r--r--lldb/bindings/interface/SBFileSpecExtensions.i5
-rw-r--r--lldb/bindings/interface/SBFileSpecListExtensions.i15
-rw-r--r--lldb/bindings/interface/SBFrameExtensions.i11
-rw-r--r--lldb/bindings/interface/SBFunctionExtensions.i5
-rw-r--r--lldb/bindings/interface/SBInstructionExtensions.i8
-rw-r--r--lldb/bindings/interface/SBLineEntryExtensions.i10
-rw-r--r--lldb/bindings/interface/SBMemoryRegionInfoExtensions.i17
-rw-r--r--lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i13
-rw-r--r--lldb/bindings/interface/SBModuleExtensions.i5
-rw-r--r--lldb/bindings/interface/SBModuleSpecListExtensions.i16
-rw-r--r--lldb/bindings/interface/SBProcessDocstrings.i4
-rw-r--r--lldb/bindings/interface/SBProcessExtensions.i2
-rw-r--r--lldb/bindings/interface/SBQueueItemExtensions.i8
-rw-r--r--lldb/bindings/interface/SBScriptObjectExtensions.i5
-rw-r--r--lldb/bindings/interface/SBSectionExtensions.i5
-rw-r--r--lldb/bindings/interface/SBStreamExtensions.i7
-rw-r--r--lldb/bindings/interface/SBStructuredDataExtensions.i18
-rw-r--r--lldb/bindings/interface/SBSymbolExtensions.i8
-rw-r--r--lldb/bindings/interface/SBTargetExtensions.i5
-rw-r--r--lldb/bindings/interface/SBThreadCollectionExtensions.i14
-rw-r--r--lldb/bindings/interface/SBThreadExtensions.i5
-rw-r--r--lldb/bindings/interface/SBTypeCategoryExtensions.i5
-rw-r--r--lldb/bindings/interface/SBTypeEnumMemberExtensions.i8
-rw-r--r--lldb/bindings/interface/SBTypeExtensions.i30
-rw-r--r--lldb/bindings/interface/SBTypeFilterExtensions.i5
-rw-r--r--lldb/bindings/interface/SBTypeFormatExtensions.i5
-rw-r--r--lldb/bindings/interface/SBTypeNameSpecifierExtensions.i5
-rw-r--r--lldb/bindings/interface/SBTypeSummaryExtensions.i5
-rw-r--r--lldb/bindings/interface/SBTypeSyntheticExtensions.i5
-rw-r--r--lldb/bindings/interface/SBUnixSignalsExtensions.i7
-rw-r--r--lldb/bindings/interface/SBValueExtensions.i3
-rw-r--r--lldb/bindings/interface/SBWatchpointExtensions.i17
-rw-r--r--lldb/bindings/interfaces.swig12
-rw-r--r--lldb/bindings/python/python-extensions.swig13
43 files changed, 366 insertions, 4 deletions
diff --git a/lldb/bindings/interface/SBAddressExtensions.i b/lldb/bindings/interface/SBAddressExtensions.i
index 9aeba3a..b94cead 100644
--- a/lldb/bindings/interface/SBAddressExtensions.i
+++ b/lldb/bindings/interface/SBAddressExtensions.i
@@ -2,9 +2,9 @@ STRING_EXTENSION_OUTSIDE(SBAddress)
%extend lldb::SBAddress {
#ifdef SWIGPYTHON
- // operator== is a free function, which swig does not handle, so we inject
- // our own equality operator here
%pythoncode%{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
def __eq__(self, other):
return not self.__ne__(other)
%}
diff --git a/lldb/bindings/interface/SBBreakpointListExtensions.i b/lldb/bindings/interface/SBBreakpointListExtensions.i
new file mode 100644
index 0000000..adde0c6
--- /dev/null
+++ b/lldb/bindings/interface/SBBreakpointListExtensions.i
@@ -0,0 +1,13 @@
+%extend lldb::SBBreakpointList {
+#ifdef SWIGPYTHON
+ %pythoncode%{
+ def __len__(self):
+ '''Return the number of breakpoints in a lldb.SBBreakpointList object.'''
+ return self.GetSize()
+
+ def __iter__(self):
+ '''Iterate over all breakpoints in a lldb.SBBreakpointList object.'''
+ return lldb_iter(self, 'GetSize', 'GetBreakpointAtIndex')
+ %}
+#endif
+}
diff --git a/lldb/bindings/interface/SBBreakpointLocationExtensions.i b/lldb/bindings/interface/SBBreakpointLocationExtensions.i
index e076499..4002779 100644
--- a/lldb/bindings/interface/SBBreakpointLocationExtensions.i
+++ b/lldb/bindings/interface/SBBreakpointLocationExtensions.i
@@ -1 +1,12 @@
STRING_EXTENSION_LEVEL_OUTSIDE(SBBreakpointLocation, lldb::eDescriptionLevelFull)
+
+%extend lldb::SBBreakpointLocation {
+#ifdef SWIGPYTHON
+ %pythoncode%{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+ %}
+#endif
+}
diff --git a/lldb/bindings/interface/SBBreakpointNameExtensions.i b/lldb/bindings/interface/SBBreakpointNameExtensions.i
index 19ecb7e..2cd47a4 100644
--- a/lldb/bindings/interface/SBBreakpointNameExtensions.i
+++ b/lldb/bindings/interface/SBBreakpointNameExtensions.i
@@ -1 +1,12 @@
STRING_EXTENSION_OUTSIDE(SBBreakpointName)
+
+%extend lldb::SBBreakpointName {
+#ifdef SWIGPYTHON
+ %pythoncode%{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+ %}
+#endif
+}
diff --git a/lldb/bindings/interface/SBBroadcastExtensions.i b/lldb/bindings/interface/SBBroadcastExtensions.i
new file mode 100644
index 0000000..3a7916e
--- /dev/null
+++ b/lldb/bindings/interface/SBBroadcastExtensions.i
@@ -0,0 +1,10 @@
+%extend lldb::SBBroadcaster {
+#ifdef SWIGPYTHON
+ %pythoncode%{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+ %}
+#endif
+}
diff --git a/lldb/bindings/interface/SBCompileUnitExtensions.i b/lldb/bindings/interface/SBCompileUnitExtensions.i
index c602e9c..de6c54c 100644
--- a/lldb/bindings/interface/SBCompileUnitExtensions.i
+++ b/lldb/bindings/interface/SBCompileUnitExtensions.i
@@ -3,6 +3,11 @@ STRING_EXTENSION_OUTSIDE(SBCompileUnit)
%extend lldb::SBCompileUnit {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
def __iter__(self):
'''Iterate over all line entries in a lldb.SBCompileUnit object.'''
return lldb_iter(self, 'GetNumLineEntries', 'GetLineEntryAtIndex')
diff --git a/lldb/bindings/interface/SBDataExtensions.i b/lldb/bindings/interface/SBDataExtensions.i
index cf6f40a..d980e79 100644
--- a/lldb/bindings/interface/SBDataExtensions.i
+++ b/lldb/bindings/interface/SBDataExtensions.i
@@ -3,6 +3,8 @@ STRING_EXTENSION_OUTSIDE(SBData)
%extend lldb::SBData {
#ifdef SWIGPYTHON
%pythoncode %{
+ def __len__(self):
+ return self.GetByteSize()
class read_data_helper:
def __init__(self, sbdata, readerfunc, item_size):
diff --git a/lldb/bindings/interface/SBDeclarationExtensions.i b/lldb/bindings/interface/SBDeclarationExtensions.i
index 9e69dc9..79d25c1 100644
--- a/lldb/bindings/interface/SBDeclarationExtensions.i
+++ b/lldb/bindings/interface/SBDeclarationExtensions.i
@@ -3,6 +3,11 @@ STRING_EXTENSION_OUTSIDE(SBDeclaration)
%extend lldb::SBDeclaration {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
file = property(GetFileSpec, None, doc='''A read only property that returns an lldb object that represents the file (lldb.SBFileSpec) for this line entry.''')
line = property(GetLine, None, doc='''A read only property that returns the 1 based line number for this line entry, a return value of zero indicates that no line information is available.''')
column = property(GetColumn, None, doc='''A read only property that returns the 1 based column number for this line entry, a return value of zero indicates that no column information is available.''')
diff --git a/lldb/bindings/interface/SBErrorExtensions.i b/lldb/bindings/interface/SBErrorExtensions.i
index bf7764d..d2bdc40 100644
--- a/lldb/bindings/interface/SBErrorExtensions.i
+++ b/lldb/bindings/interface/SBErrorExtensions.i
@@ -3,6 +3,9 @@ STRING_EXTENSION_OUTSIDE(SBError)
%extend lldb::SBError {
#ifdef SWIGPYTHON
%pythoncode %{
+ def __int__(self):
+ return self.GetError()
+
value = property(GetError, None, doc='''A read only property that returns the same result as GetError().''')
fail = property(Fail, None, doc='''A read only property that returns the same result as Fail().''')
success = property(Success, None, doc='''A read only property that returns the same result as Success().''')
diff --git a/lldb/bindings/interface/SBFileSpecExtensions.i b/lldb/bindings/interface/SBFileSpecExtensions.i
index 446e900..e2c81e6 100644
--- a/lldb/bindings/interface/SBFileSpecExtensions.i
+++ b/lldb/bindings/interface/SBFileSpecExtensions.i
@@ -3,6 +3,11 @@ STRING_EXTENSION_OUTSIDE(SBFileSpec)
%extend lldb::SBFileSpec {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
fullpath = property(str, None, doc='''A read only property that returns the fullpath as a python string.''')
basename = property(GetFilename, None, doc='''A read only property that returns the path basename as a python string.''')
dirname = property(GetDirectory, None, doc='''A read only property that returns the path directory name as a python string.''')
diff --git a/lldb/bindings/interface/SBFileSpecListExtensions.i b/lldb/bindings/interface/SBFileSpecListExtensions.i
new file mode 100644
index 0000000..1e7b897
--- /dev/null
+++ b/lldb/bindings/interface/SBFileSpecListExtensions.i
@@ -0,0 +1,15 @@
+STRING_EXTENSION_OUTSIDE(SBFileSpecList)
+
+%extend lldb::SBFileSpecList {
+#ifdef SWIGPYTHON
+ %pythoncode%{
+ def __len__(self):
+ '''Return the number of FileSpec in a lldb.SBFileSpecList object.'''
+ return self.GetSize()
+
+ def __iter__(self):
+ '''Iterate over all FileSpecs in a lldb.SBFileSpecList object.'''
+ return lldb_iter(self, 'GetSize', 'GetFileSpecAtIndex')
+ %}
+#endif
+}
diff --git a/lldb/bindings/interface/SBFrameExtensions.i b/lldb/bindings/interface/SBFrameExtensions.i
index e89e207d..43b22ed 100644
--- a/lldb/bindings/interface/SBFrameExtensions.i
+++ b/lldb/bindings/interface/SBFrameExtensions.i
@@ -3,6 +3,17 @@ STRING_EXTENSION_OUTSIDE(SBFrame)
%extend lldb::SBFrame {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
+ def __int__(self):
+ return self.GetFrameID()
+
+ def __hex__(self):
+ return self.GetPC()
+
def get_all_variables(self):
return self.GetVariables(True,True,True,True)
diff --git a/lldb/bindings/interface/SBFunctionExtensions.i b/lldb/bindings/interface/SBFunctionExtensions.i
index 4efe9cf..c64363c 100644
--- a/lldb/bindings/interface/SBFunctionExtensions.i
+++ b/lldb/bindings/interface/SBFunctionExtensions.i
@@ -3,6 +3,11 @@ STRING_EXTENSION_OUTSIDE(SBFunction)
%extend lldb::SBFunction {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
def get_instructions_from_current_target (self):
return self.GetInstructions (target)
diff --git a/lldb/bindings/interface/SBInstructionExtensions.i b/lldb/bindings/interface/SBInstructionExtensions.i
index bbbf1a7..6ab0645 100644
--- a/lldb/bindings/interface/SBInstructionExtensions.i
+++ b/lldb/bindings/interface/SBInstructionExtensions.i
@@ -3,6 +3,14 @@ STRING_EXTENSION_OUTSIDE(SBInstruction)
%extend lldb::SBInstruction {
#ifdef SWIGPYTHON
%pythoncode %{
+ def __hex__(self):
+ """ Returns the address of the instruction. """
+ return self.GetAddress()
+
+ def __len__(self):
+ """ Returns the size of the instruction. """
+ return self.GetByteSize()
+
def __mnemonic_property__ (self):
return self.GetMnemonic (target)
def __operands_property__ (self):
diff --git a/lldb/bindings/interface/SBLineEntryExtensions.i b/lldb/bindings/interface/SBLineEntryExtensions.i
index f2d02de..3474063 100644
--- a/lldb/bindings/interface/SBLineEntryExtensions.i
+++ b/lldb/bindings/interface/SBLineEntryExtensions.i
@@ -3,6 +3,16 @@ STRING_EXTENSION_OUTSIDE(SBLineEntry)
%extend lldb::SBLineEntry {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
+ def __int__(self):
+ return self.GetLine()
+
+ def __hex__(self):
+ return self.GetStartAddress()
file = property(GetFileSpec, None, doc='''A read only property that returns an lldb object that represents the file (lldb.SBFileSpec) for this line entry.''')
line = property(GetLine, None, doc='''A read only property that returns the 1 based line number for this line entry, a return value of zero indicates that no line information is available.''')
column = property(GetColumn, None, doc='''A read only property that returns the 1 based column number for this line entry, a return value of zero indicates that no column information is available.''')
diff --git a/lldb/bindings/interface/SBMemoryRegionInfoExtensions.i b/lldb/bindings/interface/SBMemoryRegionInfoExtensions.i
index 64a1218..717622a 100644
--- a/lldb/bindings/interface/SBMemoryRegionInfoExtensions.i
+++ b/lldb/bindings/interface/SBMemoryRegionInfoExtensions.i
@@ -1 +1,18 @@
STRING_EXTENSION_OUTSIDE(SBMemoryRegionInfo)
+
+%extend lldb::SBMemoryRegionInfo {
+#ifdef SWIGPYTHON
+ %pythoncode%{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
+ def __hex__(self):
+ return self.GetRegionBase()
+
+ def __len__(self):
+ return self.GetRegionEnd() - self.GetRegionBase()
+ %}
+#endif
+}
diff --git a/lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i b/lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i
new file mode 100644
index 0000000..49d4911
--- /dev/null
+++ b/lldb/bindings/interface/SBMemoryRegionInfoListExtensions.i
@@ -0,0 +1,13 @@
+%extend lldb::SBMemoryRegionInfoList {
+#ifdef SWIGPYTHON
+ %pythoncode%{
+ def __len__(self):
+ '''Return the number of memory region info in a lldb.SBMemoryRegionInfoList object.'''
+ return self.GetSize()
+
+ def __iter__(self):
+ '''Iterate over all the memory regions in a lldb.SBMemoryRegionInfoList object.'''
+ return lldb_iter(self, 'GetSize', 'GetMemoryRegionAtIndex')
+ %}
+#endif
+}
diff --git a/lldb/bindings/interface/SBModuleExtensions.i b/lldb/bindings/interface/SBModuleExtensions.i
index 4f35e43..ded1ada 100644
--- a/lldb/bindings/interface/SBModuleExtensions.i
+++ b/lldb/bindings/interface/SBModuleExtensions.i
@@ -28,6 +28,11 @@ STRING_EXTENSION_OUTSIDE(SBModule)
%extend lldb::SBModule {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
def __len__(self):
'''Return the number of symbols in a lldb.SBModule object.'''
return self.GetNumSymbols()
diff --git a/lldb/bindings/interface/SBModuleSpecListExtensions.i b/lldb/bindings/interface/SBModuleSpecListExtensions.i
new file mode 100644
index 0000000..ab51dc4
--- /dev/null
+++ b/lldb/bindings/interface/SBModuleSpecListExtensions.i
@@ -0,0 +1,16 @@
+STRING_EXTENSION_OUTSIDE(SBModuleSpecList)
+
+%extend lldb::SBModuleSpecList {
+#ifdef SWIGPYTHON
+ %pythoncode%{
+ def __len__(self):
+ '''Return the number of ModuleSpec in a lldb.SBModuleSpecList object.'''
+ return self.GetSize()
+
+ def __iter__(self):
+ '''Iterate over all ModuleSpecs in a lldb.SBModuleSpecList object.'''
+ return lldb_iter(self, 'GetSize', 'GetSpecAtIndex')
+ %}
+#endif
+}
+
diff --git a/lldb/bindings/interface/SBProcessDocstrings.i b/lldb/bindings/interface/SBProcessDocstrings.i
index dba7465..3ee17e0 100644
--- a/lldb/bindings/interface/SBProcessDocstrings.i
+++ b/lldb/bindings/interface/SBProcessDocstrings.i
@@ -209,6 +209,10 @@ SBProcess supports thread iteration. For example (from test/lldbutil.py), ::
lldb.LLDB_INVALID_ADDRESS if the allocation failed."
) lldb::SBProcess::AllocateMemory;
+%feature("autodoc", "Get default process broadcaster class name (lldb.process)."
+) lldb::SBProcess::GetBroadcasterClass;
+
+
%feature("autodoc", "
Deallocates the block of memory (previously allocated using
AllocateMemory) given in the argument."
diff --git a/lldb/bindings/interface/SBProcessExtensions.i b/lldb/bindings/interface/SBProcessExtensions.i
index fe9e641..5fa939f 100644
--- a/lldb/bindings/interface/SBProcessExtensions.i
+++ b/lldb/bindings/interface/SBProcessExtensions.i
@@ -79,6 +79,8 @@ STRING_EXTENSION_OUTSIDE(SBProcess)
'''Return the number of threads in a lldb.SBProcess object.'''
return self.GetNumThreads()
+ def __int__(self):
+ return self.GetProcessID()
threads = property(get_process_thread_list, None, doc='''A read only property that returns a list() of lldb.SBThread objects for this process.''')
thread = property(get_threads_access_object, None, doc='''A read only property that returns an object that can access threads by thread index (thread = lldb.process.thread[12]).''')
diff --git a/lldb/bindings/interface/SBQueueItemExtensions.i b/lldb/bindings/interface/SBQueueItemExtensions.i
new file mode 100644
index 0000000..277bba2
--- /dev/null
+++ b/lldb/bindings/interface/SBQueueItemExtensions.i
@@ -0,0 +1,8 @@
+%extend lldb::SBQueueItem {
+#ifdef SWIGPYTHON
+ %pythoncode%{
+ def __hex__(self):
+ return self.GetAddress()
+ %}
+#endif
+}
diff --git a/lldb/bindings/interface/SBScriptObjectExtensions.i b/lldb/bindings/interface/SBScriptObjectExtensions.i
index 279854c..507c11a 100644
--- a/lldb/bindings/interface/SBScriptObjectExtensions.i
+++ b/lldb/bindings/interface/SBScriptObjectExtensions.i
@@ -1,6 +1,11 @@
%extend lldb::SBScriptObject {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
ptr = property(GetPointer, None, doc='''A read only property that returns the underlying script object.''')
lang = property(GetLanguage, None, doc='''A read only property that returns the script language associated with with this script object.''')
%}
diff --git a/lldb/bindings/interface/SBSectionExtensions.i b/lldb/bindings/interface/SBSectionExtensions.i
index 47b63c5..369a635 100644
--- a/lldb/bindings/interface/SBSectionExtensions.i
+++ b/lldb/bindings/interface/SBSectionExtensions.i
@@ -3,6 +3,11 @@ STRING_EXTENSION_OUTSIDE(SBSection)
%extend lldb::SBSection {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
def __iter__(self):
'''Iterate over all subsections in a lldb.SBSection object.'''
return lldb_iter(self, 'GetNumSubSections', 'GetSubSectionAtIndex')
diff --git a/lldb/bindings/interface/SBStreamExtensions.i b/lldb/bindings/interface/SBStreamExtensions.i
index e52b2dd..6f1dfa5 100644
--- a/lldb/bindings/interface/SBStreamExtensions.i
+++ b/lldb/bindings/interface/SBStreamExtensions.i
@@ -1,4 +1,11 @@
%extend lldb::SBStream {
+#ifdef SWIGPYTHON
+ %pythoncode%{
+ def __len__(self):
+ return self.GetSize()
+ %}
+#endif
+
%feature("autodoc", "DEPRECATED, use RedirectToFile") RedirectToFileHandle;
void
RedirectToFileHandle (lldb::FileSP file, bool transfer_fh_ownership) {
diff --git a/lldb/bindings/interface/SBStructuredDataExtensions.i b/lldb/bindings/interface/SBStructuredDataExtensions.i
new file mode 100644
index 0000000..ca3d096
--- /dev/null
+++ b/lldb/bindings/interface/SBStructuredDataExtensions.i
@@ -0,0 +1,18 @@
+STRING_EXTENSION_OUTSIDE(SBStructuredData)
+
+%extend lldb::SBStructuredData {
+#ifdef SWIGPYTHON
+ %pythoncode%{
+ def __int__(self):
+ return self.GetSignedInteger()
+
+ def __len__(self):
+ '''Return the number of element in a lldb.SBStructuredData object.'''
+ return self.GetSize()
+
+ def __iter__(self):
+ '''Iterate over all the elements in a lldb.SBStructuredData object.'''
+ return lldb_iter(self, 'GetSize', 'GetItemAtIndex')
+ %}
+#endif
+}
diff --git a/lldb/bindings/interface/SBSymbolExtensions.i b/lldb/bindings/interface/SBSymbolExtensions.i
index 249f357..47f17ff 100644
--- a/lldb/bindings/interface/SBSymbolExtensions.i
+++ b/lldb/bindings/interface/SBSymbolExtensions.i
@@ -3,6 +3,14 @@ STRING_EXTENSION_OUTSIDE(SBSymbol)
%extend lldb::SBSymbol {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
+ def __hex__(self):
+ return self.GetStartAddress()
+
def get_instructions_from_current_target (self):
return self.GetInstructions (target)
diff --git a/lldb/bindings/interface/SBTargetExtensions.i b/lldb/bindings/interface/SBTargetExtensions.i
index 02c40b0..c80dadf 100644
--- a/lldb/bindings/interface/SBTargetExtensions.i
+++ b/lldb/bindings/interface/SBTargetExtensions.i
@@ -32,6 +32,11 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTarget, lldb::eDescriptionLevelBrief)
%extend lldb::SBTarget {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
class modules_access(object):
'''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.'''
def __init__(self, sbtarget):
diff --git a/lldb/bindings/interface/SBThreadCollectionExtensions.i b/lldb/bindings/interface/SBThreadCollectionExtensions.i
new file mode 100644
index 0000000..39a45a6
--- /dev/null
+++ b/lldb/bindings/interface/SBThreadCollectionExtensions.i
@@ -0,0 +1,14 @@
+%extend lldb::SBThreadCollection {
+#ifdef SWIGPYTHON
+ %pythoncode%{
+
+ def __iter__(self):
+ '''Iterate over all threads in a lldb.SBThreadCollection object.'''
+ return lldb_iter(self, 'GetSize', 'GetThreadAtIndex')
+
+ def __len__(self):
+ '''Return the number of threads in a lldb.SBThreadCollection object.'''
+ return self.GetSize()
+ %}
+#endif
+}
diff --git a/lldb/bindings/interface/SBThreadExtensions.i b/lldb/bindings/interface/SBThreadExtensions.i
index 54bc105..bfcc4d1 100644
--- a/lldb/bindings/interface/SBThreadExtensions.i
+++ b/lldb/bindings/interface/SBThreadExtensions.i
@@ -3,6 +3,11 @@ STRING_EXTENSION_OUTSIDE(SBThread)
%extend lldb::SBThread {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
def __iter__(self):
'''Iterate over all frames in a lldb.SBThread object.'''
return lldb_iter(self, 'GetNumFrames', 'GetFrameAtIndex')
diff --git a/lldb/bindings/interface/SBTypeCategoryExtensions.i b/lldb/bindings/interface/SBTypeCategoryExtensions.i
index fb93af5..fdd4825 100644
--- a/lldb/bindings/interface/SBTypeCategoryExtensions.i
+++ b/lldb/bindings/interface/SBTypeCategoryExtensions.i
@@ -3,6 +3,11 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTypeCategory, lldb::eDescriptionLevelBrief)
%extend lldb::SBTypeCategory {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
class formatters_access_class(object):
'''A helper object that will lazily hand out formatters for a specific category.'''
diff --git a/lldb/bindings/interface/SBTypeEnumMemberExtensions.i b/lldb/bindings/interface/SBTypeEnumMemberExtensions.i
index 3b0154f..9f0e16a 100644
--- a/lldb/bindings/interface/SBTypeEnumMemberExtensions.i
+++ b/lldb/bindings/interface/SBTypeEnumMemberExtensions.i
@@ -2,6 +2,14 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTypeEnumMember, lldb::eDescriptionLevelBrief)
%extend lldb::SBTypeEnumMember {
#ifdef SWIGPYTHON
%pythoncode %{
+ def __iter__(self):
+ '''Iterate over all members in a lldb.SBTypeEnumMemberList object.'''
+ return lldb_iter(self, 'GetSize', 'GetTypeEnumMemberAtIndex')
+
+ def __len__(self):
+ '''Return the number of members in a lldb.SBTypeEnumMemberList object.'''
+ return self.GetSize()
+
name = property(GetName, None, doc='''A read only property that returns the name for this enum member as a string.''')
type = property(GetType, None, doc='''A read only property that returns an lldb object that represents the type (lldb.SBType) for this enum member.''')
signed = property(GetValueAsSigned, None, doc='''A read only property that returns the value of this enum member as a signed integer.''')
diff --git a/lldb/bindings/interface/SBTypeExtensions.i b/lldb/bindings/interface/SBTypeExtensions.i
index f40ca80..9c7d614 100644
--- a/lldb/bindings/interface/SBTypeExtensions.i
+++ b/lldb/bindings/interface/SBTypeExtensions.i
@@ -2,6 +2,11 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTypeMember, lldb::eDescriptionLevelBrief)
%extend lldb::SBTypeMember {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
name = property(GetName, None, doc='''A read only property that returns the name for this member as a string.''')
type = property(GetType, None, doc='''A read only property that returns an lldb object that represents the type (lldb.SBType) for this member.''')
byte_offset = property(GetOffsetInBytes, None, doc='''A read only property that returns offset in bytes for this member as an integer.''')
@@ -14,6 +19,18 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTypeMember, lldb::eDescriptionLevelBrief)
STRING_EXTENSION_LEVEL_OUTSIDE(SBTypeMemberFunction, lldb::eDescriptionLevelBrief)
+%extend lldb::SBTypeMemberFunction {
+#ifdef SWIGPYTHON
+ %pythoncode%{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
+ %}
+#endif
+}
+
STRING_EXTENSION_LEVEL_OUTSIDE(SBType, lldb::eDescriptionLevelBrief)
%extend lldb::SBType {
@@ -28,6 +45,14 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBType, lldb::eDescriptionLevelBrief)
return template_args
return None
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
+ def __len__(self):
+ return self.GetByteSize()
+
module = property(GetModule, None, doc='''A read only property that returns the module in which type is defined.''')
name = property(GetName, None, doc='''A read only property that returns the name for this type as a string.''')
size = property(GetByteSize, None, doc='''A read only property that returns size in bytes for this type as an integer.''')
@@ -121,6 +146,11 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBType, lldb::eDescriptionLevelBrief)
%extend lldb::SBTypeList {
#ifdef SWIGPYTHON
%pythoncode%{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
def __iter__(self):
'''Iterate over all types in a lldb.SBTypeList object.'''
return lldb_iter(self, 'GetSize', 'GetTypeAtIndex')
diff --git a/lldb/bindings/interface/SBTypeFilterExtensions.i b/lldb/bindings/interface/SBTypeFilterExtensions.i
index d218ff9..c1d1bc1 100644
--- a/lldb/bindings/interface/SBTypeFilterExtensions.i
+++ b/lldb/bindings/interface/SBTypeFilterExtensions.i
@@ -2,6 +2,11 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTypeFilter, lldb::eDescriptionLevelBrief)
%extend lldb::SBTypeFilter {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
options = property(GetOptions, SetOptions)
count = property(GetNumberOfExpressionPaths)
%}
diff --git a/lldb/bindings/interface/SBTypeFormatExtensions.i b/lldb/bindings/interface/SBTypeFormatExtensions.i
index 0ea8492..cde1d72a 100644
--- a/lldb/bindings/interface/SBTypeFormatExtensions.i
+++ b/lldb/bindings/interface/SBTypeFormatExtensions.i
@@ -2,6 +2,11 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTypeFormat, lldb::eDescriptionLevelBrief)
%extend lldb::SBTypeFormat {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
format = property(GetFormat, SetFormat)
options = property(GetOptions, SetOptions)
%}
diff --git a/lldb/bindings/interface/SBTypeNameSpecifierExtensions.i b/lldb/bindings/interface/SBTypeNameSpecifierExtensions.i
index f73ac05..1aeb08c 100644
--- a/lldb/bindings/interface/SBTypeNameSpecifierExtensions.i
+++ b/lldb/bindings/interface/SBTypeNameSpecifierExtensions.i
@@ -2,6 +2,11 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTypeNameSpecifier, lldb::eDescriptionLevelBrief
%extend lldb::SBTypeNameSpecifier {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
name = property(GetName)
is_regex = property(IsRegex)
%}
diff --git a/lldb/bindings/interface/SBTypeSummaryExtensions.i b/lldb/bindings/interface/SBTypeSummaryExtensions.i
index c2abd91b..e8da4c5 100644
--- a/lldb/bindings/interface/SBTypeSummaryExtensions.i
+++ b/lldb/bindings/interface/SBTypeSummaryExtensions.i
@@ -2,6 +2,11 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTypeSummary, lldb::eDescriptionLevelBrief)
%extend lldb::SBTypeSummary {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
options = property(GetOptions, SetOptions)
is_summary_string = property(IsSummaryString)
is_function_name = property(IsFunctionName)
diff --git a/lldb/bindings/interface/SBTypeSyntheticExtensions.i b/lldb/bindings/interface/SBTypeSyntheticExtensions.i
index f86572f..cf7ab16 100644
--- a/lldb/bindings/interface/SBTypeSyntheticExtensions.i
+++ b/lldb/bindings/interface/SBTypeSyntheticExtensions.i
@@ -2,6 +2,11 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTypeSynthetic, lldb::eDescriptionLevelBrief)
%extend lldb::SBTypeSynthetic {
#ifdef SWIGPYTHON
%pythoncode %{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
options = property(GetOptions, SetOptions)
contains_code = property(IsClassCode, None)
synthetic_data = property(GetData, None)
diff --git a/lldb/bindings/interface/SBUnixSignalsExtensions.i b/lldb/bindings/interface/SBUnixSignalsExtensions.i
index b8a26a3..31c7351 100644
--- a/lldb/bindings/interface/SBUnixSignalsExtensions.i
+++ b/lldb/bindings/interface/SBUnixSignalsExtensions.i
@@ -1,6 +1,13 @@
%extend lldb::SBUnixSignals {
#ifdef SWIGPYTHON
%pythoncode %{
+ def __iter__(self):
+ '''Iterate over all signals in a lldb.SBUnixSignals object.'''
+ return lldb_iter(self, 'GetNumSignals', 'GetSignalAtIndex')
+
+ def __len__(self):
+ return self.GetNumSignals()
+
def get_unix_signals_list(self):
signals = []
for idx in range(0, self.GetNumSignals()):
diff --git a/lldb/bindings/interface/SBValueExtensions.i b/lldb/bindings/interface/SBValueExtensions.i
index 21b09ec1..bee9c27 100644
--- a/lldb/bindings/interface/SBValueExtensions.i
+++ b/lldb/bindings/interface/SBValueExtensions.i
@@ -37,6 +37,9 @@ STRING_EXTENSION_OUTSIDE(SBValue)
children.append(accessor[idx])
return children
+ def __hex__(self):
+ return self.GetAddress()
+
def __iter__(self):
'''Iterate over all child values of a lldb.SBValue object.'''
return lldb_iter(self, 'GetNumChildren', 'GetChildAtIndex')
diff --git a/lldb/bindings/interface/SBWatchpointExtensions.i b/lldb/bindings/interface/SBWatchpointExtensions.i
index b115412..c18f011 100644
--- a/lldb/bindings/interface/SBWatchpointExtensions.i
+++ b/lldb/bindings/interface/SBWatchpointExtensions.i
@@ -1 +1,18 @@
STRING_EXTENSION_LEVEL_OUTSIDE(SBWatchpoint, lldb::eDescriptionLevelVerbose)
+
+%extend lldb::SBWatchpoint {
+#ifdef SWIGPYTHON
+ %pythoncode%{
+ # operator== is a free function, which swig does not handle, so we inject
+ # our own equality operator here
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
+ def __hex__(self):
+ return self.GetWatchAddress()
+
+ def __len__(self):
+ return self.GetWatchSize()
+ %}
+#endif
+}
diff --git a/lldb/bindings/interfaces.swig b/lldb/bindings/interfaces.swig
index db8eda0..53f8fcc 100644
--- a/lldb/bindings/interfaces.swig
+++ b/lldb/bindings/interfaces.swig
@@ -157,8 +157,10 @@
%include "./interface/SBAddressExtensions.i"
%include "./interface/SBBlockExtensions.i"
%include "./interface/SBBreakpointExtensions.i"
+%include "./interface/SBBreakpointListExtensions.i"
%include "./interface/SBBreakpointLocationExtensions.i"
%include "./interface/SBBreakpointNameExtensions.i"
+%include "./interface/SBBroadcastExtensions.i"
%include "./interface/SBCommandReturnObjectExtensions.i"
%include "./interface/SBCompileUnitExtensions.i"
%include "./interface/SBDataExtensions.i"
@@ -168,27 +170,33 @@
%include "./interface/SBExecutionContextExtensions.i"
%include "./interface/SBFileExtensions.i"
%include "./interface/SBFileSpecExtensions.i"
+%include "./interface/SBFileSpecListExtensions.i"
%include "./interface/SBFrameExtensions.i"
%include "./interface/SBFunctionExtensions.i"
%include "./interface/SBInstructionExtensions.i"
%include "./interface/SBInstructionListExtensions.i"
%include "./interface/SBLineEntryExtensions.i"
%include "./interface/SBMemoryRegionInfoExtensions.i"
+%include "./interface/SBMemoryRegionInfoListExtensions.i"
%include "./interface/SBModuleExtensions.i"
%include "./interface/SBModuleSpecExtensions.i"
+%include "./interface/SBModuleSpecListExtensions.i"
%include "./interface/SBProcessExtensions.i"
+%include "./interface/SBQueueItemExtensions.i"
%include "./interface/SBScriptObjectExtensions.i"
%include "./interface/SBSectionExtensions.i"
%include "./interface/SBStreamExtensions.i"
%include "./interface/SBStringListExtensions.i"
-%include "./interface/SBSymbolExtensions.i"
+%include "./interface/SBStructuredDataExtensions.i"
%include "./interface/SBSymbolContextExtensions.i"
%include "./interface/SBSymbolContextListExtensions.i"
+%include "./interface/SBSymbolExtensions.i"
%include "./interface/SBTargetExtensions.i"
+%include "./interface/SBThreadCollectionExtensions.i"
%include "./interface/SBThreadExtensions.i"
-%include "./interface/SBTypeExtensions.i"
%include "./interface/SBTypeCategoryExtensions.i"
%include "./interface/SBTypeEnumMemberExtensions.i"
+%include "./interface/SBTypeExtensions.i"
%include "./interface/SBTypeFilterExtensions.i"
%include "./interface/SBTypeFormatExtensions.i"
%include "./interface/SBTypeNameSpecifierExtensions.i"
diff --git a/lldb/bindings/python/python-extensions.swig b/lldb/bindings/python/python-extensions.swig
index cb841af..4ba1607 100644
--- a/lldb/bindings/python/python-extensions.swig
+++ b/lldb/bindings/python/python-extensions.swig
@@ -304,8 +304,15 @@ class value_iter(object):
def next(self):
return self.__next__()
+ def __eq__(self, other):
+ return not self.__ne__(other)
+
+ def __len__(self):
+ return self.length
+
def __init__(self,value):
self.index = 0
+ self.length = 0
self.sbvalue = value
if type(self.sbvalue) is value:
self.sbvalue = self.sbvalue.sbvalue
@@ -546,6 +553,12 @@ class SBSyntheticValueProvider(object):
def has_children(self):
return False
+ def __len__(self):
+ return self.num_children()
+
+ def __iter__(self):
+ '''Iterate over all children in a lldb.SBSyntheticValueProvider object.'''
+ return lldb_iter(self, 'num_children', 'get_child_at_index')
%}