summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/lldb.xcodeproj/project.pbxproj2
-rw-r--r--lldb/scripts/CMakeLists.txt1
-rw-r--r--lldb/scripts/Python/modify-python-lldb.py141
-rw-r--r--lldb/scripts/Python/prepare_binding_Python.py47
4 files changed, 0 insertions, 191 deletions
diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj
index b981d9f685c..30035fb2a93 100644
--- a/lldb/lldb.xcodeproj/project.pbxproj
+++ b/lldb/lldb.xcodeproj/project.pbxproj
@@ -3368,7 +3368,6 @@
AF90106315AB7C5700FF120D /* lldb.1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.man; name = lldb.1; path = docs/lldb.1; sourceTree = "<group>"; };
26BC7E7410F1B85900F91463 /* lldb.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lldb.cpp; path = source/lldb.cpp; sourceTree = "<group>"; };
2669605E1199F4230075C61A /* lldb.swig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = lldb.swig; sourceTree = "<group>"; };
- 94E367CC140C4EC4001C7A5A /* modify-python-lldb.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = "modify-python-lldb.py"; sourceTree = "<group>"; };
26792616211CA3E100EE1D10 /* package.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = package.json; path = "tools/lldb-vscode/package.json"; sourceTree = "<group>"; };
9A48A3A7124AAA5A00922451 /* python-extensions.swig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "python-extensions.swig"; sourceTree = "<group>"; };
944DC3481774C99000D7D884 /* python-swigsafecast.swig */ = {isa = PBXFileReference; lastKnownFileType = text; path = "python-swigsafecast.swig"; sourceTree = "<group>"; };
@@ -4592,7 +4591,6 @@
266960601199F4230075C61A /* build-swig-Python.sh */,
266960611199F4230075C61A /* edit-swig-python-wrapper-file.py */,
94FE476613FC1DA8001F8475 /* finish-swig-Python-LLDB.sh */,
- 94E367CC140C4EC4001C7A5A /* modify-python-lldb.py */,
9A48A3A7124AAA5A00922451 /* python-extensions.swig */,
944DC3481774C99000D7D884 /* python-swigsafecast.swig */,
94E367CE140C4EEA001C7A5A /* python-typemaps.swig */,
diff --git a/lldb/scripts/CMakeLists.txt b/lldb/scripts/CMakeLists.txt
index b394be3da11..439852793f1 100644
--- a/lldb/scripts/CMakeLists.txt
+++ b/lldb/scripts/CMakeLists.txt
@@ -21,7 +21,6 @@ add_custom_command(
DEPENDS ${SWIG_INTERFACES}
DEPENDS ${SWIG_HEADERS}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Python/prepare_binding_Python.py
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Python/modify-python-lldb.py
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/prepare_bindings.py
${framework_arg}
--srcRoot=${LLDB_SOURCE_DIR}
diff --git a/lldb/scripts/Python/modify-python-lldb.py b/lldb/scripts/Python/modify-python-lldb.py
deleted file mode 100644
index 4361b6c2a66..00000000000
--- a/lldb/scripts/Python/modify-python-lldb.py
+++ /dev/null
@@ -1,141 +0,0 @@
-#
-# modify-python-lldb.py
-#
-# This script modifies the lldb module (which was automatically generated via
-# running swig) to support iteration and/or equality operations for certain lldb
-# objects, implements truth value testing for certain lldb objects, and adds a
-# global variable 'debugger_unique_id' which is initialized to 0.
-#
-# As a cleanup step, it also removes the 'residues' from the autodoc features of
-# swig. For an example, take a look at SBTarget.h header file, where we take
-# advantage of the already existing doxygen C++-docblock and make it the Python
-# docstring for the same method. The 'residues' in this context include the c
-# comment marker, the trailing blank (SPC's) line, and the doxygen comment start
-# marker.
-#
-# In addition to the 'residues' removal during the cleanup step, it also
-# transforms the 'char' data type (which was actually 'char *' but the 'autodoc'
-# feature of swig removes ' *' from it) into 'str' (as a Python str type).
-
-# System modules
-import sys
-import re
-if sys.version_info.major >= 3:
- import io as StringIO
-else:
- import StringIO
-
-# import use_lldb_suite so we can find third-party and helper modules
-import use_lldb_suite
-
-# Third party modules
-import six
-
-# LLDB modules
-
-if len(sys.argv) != 2:
- output_name = "./lldb.py"
-else:
- output_name = sys.argv[1] + "/lldb.py"
-
-# print "output_name is '" + output_name + "'"
-
-#
-# Residues to be removed.
-#
-# The demarcation point for turning on/off residue removal state.
-# When bracketed by the lines, the CLEANUP_DOCSTRING state (see below) is ON.
-toggle_docstring_cleanup_line = ' """'
-
-
-def char_to_str_xform(line):
- """This transforms the 'char', i.e, 'char *' to 'str', Python string."""
- line = line.replace(' char', ' str')
- line = line.replace('char ', 'str ')
- # Special case handling of 'char **argv' and 'char **envp'.
- line = line.replace('str argv', 'list argv')
- line = line.replace('str envp', 'list envp')
- return line
-
-#
-# The one-liner docstring also needs char_to_str transformation, btw.
-#
-TWO_SPACES = ' ' * 2
-EIGHT_SPACES = ' ' * 8
-one_liner_docstring_pattern = re.compile(
- '^(%s|%s)""".*"""$' %
- (TWO_SPACES, EIGHT_SPACES))
-
-class NewContent(StringIO.StringIO):
- """Simple facade to keep track of the previous line to be committed."""
-
- def __init__(self):
- StringIO.StringIO.__init__(self)
- self.prev_line = None
-
- def add_line(self, a_line):
- """Add a line to the content, if there is a previous line, commit it."""
- if self.prev_line is not None:
- self.write(self.prev_line + "\n")
- self.prev_line = a_line
-
- def del_line(self):
- """Forget about the previous line, do not commit it."""
- self.prev_line = None
-
- def del_blank_line(self):
- """Forget about the previous line if it is a blank line."""
- if self.prev_line is not None and not self.prev_line.strip():
- self.prev_line = None
-
- def finish(self):
- """Call this when you're finished with populating content."""
- if self.prev_line is not None:
- self.write(self.prev_line + "\n")
- self.prev_line = None
-
-# The new content will have the iteration protocol defined for our lldb
-# objects.
-new_content = NewContent()
-
-with open(output_name, 'r') as f_in:
- content = f_in.read()
-
-# These define the states of our finite state machine.
-NORMAL = 1
-CLEANUP_DOCSTRING = 8
-
-# Our FSM begins its life in the NORMAL state. The state CLEANUP_DOCSTRING can
-# be entered from the NORMAL. 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():
- # If ' """' is the sole line, prepare to transition to the
- # CLEANUP_DOCSTRING state or out of it.
-
- if line == toggle_docstring_cleanup_line:
- if state & CLEANUP_DOCSTRING:
- state ^= CLEANUP_DOCSTRING
- else:
- state |= CLEANUP_DOCSTRING
-
- if (state & CLEANUP_DOCSTRING):
- line = char_to_str_xform(line)
-
- # Note that the transition out of CLEANUP_DOCSTRING is handled at the
- # beginning of this function already.
-
- # This deals with one-liner docstring, for example, SBThread.GetName:
- # """GetName(self) -> char""".
- if one_liner_docstring_pattern.match(line):
- line = char_to_str_xform(line)
-
- # Pass the original line of content to new_content.
- new_content.add_line(line)
-
-# We are finished with recording new content.
-new_content.finish()
-
-with open(output_name, 'w') as f_out:
- f_out.write(new_content.getvalue())
diff --git a/lldb/scripts/Python/prepare_binding_Python.py b/lldb/scripts/Python/prepare_binding_Python.py
index f9da16fb678..31aef6cf8f0 100644
--- a/lldb/scripts/Python/prepare_binding_Python.py
+++ b/lldb/scripts/Python/prepare_binding_Python.py
@@ -257,48 +257,6 @@ def do_swig_rebuild(options, dependency_file, config_build_dir, settings):
sys.exit(-10)
-def run_python_script(script_and_args):
- """Runs a python script, logging appropriately.
-
- If the command returns anything non-zero, it is registered as
- an error and exits the program.
-
- @param script_and_args the python script to execute, along with
- the command line arguments to pass to it.
- """
- command = [sys.executable] + script_and_args
- process = subprocess.Popen(command)
- script_stdout, script_stderr = process.communicate()
- return_code = process.returncode
- if return_code != 0:
- logging.error("failed to run %r: %r", command, script_stderr)
- sys.exit(return_code)
- else:
- logging.info("ran script %r'", command)
- if script_stdout is not None:
- logging.info("output: %s", script_stdout)
-
-
-def do_modify_python_lldb(options, config_build_dir):
- """Executes the modify-python-lldb.py script.
-
- @param options the parsed command line arguments
- @param config_build_dir the directory where the Python output was created.
- """
- script_path = os.path.normcase(
- os.path.join(
- options.src_root,
- "scripts",
- "Python",
- "modify-python-lldb.py"))
-
- if not os.path.exists(script_path):
- logging.error("failed to find python script: '%s'", script_path)
- sys.exit(-11)
-
- run_python_script([script_path, config_build_dir])
-
-
def get_python_module_path(options):
"""Returns the location where the lldb Python module should be placed.
@@ -426,11 +384,6 @@ def main(options):
# Generate the Python binding with swig.
logging.info("Python binding is out of date, regenerating")
do_swig_rebuild(options, dependency_file, config_build_dir, settings)
- if options.generate_dependency_file:
- return
-
- # Post process the swig-generated file.
- do_modify_python_lldb(options, config_build_dir)
# This script can be called by another Python script by calling the main()
OpenPOWER on IntegriCloud