[Lldb-commits] [lldb] r195557 - Change lldb from building against a Python framework out of

Jason Molenda jmolenda at apple.com
Sat Nov 23 12:07:29 PST 2013


Author: jmolenda
Date: Sat Nov 23 14:07:29 2013
New Revision: 195557

URL: http://llvm.org/viewvc/llvm-project?rev=195557&view=rev
Log:
Change lldb from building against a Python framework out of
the installed SDK to using the current OS installed headers/libraries.
This change is to address the removal of the Python framework
from the Mac OS X 10.9 (Mavericks) SDK, and is the recommended
workaround via https://developer.apple.com/library/mac/technotes/tn2328/_index.html


Removed:
    lldb/trunk/scripts/Python/edit-swig-python-wrapper-file.py
Modified:
    lldb/trunk/include/lldb/Interpreter/PythonDataObjects.h
    lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
    lldb/trunk/include/lldb/Utility/PythonPointer.h
    lldb/trunk/include/lldb/lldb-python.h
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/scripts/Python/build-swig-Python.sh
    lldb/trunk/source/Interpreter/Makefile
    lldb/trunk/source/Interpreter/PythonDataObjects.cpp
    lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Modified: lldb/trunk/include/lldb/Interpreter/PythonDataObjects.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/PythonDataObjects.h?rev=195557&r1=195556&r2=195557&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/PythonDataObjects.h (original)
+++ lldb/trunk/include/lldb/Interpreter/PythonDataObjects.h Sat Nov 23 14:07:29 2013
@@ -19,11 +19,7 @@
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/Flags.h"
 #include "lldb/Interpreter/OptionValue.h"
-#if defined (__APPLE__)
-#include <Python/Python.h>
-#else
 #include <Python.h>
-#endif
 
 namespace lldb_private {
     

Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h?rev=195557&r1=195556&r2=195557&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreterPython.h Sat Nov 23 14:07:29 2013
@@ -17,11 +17,7 @@
 
 #else
 
-#if defined (__APPLE__)
-#include <Python/Python.h>
-#else
 #include <Python.h>
-#endif
 
 #include "lldb/lldb-private.h"
 #include "lldb/Interpreter/ScriptInterpreter.h"

Modified: lldb/trunk/include/lldb/Utility/PythonPointer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/PythonPointer.h?rev=195557&r1=195556&r2=195557&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/PythonPointer.h (original)
+++ lldb/trunk/include/lldb/Utility/PythonPointer.h Sat Nov 23 14:07:29 2013
@@ -12,11 +12,7 @@
 
 #include <algorithm>
 
-#if defined (__APPLE__)
-#include <Python/Python.h>
-#else
 #include <Python.h>
-#endif
 
 namespace lldb_private {
 

Modified: lldb/trunk/include/lldb/lldb-python.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-python.h?rev=195557&r1=195556&r2=195557&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-python.h (original)
+++ lldb/trunk/include/lldb/lldb-python.h Sat Nov 23 14:07:29 2013
@@ -18,11 +18,7 @@
 
 #else
 
-#if defined (__APPLE__)
-#include <Python/Python.h>
-#else
 #include <Python.h>
-#endif
 
 #endif // LLDB_DISABLE_PYTHON
 

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=195557&r1=195556&r2=195557&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Sat Nov 23 14:07:29 2013
@@ -4827,6 +4827,12 @@
 					"$(inherited)",
 				);
 				OTHER_CPLUSPLUSFLAGS = (
+					"-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7",
+					"-fno-rtti",
+					"-Wglobal-constructors",
+					"$(OTHER_CFLAGS)",
+				);
+				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = (
 					"-fno-rtti",
 					"-Wglobal-constructors",
 					"$(OTHER_CFLAGS)",
@@ -4836,11 +4842,15 @@
 					Carbon,
 					"-framework",
 					DebugSymbols,
-					"-lpython",
+					"-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config",
+					"-lpython2.7",
 					"-lllvmclang",
 					"-framework",
 					Foundation,
+					"-framework",
+					AppKit,
 					"-v",
+					"-Wl,-v",
 				);
 				"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
 					"-lllvmclang",
@@ -4882,6 +4892,12 @@
 					"$(inherited)",
 				);
 				OTHER_CPLUSPLUSFLAGS = (
+					"-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7",
+					"-fno-rtti",
+					"-Wglobal-constructors",
+					"$(OTHER_CFLAGS)",
+				);
+				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = (
 					"-fno-rtti",
 					"-Wglobal-constructors",
 					"$(OTHER_CFLAGS)",
@@ -4891,13 +4907,15 @@
 					Carbon,
 					"-framework",
 					DebugSymbols,
-					"-lpython",
+					"-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config",
+					"-lpython2.7",
 					"-lllvmclang",
 					"-framework",
 					Foundation,
 					"-framework",
 					AppKit,
 					"-v",
+					"-Wl,-v",
 				);
 				"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
 					"-lllvmclang",
