diff --git a/lldb/examples/summaries/cocoa/objc_lldb.py b/lldb/examples/summaries/cocoa/objc_lldb.py deleted file mode 100644 index a9f9322b9bb7..000000000000 --- a/lldb/examples/summaries/cocoa/objc_lldb.py +++ /dev/null @@ -1,133 +0,0 @@ -""" -Objective-C runtime wrapper for use by LLDB Python formatters -This is an old and deprecated version of the wrapper -The new code, to which everyone should convert, is in objc_runtime.py - -part of The LLVM Compiler Infrastructure -This file is distributed under the University of Illinois Open Source -License. See LICENSE.TXT for details. -""" -import lldb - -class ObjCRuntime: - - def __init__(self,valobj = None): - self.valobj = valobj; - self.adjust_for_architecture() - - def adjust_for_architecture(self): - self.is_64_bit = (self.valobj.GetTarget().GetProcess().GetAddressByteSize() == 8) - self.is_little = (self.valobj.GetTarget().GetProcess().GetByteOrder() == lldb.eByteOrderLittle) - self.pointer_size = self.valobj.GetTarget().GetProcess().GetAddressByteSize() - self.addr_type = self.valobj.GetType().GetBasicType(lldb.eBasicTypeUnsignedLong) - self.addr_ptr_type = self.addr_type.GetPointerType() - - def is_tagged(self): - if valobj is None: - return None - ptr_value = self.valobj.GetPointerValue() - if (ptr_value % 2) == 1: - return True - else: - return False - - def read_ascii(self, pointer): - process = self.valobj.GetTarget().GetProcess() - error = lldb.SBError() - pystr = '' - # cannot do the read at once because there is no length byte - while True: - content = process.ReadMemory(pointer, 1, error) - new_bytes = bytearray(content) - b0 = new_bytes[0] - pointer = pointer + 1 - if b0 == 0: - break - pystr = pystr + chr(b0) - return pystr - - def read_isa(self): - # read ISA pointer - isa_pointer = self.valobj.CreateChildAtOffset("cfisa", - 0, - self.addr_ptr_type) - if isa_pointer == None or isa_pointer.IsValid() == False: - return None; - if isa_pointer.GetValue() == None: - return None; - isa = int(isa_pointer.GetValue(), 0) - if isa == 0 or isa == None: - return None; - return isa - - - def get_parent_class(self, isa = None): - if isa is None: - isa = self.read_isa() - if isa is None: - return None - # read superclass pointer - rw_pointer = isa + self.pointer_size - rw_object = self.valobj.CreateValueFromAddress("parent_isa", - rw_pointer, - self.addr_type) - if rw_object == None or rw_object.IsValid() == False: - return None; - if rw_object.GetValue() == None: - return None; - rw = int(rw_object.GetValue(), 0) - if rw == 0 or rw == None: - return None; - return rw - - def get_class_name(self, isa = None): - if isa is None: - isa = self.read_isa() - if isa is None: - return None - # read rw pointer - rw_pointer = isa + 4 * self.pointer_size - rw_object = self.valobj.CreateValueFromAddress("rw", - rw_pointer, - self.addr_type) - if rw_object == None or rw_object.IsValid() == False: - return None; - if rw_object.GetValue() == None: - return None; - rw = int(rw_object.GetValue(), 0) - if rw == 0 or rw == None: - return None; - - # read data pointer - data_pointer = rw + 8 - data_object = self.valobj.CreateValueFromAddress("data", - data_pointer, - self.addr_type) - if data_object == None or data_object.IsValid() == False: - return None; - if data_object.GetValue() == None: - return None; - data = int(data_object.GetValue(), 0) - if data == 0 or data == None: - return None; - - # read ro pointer - ro_pointer = data + 12 + self.pointer_size - if self.is_64_bit: - ro_pointer += 4 - ro_object = self.valobj.CreateValueFromAddress("ro", - ro_pointer, - self.addr_type) - if ro_object == None or ro_object.IsValid() == False: - return None; - if ro_object.GetValue() == None: - return None; - name_pointer = int(ro_object.GetValue(), 0) - if name_pointer == 0 or name_pointer == None: - return None; - - # now read the actual name and compare it to known stuff - name_string = self.read_ascii(name_pointer) - if (name_string.startswith("NSKVONotify")): - return self.get_class_name(self.get_parent_class()) - return name_string diff --git a/lldb/scripts/Python/finish-swig-Python-LLDB.sh b/lldb/scripts/Python/finish-swig-Python-LLDB.sh index 13194f4567ab..739d41e8251a 100755 --- a/lldb/scripts/Python/finish-swig-Python-LLDB.sh +++ b/lldb/scripts/Python/finish-swig-Python-LLDB.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/sh -x # finish-swig-Python.sh # @@ -75,13 +75,13 @@ then # Make the Python directory in the framework if it doesn't already exist - framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python" + framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python/lldb" else # We are on a non-Darwin system, so use the PYTHON_INSTALL_DIR argument, # and append the python version directory to the end of it. Depending on # the system other stuff may need to be put here as well. - framework_python_dir="${PYTHON_INSTALL_DIR}/python${PYTHON_VERSION}" + framework_python_dir="${PYTHON_INSTALL_DIR}/python${PYTHON_VERSION}/lldb" fi # @@ -94,25 +94,30 @@ then echo "Python files will be put in ${framework_python_dir}" fi -if [ ! -d "${framework_python_dir}" ] -then - if [ $Debug == 1 ] - then - echo "Making directory ${framework_python_dir}" - fi - mkdir -p "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "${framework_python_dir} already exists." - fi -fi +python_dirs="${framework_python_dir}" -if [ ! -d "${framework_python_dir}" ] -then - echo "Error: Unable to find or create ${framework_python_dir}" >&2 - exit 1 -fi +for python_dir in $python_dirs +do + if [ ! -d "${python_dir}" ] + then + if [ $Debug == 1 ] + then + echo "Making directory ${python_dir}" + fi + mkdir -p "${python_dir}" + else + if [ $Debug == 1 ] + then + echo "${python_dir} already exists." + fi + fi + + if [ ! -d "${python_dir}" ] + then + echo "Error: Unable to find or create ${python_dir}" >&2 + exit 1 + fi +done # Make the symlink that the script bridge for Python will need in the # Python framework directory @@ -126,10 +131,10 @@ then if [ ${OS_NAME} == "Darwin" ] then cd "${framework_python_dir}" - ln -s "../../LLDB" _lldb.so + ln -s "../../../LLDB" _lldb.so else cd "${TARGET_DIR}" - ln -s "./LLDB" _lldb.so + ln -s "../LLDB" _lldb.so fi else if [ $Debug == 1 ] @@ -138,419 +143,105 @@ else fi fi -# Copy the python module (lldb.py) that was generated by SWIG -# over to the framework Python directory -if [ -f "${CONFIG_BUILD_DIR}/lldb.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying lldb.py to ${framework_python_dir}" - fi - cp "${CONFIG_BUILD_DIR}/lldb.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${CONFIG_BUILD_DIR}/lldb.py" - fi -fi -# Copy the embedded interpreter script over to the framework Python directory -if [ -f "${SRC_ROOT}/source/Interpreter/embedded_interpreter.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying embedded_interpreter.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/source/Interpreter/embedded_interpreter.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/source/Interpreter/embedded_interpreter.py" - fi -fi +function create_python_package { + package_dir="${framework_python_dir}$1" + package_files="$2" -# Copy the C++ STL formatters over to the framework Python directory -if [ -f "${SRC_ROOT}/examples/synthetic/gnu_libstdcpp.py" ] -then - if [ $Debug == 1 ] + if [ ! -d "${package_dir}" ] then - echo "Copying gnu_libstdcpp.py to ${framework_python_dir}" + mkdir -p "${package_dir}" fi - cp "${SRC_ROOT}/examples/synthetic/gnu_libstdcpp.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/synthetic/gnu_libstdcpp.py" - fi -fi -if [ -f "${SRC_ROOT}/examples/synthetic/libcxx.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying libcxx.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/synthetic/libcxx.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/synthetic/libcxx.py" - fi -fi + for package_file in $package_files + do + if [ -f "${package_file}" ] + then + cp "${package_file}" "${package_dir}" + package_file_basename=$(basename "${package_file}") + fi + done -# Copy the ObjC formatters over to the framework Python directory -if [ -f "${SRC_ROOT}/examples/summaries/objc.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying objc.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/objc.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/objc.py" - fi -fi -# Copy the Cocoa formatters over to the framework Python directory -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/CFArray.py" ] -then - if [ $Debug == 1 ] + # Create a packate init file if there wasn't one + package_init_file="${package_dir}/__init__.py" + if [ ! -f "${package_init_file}" ] then - echo "Copying CFArray.py to ${framework_python_dir}" + echo -n "__all__ = [" > "${package_init_file}" + python_module_separator="" + for package_file in $package_files + do + if [ -f "${package_file}" ] + then + package_file_basename=$(basename "${package_file}") + echo -n "${python_module_separator}\"${package_file_basename%.*}\"" >> "${package_init_file}" + python_module_separator=", " + fi + done + echo "]" >> "${package_init_file}" fi - cp "${SRC_ROOT}/examples/summaries/cocoa/CFArray.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/CFArray.py" - fi -fi -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/CFDictionary.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying CFDictionary.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/CFDictionary.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/CFDictionary.py" - fi -fi -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/CFString.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying CFString.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/CFString.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/CFString.py" - fi -fi +} -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSData.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying NSData.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/NSData.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSData.py" - fi -fi +# Copy the lldb.py file into the lldb package directory and rename to __init_.py +cp "${CONFIG_BUILD_DIR}/lldb.py" "${framework_python_dir}/__init__.py" -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSMachPort.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying NSMachPort.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/NSMachPort.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSMachPort.py" - fi -fi +# lldb +package_files="${SRC_ROOT}/source/Interpreter/embedded_interpreter.py" +create_python_package "" "${package_files}" -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSSet.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying NSSet.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/NSSet.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSSet.py" - fi -fi -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSNotification.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying NSNotification.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/NSNotification.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSNotification.py" - fi -fi +# lldb/formatters/cpp +package_files="${SRC_ROOT}/examples/synthetic/gnu_libstdcpp.py +${SRC_ROOT}/examples/synthetic/libcxx.py" +create_python_package "/formatters/cpp" "${package_files}" -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSException.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying NSException.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/NSException.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSException.py" - fi -fi +# lldb/formatters/objc -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/CFBag.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying CFBag.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/CFBag.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/CFBag.py" - fi -fi +package_files="${SRC_ROOT}/examples/summaries/cocoa/Selector.py +${SRC_ROOT}/examples/summaries/objc.py +${SRC_ROOT}/examples/summaries/cocoa/Class.py +${SRC_ROOT}/examples/summaries/cocoa/CFArray.py +${SRC_ROOT}/examples/summaries/cocoa/CFBag.py +${SRC_ROOT}/examples/summaries/cocoa/CFBinaryHeap.py +${SRC_ROOT}/examples/summaries/cocoa/CFBitVector.py +${SRC_ROOT}/examples/summaries/cocoa/CFDictionary.py +${SRC_ROOT}/examples/summaries/cocoa/CFString.py +${SRC_ROOT}/examples/summaries/cocoa/NSBundle.py +${SRC_ROOT}/examples/summaries/cocoa/NSData.py +${SRC_ROOT}/examples/summaries/cocoa/NSDate.py +${SRC_ROOT}/examples/summaries/cocoa/NSException.py +${SRC_ROOT}/examples/summaries/cocoa/NSIndexSet.py +${SRC_ROOT}/examples/summaries/cocoa/NSMachPort.py +${SRC_ROOT}/examples/summaries/cocoa/NSNotification.py +${SRC_ROOT}/examples/summaries/cocoa/NSNumber.py +${SRC_ROOT}/examples/summaries/cocoa/NSSet.py +${SRC_ROOT}/examples/summaries/cocoa/NSURL.py" +create_python_package "/formatters/objc" "${package_files}" -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/CFBinaryHeap.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying CFBinaryHeap.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/CFBinaryHeap.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/CFBinaryHeap.py" - fi -fi -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSURL.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying NSURL.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/NSURL.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSURL.py" - fi -fi +# lldb/runtime/objc +package_files="${SRC_ROOT}/examples/summaries/cocoa/objc_runtime.py" +create_python_package "/runtime/objc" "${package_files}" -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSBundle.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying NSBundle.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/NSBundle.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSBundle.py" - fi -fi +# lldb/formatters +package_files="${SRC_ROOT}/examples/summaries/cocoa/cache.py +${SRC_ROOT}/examples/summaries/cocoa/metrics.py +${SRC_ROOT}/examples/summaries/cocoa/attrib_fromdict.py +${SRC_ROOT}/examples/summaries/cocoa/Logger.py" +create_python_package "/formatters" "${package_files}" -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSNumber.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying NSNumber.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/NSNumber.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSNumber.py" - fi -fi +# lldb/utils +package_files="${SRC_ROOT}/examples/python/symbolication.py" +create_python_package "/utils" "${package_files}" -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSDate.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying NSDate.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/NSDate.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSDate.py" - fi -fi +# lldb/macosx +package_files="${SRC_ROOT}/examples/python/crashlog.py +${SRC_ROOT}/examples/darwin/heap_find/heap.py" +create_python_package "/macosx" "${package_files}" -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSIndexSet.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying NSIndexSet.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/NSIndexSet.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSIndexSet.py" - fi -fi - -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/CFBitVector.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying CFBitVector.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/CFBitVector.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/CFBitVector.py" - fi -fi - -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/Selector.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying Selector.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/Selector.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/Selector.py" - fi -fi - -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/Class.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying Class.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/Class.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/Class.py" - fi -fi - -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/cache.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying cache.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/cache.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/cache.py" - fi -fi - -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/metrics.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying metrics.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/metrics.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/metrics.py" - fi -fi - -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/attrib_fromdict.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying attrib_fromdict.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/attrib_fromdict.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/attrib_fromdict.py" - fi -fi - -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/Logger.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying Logger.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/Logger.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/Logger.py" - fi -fi - -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/objc_lldb.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying objc_lldb.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/objc_lldb.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/objc_lldb.py" - fi -fi - -if [ -f "${SRC_ROOT}/examples/summaries/cocoa/objc_runtime.py" ] -then - if [ $Debug == 1 ] - then - echo "Copying objc_runtime.py to ${framework_python_dir}" - fi - cp "${SRC_ROOT}/examples/summaries/cocoa/objc_runtime.py" "${framework_python_dir}" -else - if [ $Debug == 1 ] - then - echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/objc_runtime.py" - fi -fi fi - exit 0 diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index 39c111704fef..3c1139f8ce21 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -296,13 +296,14 @@ ScriptInterpreterPython::ScriptInterpreterPython (CommandInterpreter &interprete int old_count = Debugger::TestDebuggerRefCount(); - run_string.Printf ("run_one_line (%s, 'import copy, os, re, sys, uuid, lldb, gnu_libstdcpp, libcxx, objc, Logger')", m_dictionary_name.c_str()); + run_string.Printf ("run_one_line (%s, 'import copy, os, re, sys, uuid, lldb')", m_dictionary_name.c_str()); PyRun_SimpleString (run_string.GetData()); // WARNING: temporary code that loads Cocoa formatters - this should be done on a per-platform basis rather than loading the whole set // and letting the individual formatter classes exploit APIs to check whether they can/cannot do their task run_string.Clear(); - run_string.Printf ("run_one_line (%s, 'import CFString, CFArray, CFDictionary, NSData, NSMachPort, NSSet, NSNotification, NSException, CFBag, CFBinaryHeap, NSURL, NSBundle, NSNumber, NSDate, NSIndexSet, Selector, Class, CFBitVector')", m_dictionary_name.c_str()); + //run_string.Printf ("run_one_line (%s, 'from lldb.formatters import *; from lldb.formatters.objc import *; from lldb.formatters.cpp import *')", m_dictionary_name.c_str()); + run_string.Printf ("run_one_line (%s, 'from lldb.formatters import *')", m_dictionary_name.c_str()); PyRun_SimpleString (run_string.GetData()); int new_count = Debugger::TestDebuggerRefCount(); @@ -1961,13 +1962,7 @@ ScriptInterpreterPython::InitializePrivate () } } - PyRun_SimpleString ("sys.dont_write_bytecode = 1"); - - PyRun_SimpleString ("import embedded_interpreter"); - - PyRun_SimpleString ("from embedded_interpreter import run_python_interpreter"); - PyRun_SimpleString ("from embedded_interpreter import run_one_line"); - PyRun_SimpleString ("from termios import *"); + PyRun_SimpleString ("sys.dont_write_bytecode = 1; import lldb.embedded_interpreter; from lldb.embedded_interpreter import run_python_interpreter; from lldb.embedded_interpreter import run_one_line; from termios import *"); stdin_tty_state.Restore(); } diff --git a/lldb/test/dotest.py b/lldb/test/dotest.py index cd9576ff6a1a..2c9160681e10 100755 --- a/lldb/test/dotest.py +++ b/lldb/test/dotest.py @@ -834,17 +834,17 @@ def setupSysPath(): baiPath2 = os.path.join(base, *(xcode4_build_dir + bai + python_resource_dir)) lldbPath = None - if os.path.isfile(os.path.join(dbgPath, 'lldb.py')): + if os.path.isfile(os.path.join(dbgPath, 'lldb/__init__.py')): lldbPath = dbgPath - elif os.path.isfile(os.path.join(dbgPath2, 'lldb.py')): + elif os.path.isfile(os.path.join(dbgPath2, 'lldb/__init__.py')): lldbPath = dbgPath2 - elif os.path.isfile(os.path.join(relPath, 'lldb.py')): + elif os.path.isfile(os.path.join(relPath, 'lldb/__init__.py')): lldbPath = relPath - elif os.path.isfile(os.path.join(relPath2, 'lldb.py')): + elif os.path.isfile(os.path.join(relPath2, 'lldb/__init__.py')): lldbPath = relPath2 - elif os.path.isfile(os.path.join(baiPath, 'lldb.py')): + elif os.path.isfile(os.path.join(baiPath, 'lldb/__init__.py')): lldbPath = baiPath - elif os.path.isfile(os.path.join(baiPath2, 'lldb.py')): + elif os.path.isfile(os.path.join(baiPath2, 'lldb/__init__.py')): lldbPath = baiPath2 if not lldbPath: