aboutsummaryrefslogtreecommitdiff
path: root/lldb/scripts/Python/modify-python-lldb.py
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/scripts/Python/modify-python-lldb.py')
-rw-r--r--lldb/scripts/Python/modify-python-lldb.py51
1 files changed, 8 insertions, 43 deletions
diff --git a/lldb/scripts/Python/modify-python-lldb.py b/lldb/scripts/Python/modify-python-lldb.py
index 7a2c58d..af51ae6 100644
--- a/lldb/scripts/Python/modify-python-lldb.py
+++ b/lldb/scripts/Python/modify-python-lldb.py
@@ -87,10 +87,6 @@ compile_unit_iter = " def compile_unit_iter(self): return lldb_iter(self, '%s
# Eligible objects are those containers with unambiguous iteration support.
len_def = " def __len__(self): return self.%s()"
-# This supports the rich comparison methods of __eq__ and __ne__.
-eq_def = " def __eq__(self, other): return isinstance(other, %s) and %s"
-ne_def = " def __ne__(self, other): return not self.__eq__(other)"
-
# A convenience iterator for SBSymbol!
symbol_in_section_iter_def = '''
def symbol_in_section_iter(self, section):
@@ -135,17 +131,6 @@ d = {'SBBreakpoint': ('GetNumLocations', 'GetLocationAtIndex'),
'SBModule-symbol-in-section': symbol_in_section_iter_def
}
-#
-# This dictionary defines a mapping from classname to equality method name(s).
-#
-e = {'SBAddress': ['GetFileAddress', 'GetModule'],
- 'SBBreakpoint': ['GetID'],
- 'SBWatchpoint': ['GetID'],
- 'SBFileSpec': ['GetFilename', 'GetDirectory'],
- 'SBModule': ['GetFileSpec', 'GetUUIDString'],
- }
-
-
def list_to_frag(list):
"""Transform a list to equality program fragment.
@@ -198,41 +183,28 @@ new_content = NewContent()
with open(output_name, 'r') as f_in:
content = f_in.read()
-# The pattern for recognizing the SWIG Version string
-version_pattern = re.compile("^# Version:? (.*)$")
-
# The pattern for recognizing the beginning of an SB class definition.
class_pattern = re.compile("^class (SB.*)\(_object\):$")
# The pattern for recognizing the beginning of the __init__ method definition.
init_pattern = re.compile("^ def __init__\(self.*\):")
-# The pattern for recognizing the beginning of the IsValid method definition.
-isvalid_pattern = re.compile("^ def IsValid\(")
-
# These define the states of our finite state machine.
NORMAL = 1
DEFINING_ITERATOR = 2
-DEFINING_EQUALITY = 4
CLEANUP_DOCSTRING = 8
# Our FSM begins its life in the NORMAL state, and transitions to the
-# DEFINING_ITERATOR and/or DEFINING_EQUALITY state whenever it encounters the
-# beginning of certain class definitions, see dictionaries 'd' and 'e' above.
+# DEFINING_ITERATOR state whenever it encounters the beginning of certain class
+# definitions, see dictionary 'd' above.
#
-# Note that the two states DEFINING_ITERATOR and DEFINING_EQUALITY are
-# orthogonal in that our FSM can be in one, the other, or both states at the
-# same time. During such time, the FSM is eagerly searching for the __init__
+# In the DEFINING_ITERATOR state, the FSM is eagerly searching for the __init__
# method definition in order to insert the appropriate method(s) into the lldb
# module.
#
# The state CLEANUP_DOCSTRING can be entered from either the NORMAL or the
-# DEFINING_ITERATOR/EQUALITY states. While in this state, the FSM is fixing/
-# cleaning the Python docstrings generated by the swig docstring features.
-#
-# The FSM, in all possible states, also checks the current input for IsValid()
-# definition, and inserts a __nonzero__() method definition to implement truth
-# value testing and the built-in operation bool().
+# DEFINING_ITERATOR state. While in this state, the FSM is fixing/cleaning the
+# Python docstrings generated by the swig docstring features.
state = NORMAL
for line in content.splitlines():
@@ -254,22 +226,18 @@ for line in content.splitlines():
if state == NORMAL:
match = class_pattern.search(line)
# If we are at the beginning of the class definitions, prepare to
- # transition to the DEFINING_ITERATOR/DEFINING_EQUALITY state for the
- # right class names.
+ # transition to the DEFINING_ITERATOR state for the right class names.
if match:
cls = match.group(1)
if cls in d:
# Adding support for iteration for the matched SB class.
state |= DEFINING_ITERATOR
- if cls in e:
- # Adding support for eq and ne for the matched SB class.
- state |= DEFINING_EQUALITY
- if (state & DEFINING_ITERATOR) or (state & DEFINING_EQUALITY):
+ if state & DEFINING_ITERATOR:
match = init_pattern.search(line)
if match:
# We found the beginning of the __init__ method definition.
- # This is a good spot to insert the iter and/or eq-ne support.
+ # This is a good spot to insert the iter support.
#
# But note that SBTarget has three types of iterations.
if cls == "SBTarget":
@@ -280,9 +248,6 @@ for line in content.splitlines():
if (state & DEFINING_ITERATOR):
new_content.add_line(iter_def % d[cls])
new_content.add_line(len_def % d[cls][0])
- if (state & DEFINING_EQUALITY):
- new_content.add_line(eq_def % (cls, list_to_frag(e[cls])))
- new_content.add_line(ne_def)
# SBModule has extra SBSection, SBCompileUnit iterators and
# symbol_in_section_iter()!