diff options
-rw-r--r-- | lldb/lldb.xcodeproj/project.pbxproj | 24 | ||||
-rwxr-xr-x | lldb/scripts/Python/build-swig-Python.sh | 11 | ||||
-rw-r--r-- | lldb/scripts/Python/edit-swig-python-wrapper-file.py | 47 | ||||
-rw-r--r-- | lldb/source/API/SBBreakpointLocation.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Interpreter/ScriptInterpreterPython.cpp | 4 |
5 files changed, 57 insertions, 34 deletions
diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj index 40bf0182482..fe8af9feceb 100644 --- a/lldb/lldb.xcodeproj/project.pbxproj +++ b/lldb/lldb.xcodeproj/project.pbxproj @@ -50,7 +50,7 @@ 2668022F115FD19D008E1FE4 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C39010F3FA26009D5894 /* CoreFoundation.framework */; }; 26680230115FD19E008E1FE4 /* DebugSymbols.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 265ABF6210F42EE900531910 /* DebugSymbols.framework */; }; 26680231115FD1A0008E1FE4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 260C876910F538E700BB2B04 /* Foundation.framework */; }; - 26680232115FD1A4008E1FE4 /* libpython2.6.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32410F3DF23009D5894 /* libpython2.6.dylib */; }; + 26680232115FD1A4008E1FE4 /* libpython.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32410F3DF23009D5894 /* libpython.dylib */; }; 26680233115FD1A7008E1FE4 /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C37410F3F61B009D5894 /* libobjc.dylib */; }; 26680324116005D9008E1FE4 /* SBThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9831091125FC5800A56CB0 /* SBThread.cpp */; }; 26680326116005DB008E1FE4 /* SBTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9831071125FC5800A56CB0 /* SBTarget.cpp */; }; @@ -319,7 +319,7 @@ 26DE20651161904E00A093E2 /* SBSymbol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26DE20641161904E00A093E2 /* SBSymbol.cpp */; }; 26F5C27710F3D9E4009D5894 /* Driver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F5C27310F3D9E4009D5894 /* Driver.cpp */; }; 26F5C27810F3D9E4009D5894 /* IOChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F5C27510F3D9E4009D5894 /* IOChannel.cpp */; }; - 26F5C32510F3DF23009D5894 /* libpython2.6.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32410F3DF23009D5894 /* libpython2.6.dylib */; }; + 26F5C32510F3DF23009D5894 /* libpython.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32410F3DF23009D5894 /* libpython.dylib */; }; 26F5C32C10F3DFDD009D5894 /* libedit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32A10F3DFDD009D5894 /* libedit.dylib */; }; 26F5C32D10F3DFDD009D5894 /* libtermcap.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32B10F3DFDD009D5894 /* libtermcap.dylib */; }; 26F5C37510F3F61B009D5894 /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C37410F3F61B009D5894 /* libobjc.dylib */; }; @@ -938,7 +938,7 @@ 26F5C27410F3D9E4009D5894 /* Driver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Driver.h; path = tools/driver/Driver.h; sourceTree = "<group>"; }; 26F5C27510F3D9E4009D5894 /* IOChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IOChannel.cpp; path = tools/driver/IOChannel.cpp; sourceTree = "<group>"; }; 26F5C27610F3D9E4009D5894 /* IOChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IOChannel.h; path = tools/driver/IOChannel.h; sourceTree = "<group>"; }; - 26F5C32410F3DF23009D5894 /* libpython2.6.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libpython2.6.dylib; path = /usr/lib/libpython2.6.dylib; sourceTree = "<absolute>"; }; + 26F5C32410F3DF23009D5894 /* libpython.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libpython.dylib; path = /usr/lib/libpython.dylib; sourceTree = "<absolute>"; }; 26F5C32A10F3DFDD009D5894 /* libedit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libedit.dylib; path = /usr/lib/libedit.dylib; sourceTree = "<absolute>"; }; 26F5C32B10F3DFDD009D5894 /* libtermcap.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libtermcap.dylib; path = /usr/lib/libtermcap.dylib; sourceTree = "<absolute>"; }; 26F5C37410F3F61B009D5894 /* libobjc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libobjc.dylib; path = /usr/lib/libobjc.dylib; sourceTree = "<absolute>"; }; @@ -1154,7 +1154,7 @@ 2668022F115FD19D008E1FE4 /* CoreFoundation.framework in Frameworks */, 26680230115FD19E008E1FE4 /* DebugSymbols.framework in Frameworks */, 26680231115FD1A0008E1FE4 /* Foundation.framework in Frameworks */, - 26680232115FD1A4008E1FE4 /* libpython2.6.dylib in Frameworks */, + 26680232115FD1A4008E1FE4 /* libpython.dylib in Frameworks */, 26680233115FD1A7008E1FE4 /* libobjc.dylib in Frameworks */, 4C74CB6312288704006A8171 /* Carbon.framework in Frameworks */, ); @@ -1164,7 +1164,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 26F5C32510F3DF23009D5894 /* libpython2.6.dylib in Frameworks */, + 26F5C32510F3DF23009D5894 /* libpython.dylib in Frameworks */, 26F5C32C10F3DFDD009D5894 /* libedit.dylib in Frameworks */, 26F5C32D10F3DFDD009D5894 /* libtermcap.dylib in Frameworks */, 26F5C37510F3F61B009D5894 /* libobjc.dylib in Frameworks */, @@ -2176,7 +2176,7 @@ 260C876910F538E700BB2B04 /* Foundation.framework */, 26F5C32A10F3DFDD009D5894 /* libedit.dylib */, 26F5C37410F3F61B009D5894 /* libobjc.dylib */, - 26F5C32410F3DF23009D5894 /* libpython2.6.dylib */, + 26F5C32410F3DF23009D5894 /* libpython.dylib */, 26F5C32B10F3DFDD009D5894 /* libtermcap.dylib */, 4C74CB6212288704006A8171 /* Carbon.framework */, ); @@ -3076,7 +3076,7 @@ GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_VERSION = 4.2; - HEADER_SEARCH_PATHS = /usr/include/python2.6; + HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "resources/LLDB-Info.plist"; INSTALL_PATH = /Developer/Library/PrivateFrameworks; LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/Versions/A/LLDB"; @@ -3129,7 +3129,7 @@ GCC_ENABLE_OBJC_GC = supported; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_VERSION = 4.2; - HEADER_SEARCH_PATHS = /usr/include/python2.6; + HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "resources/LLDB-Info.plist"; INSTALL_PATH = /Developer/Library/PrivateFrameworks; LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/Versions/A/LLDB"; @@ -3201,7 +3201,7 @@ GCC_MODEL_TUNING = G5; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = 4.2; - HEADER_SEARCH_PATHS = /usr/include/python2.6; + HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; LIBRARY_SEARCH_PATHS = "$(inherited)"; @@ -3240,7 +3240,7 @@ GCC_ENABLE_OBJC_GC = supported; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; GCC_VERSION = 4.2; - HEADER_SEARCH_PATHS = /usr/include/python2.6; + HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "resources/LLDB-Info.plist"; INSTALL_PATH = /Developer/Library/PrivateFrameworks; LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/Versions/A/LLDB"; @@ -3291,7 +3291,7 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = 4.2; - HEADER_SEARCH_PATHS = /usr/include/python2.6; + HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; LIBRARY_SEARCH_PATHS = "$(inherited)"; @@ -3331,7 +3331,7 @@ GCC_MODEL_TUNING = G5; GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_VERSION = 4.2; - HEADER_SEARCH_PATHS = /usr/include/python2.6; + HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = "lldb-Info.plist"; INSTALL_PATH = /Developer/usr/bin; LIBRARY_SEARCH_PATHS = "$(inherited)"; diff --git a/lldb/scripts/Python/build-swig-Python.sh b/lldb/scripts/Python/build-swig-Python.sh index 56a54ce94c3..f412fb89cdc 100755 --- a/lldb/scripts/Python/build-swig-Python.sh +++ b/lldb/scripts/Python/build-swig-Python.sh @@ -179,3 +179,14 @@ if [ -f "${current_dir}/append-debugger-id.py" ] then python ${current_dir}/append-debugger-id.py ${CONFIG_BUILD_DIR} fi + +# Fix the "#include" statement in the swig output file + +if [ -f "${current_dir}/edit-swig-python-wrapper-file.py" ] +then + python ${current_dir}/edit-swig-python-wrapper-file.py + if [ -f "${swig_output_file}.edited" ] + then + mv "${swig_output_file}.edited" ${swig_output_file} + fi +fi diff --git a/lldb/scripts/Python/edit-swig-python-wrapper-file.py b/lldb/scripts/Python/edit-swig-python-wrapper-file.py index a8c43239471..4a71da1dff4 100644 --- a/lldb/scripts/Python/edit-swig-python-wrapper-file.py +++ b/lldb/scripts/Python/edit-swig-python-wrapper-file.py @@ -3,17 +3,28 @@ # # This script performs some post-processing editing on the C++ file that # SWIG generates for python, after running on 'lldb.swig'. In -# particular, the types SWIGTYPE_p_SBThread and SWIGTYPE_p_SBTarget are -# being used, when the types that *should* be used are -# SWIGTYPE_p_lldb__SBThread and SWIGTYPE_p_lldb__SBTarget. -# This script goes through the C++ file SWIG generated, reading it in line -# by line and doing a search-and-replace for these strings. +# particular, on Apple systems we want to include the Python.h file that +# is used in the /System/Library/Frameworks/Python.framework, but on other +# systems we want to include plain <Python.h>. So we need to replace: +# +# #include <Python.h> +# +# with: +# +# #if defined (__APPLE__) +# #include <Python/Python.h> +# #else +# #include <Python.h> +# #endif +# +# That's what this python script does. # import os -full_input_name = os.environ["SCRIPT_INPUT_FILE_1"]; +input_dir_name = os.environ["SRCROOT"] +full_input_name = input_dir_name + "/source/LLDBWrapPython.cpp" full_output_name = full_input_name + ".edited" try: @@ -26,8 +37,7 @@ else: except IOError: print "Error: Unable to open file for writing: " + full_output_name else: - target_typedef_found = False - thread_typedef_found = False + include_line_found = False try: line = f_in.readline() @@ -37,15 +47,18 @@ else: while line: # # - if (line.find ("SWIGTYPE_p_SBTarget")): - if (line.find ("define") < 0): - line = line.replace ("SWIGTYPE_p_SBTarget", - "SWIGTYPE_p_lldb__SBTarget") - if (line.find ("SWIGTYPE_p_SBThread")): - if (line.find ("define") < 0): - line = line.replace ("SWIGTYPE_p_SBThread", - "SWIGTYPE_p_lldb__SBThread") - f_out.write (line) + if not include_line_found: + if (line.find ("#include <Python.h>") == 0): + f_out.write ("#if defined (__APPLE__)\n"); + f_out.write ("#include <Python/Python.h>\n"); + f_out.write ("#else\n"); + f_out.write (line); + f_out.write ("#endif\n"); + include_line_found = True + else: + f_out.write (line) + else: + f_out.write (line) try: line = f_in.readline() except IOError: diff --git a/lldb/source/API/SBBreakpointLocation.cpp b/lldb/source/API/SBBreakpointLocation.cpp index 45c153b62ea..d14865902b0 100644 --- a/lldb/source/API/SBBreakpointLocation.cpp +++ b/lldb/source/API/SBBreakpointLocation.cpp @@ -7,11 +7,6 @@ // //===----------------------------------------------------------------------===// -// In order to guarantee correct working with Python, Python.h *MUST* be -// the *FIRST* header file included: - -#include <Python.h> - #include "lldb/API/SBBreakpointLocation.h" #include "lldb/API/SBDefines.h" #include "lldb/API/SBDebugger.h" diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index 906cb742350..ef472c385a0 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -10,7 +10,11 @@ // In order to guarantee correct working with Python, Python.h *MUST* be // the *FIRST* header file included: +#if defined (__APPLE__) +#include <Python/Python.h> +#else #include <Python.h> +#endif #include "lldb/Interpreter/ScriptInterpreterPython.h" |