[Lldb-commits] [lldb] r235559 - Use the debugginess of the python interpreter when symlinking _lldb.pyd.

Zachary Turner zturner at google.com
Wed Apr 22 15:53:18 PDT 2015


Author: zturner
Date: Wed Apr 22 17:53:18 2015
New Revision: 235559

URL: http://llvm.org/viewvc/llvm-project?rev=235559&view=rev
Log:
Use the debugginess of the python interpreter when symlinking _lldb.pyd.

Previously we would pass an argument to finishSwigWrapperClasses.py which
specified whether this was a debug or a release build.  But sometimes
CMAKE_BUILD_TYPE would not be set to anything, causing this argument
to be empty when passed in.  The only purpose of this argument was to
determine whether or not to append _d to the extension module when
creating the symlink.  This is only necessary when doing a debug
build of LLDB on Windows, which implies a debug interpreter, so we
replace this with a check to see if the running interpreter is a debug
one, and append _d if so.

Modified:
    lldb/trunk/CMakeLists.txt
    lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
    lldb/trunk/scripts/finishSwigWrapperClasses.py

Modified: lldb/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=235559&r1=235558&r2=235559&view=diff
==============================================================================
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Wed Apr 22 17:53:18 2015
@@ -17,7 +17,7 @@ add_subdirectory(lit)
 if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION AND NOT LLDB_DISABLE_PYTHON )
 	# Add a Post-Build Event to copy over Python files and create the symlink to liblldb.so for the Python API(hardlink on Windows)
     add_custom_target( finish_swig ALL
-        COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py --buildConfig=${CMAKE_BUILD_TYPE} "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}/scripts" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/scripts" "--prefix=${CMAKE_BINARY_DIR}" "--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}" -m
+        COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}/scripts" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/scripts" "--prefix=${CMAKE_BINARY_DIR}" "--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}" -m
         DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
         COMMENT "Python script sym-linking LLDB Python API")
     add_dependencies(finish_swig liblldb argdumper)

Modified: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finishSwigPythonLLDB.py?rev=235559&r1=235558&r2=235559&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py (original)
+++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py Wed Apr 22 17:53:18 2015
@@ -73,6 +73,9 @@ strErrMsgMkLinkExecute = "Command mklink
 strErrMsgMakeSymlink = "creating symbolic link";
 strErrMsgUnexpected = "Unexpected error: %s";
 
+def is_debug_interpreter():
+    return hasattr(sys, 'gettotalrefcount')
+
 #++---------------------------------------------------------------------------
 # Details:  Copy files needed by lldb/macosx/heap.py to build libheap.dylib.
 # Args:     vDictArgs               - (R) Program input parameters.
@@ -348,7 +351,7 @@ def make_symlink_liblldb( vDictArgs, vst
         # When importing an extension module using a debug version of python, you
         # write, for example, "import foo", but the interpreter searches for
         # "foo_d.pyd"
-        if vDictArgs["--buildConfig"].lower() == "debug":
+        if is_debug_interpreter():
             strTarget += "_d";
         strTarget += ".pyd";
     else:
@@ -640,7 +643,6 @@ def get_framework_python_dir( vDictArgs
             -m (optional)   Specify called from Makefile system. If given locate
                             the LLDBWrapPython.cpp in --srcRoot/source folder
                             else in the --targetDir folder.
-            --buildConfig   The LLDB build configuration (e.g. debug/release).
             --srcRoot       The root of the lldb source tree.
             --targetDir     Where the lldb framework/shared library gets put.
             --cfgBlddir     Where the buildSwigPythonLLDB.py program will

Modified: lldb/trunk/scripts/finishSwigWrapperClasses.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/finishSwigWrapperClasses.py?rev=235559&r1=235558&r2=235559&view=diff
==============================================================================
--- lldb/trunk/scripts/finishSwigWrapperClasses.py (original)
+++ lldb/trunk/scripts/finishSwigWrapperClasses.py Wed Apr 22 17:53:18 2015
@@ -158,14 +158,13 @@ def validate_arguments( vArgv ):
     nResult = 0;
     strListArgs = "hdm"; # Format "hiox:" = -h -i -o -x <arg>
     listLongArgs = ["srcRoot=", "targetDir=", "cfgBldDir=", "prefix=", "cmakeBuildConfiguration=",
-                    "argsFile", "buildConfig="];
+                    "argsFile"];
     dictArgReq = {  "-h": "o",          # o = optional, m = mandatory
                     "-d": "o",
                     "-m": "o",
                     "--srcRoot": "m",
                     "--targetDir": "m",
                     "--cfgBldDir": "o",
-                    "--buildConfig": "m",
                     "--prefix": "o",
                     "--cmakeBuildConfiguration": "o",
                     "--argsFile": "o" };





More information about the lldb-commits mailing list