@@ -4986,6 +5004,13 @@
 				HEADER_SEARCH_PATHS = /usr/include/libxml2;
 				MACH_O_TYPE = staticlib;
 				OTHER_CPLUSPLUSFLAGS = (
+					"-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7",
+					"-fno-rtti",
+					"-Wglobal-constructors",
+					"$(OTHER_CFLAGS)",
+					"-DLLDB_USE_BUILTIN_DEMANGLER",
+				);
+				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = (
 					"-fno-rtti",
 					"-Wglobal-constructors",
 					"$(OTHER_CFLAGS)",
@@ -5015,6 +5040,13 @@
 				HEADER_SEARCH_PATHS = /usr/include/libxml2;
 				MACH_O_TYPE = staticlib;
 				OTHER_CPLUSPLUSFLAGS = (
+					"-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7",
+					"-fno-rtti",
+					"-Wglobal-constructors",
+					"$(OTHER_CFLAGS)",
+					"-DLLDB_USE_BUILTIN_DEMANGLER",
+				);
+				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = (
 					"-fno-rtti",
 					"-Wglobal-constructors",
 					"$(OTHER_CFLAGS)",
@@ -5044,6 +5076,13 @@
 				HEADER_SEARCH_PATHS = /usr/include/libxml2;
 				MACH_O_TYPE = staticlib;
 				OTHER_CPLUSPLUSFLAGS = (
+					"-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7",
+					"-fno-rtti",
+					"-Wglobal-constructors",
+					"$(OTHER_CFLAGS)",
+					"-DLLDB_USE_BUILTIN_DEMANGLER",
+				);
+				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = (
 					"-fno-rtti",
 					"-Wglobal-constructors",
 					"$(OTHER_CFLAGS)",
@@ -5190,6 +5229,12 @@
 					"$(inherited)",
 				);
 				OTHER_CPLUSPLUSFLAGS = (
+					"-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7",
+					"-fno-rtti",
+					"-Wglobal-constructors",
+					"$(OTHER_CFLAGS)",
+				);
+				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = (
 					"-fno-rtti",
 					"-Wglobal-constructors",
 					"$(OTHER_CFLAGS)",
@@ -5199,7 +5244,8 @@
 					Carbon,
 					"-framework",
 					DebugSymbols,
-					"-lpython",
+					"-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config",
+					"-lpython2.7",
 					"-lllvmclang",
 					"-framework",
 					Foundation,
@@ -5606,15 +5652,24 @@
 					"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)",
 					"$(inherited)",
 				);
+				OTHER_CFLAGS = (
+					"-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7",
+					"-flimit-debug-info",
+					"-Wparentheses",
+				);
+				"OTHER_CFLAGS[sdk=iphoneos*]" = (
+					"-flimit-debug-info",
+					"-Wparentheses",
+				);
+				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = "$(OTHER_CFLAGS)";
 				OTHER_LDFLAGS = (
 					"-lllvmclang",
-					"-lpython",
+					"-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config",
+					"-lpython2.7",
 					"-lxml2",
 					"-framework",
 					DebugSymbols,
 					"-framework",
-					Carbon,
-					"-framework",
 					Foundation,
 					"-framework",
 					AppKit,
@@ -5664,15 +5719,24 @@
 					"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)",
 					"$(inherited)",
 				);
+				OTHER_CFLAGS = (
+					"-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7",
+					"-flimit-debug-info",
+					"-Wparentheses",
+				);
+				"OTHER_CFLAGS[sdk=iphoneos*]" = (
+					"-flimit-debug-info",
+					"-Wparentheses",
+				);
+				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = "$(OTHER_CFLAGS)";
 				OTHER_LDFLAGS = (
 					"-lllvmclang",
-					"-lpython",
+					"-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config",
+					"-lpython2.7",
 					"-lxml2",
 					"-framework",
 					DebugSymbols,
 					"-framework",
-					Carbon,
-					"-framework",
 					Foundation,
 					"-framework",
 					AppKit,
@@ -5722,15 +5786,24 @@
 					"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)",
 					"$(inherited)",
 				);
+				OTHER_CFLAGS = (
+					"-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7",
+					"-flimit-debug-info",
+					"-Wparentheses",
+				);
+				"OTHER_CFLAGS[sdk=iphoneos*]" = (
+					"-flimit-debug-info",
+					"-Wparentheses",
+				);
+				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = "$(OTHER_CFLAGS)";
 				OTHER_LDFLAGS = (
 					"-lllvmclang",
-					"-lpython",
+					"-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config",
+					"-lpython2.7",
 					"-lxml2",
 					"-framework",
 					DebugSymbols,
 					"-framework",
-					Carbon,
-					"-framework",
 					Foundation,
 					"-framework",
 					AppKit,
@@ -5956,6 +6029,12 @@
 					"$(inherited)",
 				);
 				OTHER_CPLUSPLUSFLAGS = (
+					"-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7",
+					"-fno-rtti",
+					"-Wglobal-constructors",
+					"$(OTHER_CFLAGS)",
+				);
+				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = (
 					"-fno-rtti",
 					"-Wglobal-constructors",
 					"$(OTHER_CFLAGS)",
@@ -5965,11 +6044,15 @@
 					Carbon,
 					"-framework",
 					DebugSymbols,
-					"-lpython",
+					"-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config",
+					"-lpython2.7",
 					"-lllvmclang",
 					"-framework",
 					Foundation,
+					"-framework",
+					AppKit,
 					"-v",
+					"-Wl,-v",
 				);
 				"OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = (
 					"-lllvmclang",
@@ -6012,6 +6095,13 @@
 				HEADER_SEARCH_PATHS = /usr/include/libxml2;
 				MACH_O_TYPE = staticlib;
 				OTHER_CPLUSPLUSFLAGS = (
+					"-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7",
+					"-fno-rtti",
+					"-Wglobal-constructors",
+					"$(OTHER_CFLAGS)",
+					"-DLLDB_USE_BUILTIN_DEMANGLER",
+				);
+				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = (
 					"-fno-rtti",
 					"-Wglobal-constructors",
 					"$(OTHER_CFLAGS)",
@@ -6058,14 +6148,24 @@
 					"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)",
 					"$(inherited)",
 				);
+				OTHER_CFLAGS = (
+					"-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7",
+					"-flimit-debug-info",
+					"-Wparentheses",
+				);
+				"OTHER_CFLAGS[sdk=iphoneos*]" = (
+					"-flimit-debug-info",
+					"-Wparentheses",
+				);
+				"OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = "$(OTHER_CFLAGS)";
 				OTHER_LDFLAGS = (
 					"-lllvmclang",
-					"-lpython",
+					"-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config",
+					"-lpython2.7",
+					"-lxml2",
 					"-framework",
 					DebugSymbols,
 					"-framework",
-					Carbon,
-					"-framework",
 					Foundation,
 					"-framework",
 					AppKit,

Modified: lldb/trunk/scripts/Python/build-swig-Python.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/build-swig-Python.sh?rev=195557&r1=195556&r2=195557&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/build-swig-Python.sh (original)
+++ lldb/trunk/scripts/Python/build-swig-Python.sh Sat Nov 23 14:07:29 2013
@@ -359,20 +359,5 @@ then
     python ${current_dir}/modify-python-lldb.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
-    if [ $MakefileCalled -eq 1 ]
-    then
-        python ${current_dir}/edit-swig-python-wrapper-file.py "${TARGET_DIR}"
-    else
-        python ${current_dir}/edit-swig-python-wrapper-file.py
-    fi
-    if [ -f "${swig_output_file}.edited" ]
-    then
-        mv "${swig_output_file}.edited" ${swig_output_file}
-    fi
-fi
 
 fi

Removed: lldb/trunk/scripts/Python/edit-swig-python-wrapper-file.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/edit-swig-python-wrapper-file.py?rev=195556&view=auto
==============================================================================
--- lldb/trunk/scripts/Python/edit-swig-python-wrapper-file.py (original)
+++ lldb/trunk/scripts/Python/edit-swig-python-wrapper-file.py (removed)
@@ -1,53 +0,0 @@
-#
-# edit-swig-python-wrapper-file.py
-#
-# This script performs some post-processing editing on the C++ file that
-# SWIG generates for python, after running on 'lldb.swig'.   In
-# 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, sys
-
-include_python = '#include <Python.h>'
-include_python_ifdef = '''#if defined (__APPLE__)
-#include <Python/Python.h>
-#else
-#include <Python.h>
-#endif
-'''
-
-if len (sys.argv) > 1:
-    input_dir_name = sys.argv[1]
-    full_input_name = input_dir_name + "/LLDBWrapPython.cpp"
-else:
-    input_dir_name = os.environ["SRCROOT"]
-    full_input_name = input_dir_name + "/source/LLDBWrapPython.cpp"
-full_output_name = full_input_name + ".edited"
-
-with open(full_input_name, 'r') as f_in:
-    with open(full_output_name, 'w') as f_out:
-        include_python_found = False
-        for line in f_in:
-            if not include_python_found:
-                if line.startswith(include_python):
-                    # Write out the modified lines.
-                    f_out.write(include_python_ifdef)
-                    include_python_found = True
-                    continue
-
-            # Otherwise, copy the line verbatim to the output file.
-            f_out.write(line)

Modified: lldb/trunk/source/Interpreter/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Makefile?rev=195557&r1=195556&r2=195557&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Makefile (original)
+++ lldb/trunk/source/Interpreter/Makefile Sat Nov 23 14:07:29 2013
@@ -25,13 +25,9 @@ EXTRA_OPTIONS += -Wno-four-char-constant
 # which we are not currently clean with (due to SWIG generated cpp source).
 EXTRA_OPTIONS += -Wno-missing-field-initializers -Wno-self-assign -Wno-sometimes-uninitialized
 
-# edit-swig-python-wrapper-file.py needs $(SRCROOT)
-export SRCROOT := $(PROJ_SRC_DIR)/$(LLDB_LEVEL)
-
 PYTHON_DIR := $(PROJ_OBJ_ROOT)/$(BuildMode)
 
 LLDBWrapPython.cpp lldb.py: $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/modify-python-lldb.py \
-                            $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/edit-swig-python-wrapper-file.py \
                             $(wildcard $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/interface/*.i)
 	$(Echo) Generating LLDBWrapPython.cpp
 	$(Verb) "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/build-swig-wrapper-classes.sh" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)" "$(PROJ_OBJ_DIR)" "$(PROJ_OBJ_DIR)" "$(PYTHON_DIR)" -m $(if $(DISABLE_AUTO_DEPENDENCIES),,-M)

Modified: lldb/trunk/source/Interpreter/PythonDataObjects.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/PythonDataObjects.cpp?rev=195557&r1=195556&r2=195557&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/PythonDataObjects.cpp (original)
+++ lldb/trunk/source/Interpreter/PythonDataObjects.cpp Sat Nov 23 14:07:29 2013
@@ -15,11 +15,7 @@
 
 #else
 
-#if defined (__APPLE__)
-#include <Python/Python.h>
-#else
 #include <Python.h>
-#endif
 
 #include <stdio.h>
 

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=195557&r1=195556&r2=195557&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Sat Nov 23 14:07:29 2013
@@ -15,11 +15,7 @@
 
 #else
 
-#if defined (__APPLE__)
-#include <Python/Python.h>
-#else
 #include <Python.h>
-#endif
 
 #include "lldb/Interpreter/ScriptInterpreterPython.h"
 





More information about the lldb-commits mailing list