JDevlieghere created this revision.
JDevlieghere added reviewers: LLDB, labath.
Herald added a subscriber: mgorny.
Herald added a reviewer: jfb.
Herald added a project: LLDB.

All the code required to generate the language bindings for Python and Lua 
lives under scripts, even though the majority of this code aren't scripts at 
all, and surrounded by scripts that are totally unrelated. I've reorganized 
these files and moved everything related to the language bindings into a new 
top-level `bindings` directory. This makes them self contained and much more 
discoverable.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D72437

Files:
  lldb/CMakeLists.txt
  lldb/bindings/CMakeLists.txt
  lldb/bindings/headers.swig
  lldb/bindings/interfaces.swig
  lldb/bindings/interfaces/SBAddress.i
  lldb/bindings/interfaces/SBAttachInfo.i
  lldb/bindings/interfaces/SBBlock.i
  lldb/bindings/interfaces/SBBreakpoint.i
  lldb/bindings/interfaces/SBBreakpointLocation.i
  lldb/bindings/interfaces/SBBreakpointName.i
  lldb/bindings/interfaces/SBBroadcaster.i
  lldb/bindings/interfaces/SBCommandInterpreter.i
  lldb/bindings/interfaces/SBCommandReturnObject.i
  lldb/bindings/interfaces/SBCommunication.i
  lldb/bindings/interfaces/SBCompileUnit.i
  lldb/bindings/interfaces/SBData.i
  lldb/bindings/interfaces/SBDebugger.i
  lldb/bindings/interfaces/SBDeclaration.i
  lldb/bindings/interfaces/SBError.i
  lldb/bindings/interfaces/SBEvent.i
  lldb/bindings/interfaces/SBExecutionContext.i
  lldb/bindings/interfaces/SBExpressionOptions.i
  lldb/bindings/interfaces/SBFile.i
  lldb/bindings/interfaces/SBFileSpec.i
  lldb/bindings/interfaces/SBFileSpecList.i
  lldb/bindings/interfaces/SBFrame.i
  lldb/bindings/interfaces/SBFunction.i
  lldb/bindings/interfaces/SBHostOS.i
  lldb/bindings/interfaces/SBInstruction.i
  lldb/bindings/interfaces/SBInstructionList.i
  lldb/bindings/interfaces/SBLanguageRuntime.i
  lldb/bindings/interfaces/SBLaunchInfo.i
  lldb/bindings/interfaces/SBLineEntry.i
  lldb/bindings/interfaces/SBListener.i
  lldb/bindings/interfaces/SBMemoryRegionInfo.i
  lldb/bindings/interfaces/SBMemoryRegionInfoList.i
  lldb/bindings/interfaces/SBModule.i
  lldb/bindings/interfaces/SBModuleSpec.i
  lldb/bindings/interfaces/SBPlatform.i
  lldb/bindings/interfaces/SBProcess.i
  lldb/bindings/interfaces/SBProcessInfo.i
  lldb/bindings/interfaces/SBQueue.i
  lldb/bindings/interfaces/SBQueueItem.i
  lldb/bindings/interfaces/SBSection.i
  lldb/bindings/interfaces/SBSourceManager.i
  lldb/bindings/interfaces/SBStream.i
  lldb/bindings/interfaces/SBStringList.i
  lldb/bindings/interfaces/SBStructuredData.i
  lldb/bindings/interfaces/SBSymbol.i
  lldb/bindings/interfaces/SBSymbolContext.i
  lldb/bindings/interfaces/SBSymbolContextList.i
  lldb/bindings/interfaces/SBTarget.i
  lldb/bindings/interfaces/SBThread.i
  lldb/bindings/interfaces/SBThreadCollection.i
  lldb/bindings/interfaces/SBThreadPlan.i
  lldb/bindings/interfaces/SBTrace.i
  lldb/bindings/interfaces/SBTraceOptions.i
  lldb/bindings/interfaces/SBType.i
  lldb/bindings/interfaces/SBTypeCategory.i
  lldb/bindings/interfaces/SBTypeEnumMember.i
  lldb/bindings/interfaces/SBTypeFilter.i
  lldb/bindings/interfaces/SBTypeFormat.i
  lldb/bindings/interfaces/SBTypeNameSpecifier.i
  lldb/bindings/interfaces/SBTypeSummary.i
  lldb/bindings/interfaces/SBTypeSynthetic.i
  lldb/bindings/interfaces/SBUnixSignals.i
  lldb/bindings/interfaces/SBValue.i
  lldb/bindings/interfaces/SBValueList.i
  lldb/bindings/interfaces/SBVariablesOptions.i
  lldb/bindings/interfaces/SBWatchpoint.i
  lldb/bindings/lua.swig
  lldb/bindings/macros.swig
  lldb/bindings/python.swig
  lldb/bindings/python/createPythonInit.py
  lldb/bindings/python/python-extensions.swig
  lldb/bindings/python/python-swigsafecast.swig
  lldb/bindings/python/python-typemaps.swig
  lldb/bindings/python/python-wrapper.swig
  lldb/docs/CMakeLists.txt
  lldb/scripts/CMakeLists.txt
  lldb/scripts/Python/createPythonInit.py
  lldb/scripts/Python/python-extensions.swig
  lldb/scripts/Python/python-swigsafecast.swig
  lldb/scripts/Python/python-typemaps.swig
  lldb/scripts/Python/python-wrapper.swig
  lldb/scripts/headers.swig
  lldb/scripts/interface/SBAddress.i
  lldb/scripts/interface/SBAttachInfo.i
  lldb/scripts/interface/SBBlock.i
  lldb/scripts/interface/SBBreakpoint.i
  lldb/scripts/interface/SBBreakpointLocation.i
  lldb/scripts/interface/SBBreakpointName.i
  lldb/scripts/interface/SBBroadcaster.i
  lldb/scripts/interface/SBCommandInterpreter.i
  lldb/scripts/interface/SBCommandReturnObject.i
  lldb/scripts/interface/SBCommunication.i
  lldb/scripts/interface/SBCompileUnit.i
  lldb/scripts/interface/SBData.i
  lldb/scripts/interface/SBDebugger.i
  lldb/scripts/interface/SBDeclaration.i
  lldb/scripts/interface/SBError.i
  lldb/scripts/interface/SBEvent.i
  lldb/scripts/interface/SBExecutionContext.i
  lldb/scripts/interface/SBExpressionOptions.i
  lldb/scripts/interface/SBFile.i
  lldb/scripts/interface/SBFileSpec.i
  lldb/scripts/interface/SBFileSpecList.i
  lldb/scripts/interface/SBFrame.i
  lldb/scripts/interface/SBFunction.i
  lldb/scripts/interface/SBHostOS.i
  lldb/scripts/interface/SBInstruction.i
  lldb/scripts/interface/SBInstructionList.i
  lldb/scripts/interface/SBLanguageRuntime.i
  lldb/scripts/interface/SBLaunchInfo.i
  lldb/scripts/interface/SBLineEntry.i
  lldb/scripts/interface/SBListener.i
  lldb/scripts/interface/SBMemoryRegionInfo.i
  lldb/scripts/interface/SBMemoryRegionInfoList.i
  lldb/scripts/interface/SBModule.i
  lldb/scripts/interface/SBModuleSpec.i
  lldb/scripts/interface/SBPlatform.i
  lldb/scripts/interface/SBProcess.i
  lldb/scripts/interface/SBProcessInfo.i
  lldb/scripts/interface/SBQueue.i
  lldb/scripts/interface/SBQueueItem.i
  lldb/scripts/interface/SBSection.i
  lldb/scripts/interface/SBSourceManager.i
  lldb/scripts/interface/SBStream.i
  lldb/scripts/interface/SBStringList.i
  lldb/scripts/interface/SBStructuredData.i
  lldb/scripts/interface/SBSymbol.i
  lldb/scripts/interface/SBSymbolContext.i
  lldb/scripts/interface/SBSymbolContextList.i
  lldb/scripts/interface/SBTarget.i
  lldb/scripts/interface/SBThread.i
  lldb/scripts/interface/SBThreadCollection.i
  lldb/scripts/interface/SBThreadPlan.i
  lldb/scripts/interface/SBTrace.i
  lldb/scripts/interface/SBTraceOptions.i
  lldb/scripts/interface/SBType.i
  lldb/scripts/interface/SBTypeCategory.i
  lldb/scripts/interface/SBTypeEnumMember.i
  lldb/scripts/interface/SBTypeFilter.i
  lldb/scripts/interface/SBTypeFormat.i
  lldb/scripts/interface/SBTypeNameSpecifier.i
  lldb/scripts/interface/SBTypeSummary.i
  lldb/scripts/interface/SBTypeSynthetic.i
  lldb/scripts/interface/SBUnixSignals.i
  lldb/scripts/interface/SBValue.i
  lldb/scripts/interface/SBValueList.i
  lldb/scripts/interface/SBVariablesOptions.i
  lldb/scripts/interface/SBWatchpoint.i
  lldb/scripts/interfaces.swig
  lldb/scripts/lldb.swig
  lldb/scripts/lldb_lua.swig
  lldb/scripts/macros.swig
  lldb/source/API/CMakeLists.txt

Index: lldb/source/API/CMakeLists.txt
===================================================================
--- lldb/source/API/CMakeLists.txt
+++ lldb/source/API/CMakeLists.txt
@@ -5,13 +5,13 @@
 get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
 
 if(LLDB_ENABLE_PYTHON)
-  get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
-  set(lldb_python_wrapper ${lldb_scripts_dir}/LLDBWrapPython.cpp)
+  get_target_property(lldb_bindings_dir swig_wrapper BINARY_DIR)
+  set(lldb_python_wrapper ${lldb_bindings_dir}/LLDBWrapPython.cpp)
 endif()
 
 if(LLDB_ENABLE_LUA)
-  get_target_property(lldb_scripts_dir swig_wrapper_lua BINARY_DIR)
-  set(lldb_lua_wrapper ${lldb_scripts_dir}/LLDBWrapLua.cpp)
+  get_target_property(lldb_bindings_dir swig_wrapper_lua BINARY_DIR)
+  set(lldb_lua_wrapper ${lldb_bindings_dir}/LLDBWrapLua.cpp)
 endif()
 
 if(LLDB_BUILD_FRAMEWORK)
Index: lldb/scripts/interfaces.swig
===================================================================
--- lldb/scripts/interfaces.swig
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Various liblldb typedefs that SWIG needs to know about.  */
-#define __extension__ /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h. */
-/* The ISO C99 standard specifies that in C++ implementations limit macros such
-   as INT32_MAX should only be defined if __STDC_LIMIT_MACROS is. */
-#define __STDC_LIMIT_MACROS
-%include "stdint.i"
-
-%include "lldb/lldb-defines.h"
-%include "lldb/lldb-enumerations.h"
-%include "lldb/lldb-forward.h"
-%include "lldb/lldb-types.h"
-
-/* Forward declaration of SB classes. */
-%include "lldb/API/SBDefines.h"
-
-/* Python interface files with docstrings. */
-%include "./interface/SBAddress.i"
-%include "./interface/SBAttachInfo.i"
-%include "./interface/SBBlock.i"
-%include "./interface/SBBreakpoint.i"
-%include "./interface/SBBreakpointLocation.i"
-%include "./interface/SBBreakpointName.i"
-%include "./interface/SBBroadcaster.i"
-%include "./interface/SBCommandInterpreter.i"
-%include "./interface/SBCommandReturnObject.i"
-%include "./interface/SBCommunication.i"
-%include "./interface/SBCompileUnit.i"
-%include "./interface/SBData.i"
-%include "./interface/SBDebugger.i"
-%include "./interface/SBDeclaration.i"
-%include "./interface/SBError.i"
-%include "./interface/SBEvent.i"
-%include "./interface/SBExecutionContext.i"
-%include "./interface/SBExpressionOptions.i"
-%include "./interface/SBFileSpec.i"
-%include "./interface/SBFile.i"
-%include "./interface/SBFileSpecList.i"
-%include "./interface/SBFrame.i"
-%include "./interface/SBFunction.i"
-%include "./interface/SBHostOS.i"
-%include "./interface/SBInstruction.i"
-%include "./interface/SBInstructionList.i"
-%include "./interface/SBLanguageRuntime.i"
-%include "./interface/SBLaunchInfo.i"
-%include "./interface/SBLineEntry.i"
-%include "./interface/SBListener.i"
-%include "./interface/SBMemoryRegionInfo.i"
-%include "./interface/SBMemoryRegionInfoList.i"
-%include "./interface/SBModule.i"
-%include "./interface/SBModuleSpec.i"
-%include "./interface/SBPlatform.i"
-%include "./interface/SBProcess.i"
-%include "./interface/SBProcessInfo.i"
-%include "./interface/SBQueue.i"
-%include "./interface/SBQueueItem.i"
-%include "./interface/SBSection.i"
-%include "./interface/SBSourceManager.i"
-%include "./interface/SBStream.i"
-%include "./interface/SBStringList.i"
-%include "./interface/SBStructuredData.i"
-%include "./interface/SBSymbol.i"
-%include "./interface/SBSymbolContext.i"
-%include "./interface/SBSymbolContextList.i"
-%include "./interface/SBTarget.i"
-%include "./interface/SBThread.i"
-%include "./interface/SBThreadCollection.i"
-%include "./interface/SBThreadPlan.i"
-%include "./interface/SBTrace.i"
-%include "./interface/SBTraceOptions.i"
-%include "./interface/SBType.i"
-%include "./interface/SBTypeCategory.i"
-%include "./interface/SBTypeEnumMember.i"
-%include "./interface/SBTypeFilter.i"
-%include "./interface/SBTypeFormat.i"
-%include "./interface/SBTypeNameSpecifier.i"
-%include "./interface/SBTypeSummary.i"
-%include "./interface/SBTypeSynthetic.i"
-%include "./interface/SBValue.i"
-%include "./interface/SBValueList.i"
-%include "./interface/SBVariablesOptions.i"
-%include "./interface/SBWatchpoint.i"
-%include "./interface/SBUnixSignals.i"
-
Index: lldb/docs/CMakeLists.txt
===================================================================
--- lldb/docs/CMakeLists.txt
+++ lldb/docs/CMakeLists.txt
@@ -30,9 +30,9 @@
     # Because we don't build liblldb, epydoc will complain that the import of
     # _lldb.so failed, but that doesn't prevent it from generating the docs.
     file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lldb)
-    get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
+    get_target_property(lldb_bindings_dir swig_wrapper BINARY_DIR)
     add_custom_target(lldb-python-doc-package
-      COMMAND "${CMAKE_COMMAND}" -E copy "${lldb_scripts_dir}/lldb.py" "${CMAKE_CURRENT_BINARY_DIR}/lldb/__init__.py"
+      COMMAND "${CMAKE_COMMAND}" -E copy "${lldb_bindings_dir}/lldb.py" "${CMAKE_CURRENT_BINARY_DIR}/lldb/__init__.py"
       COMMENT "Copying lldb.py to pretend package.")
     add_dependencies(lldb-python-doc-package swig_wrapper)
 
Index: lldb/bindings/python.swig
===================================================================
--- lldb/bindings/python.swig
+++ lldb/bindings/python.swig
@@ -117,7 +117,7 @@
 
 %{
 #include "../source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h"
-#include "../scripts/Python/python-swigsafecast.swig"
+#include "../bindings/python/python-swigsafecast.swig"
 using namespace lldb_private;
 using namespace lldb_private::python;
 using namespace lldb;
Index: lldb/bindings/interfaces.swig
===================================================================
--- /dev/null
+++ lldb/bindings/interfaces.swig
@@ -0,0 +1,82 @@
+/* Various liblldb typedefs that SWIG needs to know about.  */
+#define __extension__ /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h. */
+/* The ISO C99 standard specifies that in C++ implementations limit macros such
+   as INT32_MAX should only be defined if __STDC_LIMIT_MACROS is. */
+#define __STDC_LIMIT_MACROS
+%include "stdint.i"
+
+%include "lldb/lldb-defines.h"
+%include "lldb/lldb-enumerations.h"
+%include "lldb/lldb-forward.h"
+%include "lldb/lldb-types.h"
+
+/* Forward declaration of SB classes. */
+%include "lldb/API/SBDefines.h"
+
+/* Python interface files with docstrings. */
+%include "./interfaces/SBAddress.i"
+%include "./interfaces/SBAttachInfo.i"
+%include "./interfaces/SBBlock.i"
+%include "./interfaces/SBBreakpoint.i"
+%include "./interfaces/SBBreakpointLocation.i"
+%include "./interfaces/SBBreakpointName.i"
+%include "./interfaces/SBBroadcaster.i"
+%include "./interfaces/SBCommandInterpreter.i"
+%include "./interfaces/SBCommandReturnObject.i"
+%include "./interfaces/SBCommunication.i"
+%include "./interfaces/SBCompileUnit.i"
+%include "./interfaces/SBData.i"
+%include "./interfaces/SBDebugger.i"
+%include "./interfaces/SBDeclaration.i"
+%include "./interfaces/SBError.i"
+%include "./interfaces/SBEvent.i"
+%include "./interfaces/SBExecutionContext.i"
+%include "./interfaces/SBExpressionOptions.i"
+%include "./interfaces/SBFile.i"
+%include "./interfaces/SBFileSpec.i"
+%include "./interfaces/SBFileSpecList.i"
+%include "./interfaces/SBFrame.i"
+%include "./interfaces/SBFunction.i"
+%include "./interfaces/SBHostOS.i"
+%include "./interfaces/SBInstruction.i"
+%include "./interfaces/SBInstructionList.i"
+%include "./interfaces/SBLanguageRuntime.i"
+%include "./interfaces/SBLaunchInfo.i"
+%include "./interfaces/SBLineEntry.i"
+%include "./interfaces/SBListener.i"
+%include "./interfaces/SBMemoryRegionInfo.i"
+%include "./interfaces/SBMemoryRegionInfoList.i"
+%include "./interfaces/SBModule.i"
+%include "./interfaces/SBModuleSpec.i"
+%include "./interfaces/SBPlatform.i"
+%include "./interfaces/SBProcess.i"
+%include "./interfaces/SBProcessInfo.i"
+%include "./interfaces/SBQueue.i"
+%include "./interfaces/SBQueueItem.i"
+%include "./interfaces/SBSection.i"
+%include "./interfaces/SBSourceManager.i"
+%include "./interfaces/SBStream.i"
+%include "./interfaces/SBStringList.i"
+%include "./interfaces/SBStructuredData.i"
+%include "./interfaces/SBSymbol.i"
+%include "./interfaces/SBSymbolContext.i"
+%include "./interfaces/SBSymbolContextList.i"
+%include "./interfaces/SBTarget.i"
+%include "./interfaces/SBThread.i"
+%include "./interfaces/SBThreadCollection.i"
+%include "./interfaces/SBThreadPlan.i"
+%include "./interfaces/SBTrace.i"
+%include "./interfaces/SBTraceOptions.i"
+%include "./interfaces/SBType.i"
+%include "./interfaces/SBTypeCategory.i"
+%include "./interfaces/SBTypeEnumMember.i"
+%include "./interfaces/SBTypeFilter.i"
+%include "./interfaces/SBTypeFormat.i"
+%include "./interfaces/SBTypeNameSpecifier.i"
+%include "./interfaces/SBTypeSummary.i"
+%include "./interfaces/SBTypeSynthetic.i"
+%include "./interfaces/SBUnixSignals.i"
+%include "./interfaces/SBValue.i"
+%include "./interfaces/SBValueList.i"
+%include "./interfaces/SBVariablesOptions.i"
+%include "./interfaces/SBWatchpoint.i"
Index: lldb/bindings/CMakeLists.txt
===================================================================
--- lldb/bindings/CMakeLists.txt
+++ lldb/bindings/CMakeLists.txt
@@ -1,4 +1,4 @@
-file(GLOB SWIG_INTERFACES interface/*.i)
+file(GLOB SWIG_INTERFACES interfaces/*.i)
 file(GLOB_RECURSE SWIG_SOURCES *.swig)
 file(GLOB SWIG_HEADERS
   ${LLDB_SOURCE_DIR}/include/lldb/API/*.h
@@ -46,7 +46,7 @@
         -python
         -threads
         -o ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
-        ${LLDB_SOURCE_DIR}/scripts/lldb.swig
+        ${LLDB_SOURCE_DIR}/bindings/python.swig
     VERBATIM
     COMMENT "Builds LLDB Python wrapper")
 
@@ -67,7 +67,7 @@
         -lua
         -w503
         -o ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapLua.cpp
-        ${LLDB_SOURCE_DIR}/scripts/lldb_lua.swig
+        ${LLDB_SOURCE_DIR}/bindings/lua.swig
     VERBATIM
     COMMENT "Builds LLDB Lua wrapper")
 
Index: lldb/CMakeLists.txt
===================================================================
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -56,7 +56,7 @@
 endif ()
 
 if (LLDB_ENABLE_PYTHON OR LLDB_ENABLE_LUA)
-  add_subdirectory(scripts)
+  add_subdirectory(bindings)
 endif ()
 
 # We need the headers generated by instrinsics_gen before we can compile
@@ -97,7 +97,7 @@
 endif()
 
 if (LLDB_ENABLE_PYTHON)
-  get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
+  get_target_property(lldb_bindings_dir swig_wrapper BINARY_DIR)
 
   if(LLDB_BUILD_FRAMEWORK)
     set(lldb_python_build_path "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Resources/Python/lldb")
@@ -109,7 +109,7 @@
   # to liblldb.so for the Python API(hardlink on Windows).
   add_custom_target(finish_swig ALL VERBATIM
     COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_python_build_path}
-    DEPENDS ${lldb_scripts_dir}/lldb.py
+    DEPENDS ${lldb_bindings_dir}/lldb.py
     COMMENT "Python script sym-linking LLDB Python API")
 
   if(NOT LLDB_USE_SYSTEM_SIX)
@@ -121,7 +121,7 @@
 
   add_custom_command(TARGET finish_swig POST_BUILD VERBATIM
     COMMAND ${CMAKE_COMMAND} -E copy
-      "${lldb_scripts_dir}/lldb.py"
+      "${lldb_bindings_dir}/lldb.py"
       "${lldb_python_build_path}/__init__.py")
 
   function(create_python_package pkg_dir)
@@ -131,7 +131,7 @@
     endif()
     if(NOT ARG_NOINIT)
       set(init_cmd COMMAND ${PYTHON_EXECUTABLE}
-          "${LLDB_SOURCE_DIR}/scripts/Python/createPythonInit.py"
+          "${LLDB_SOURCE_DIR}/bindings/python/createPythonInit.py"
           "${pkg_dir}" ${ARG_FILES})
     endif()
     add_custom_command(TARGET finish_swig POST_BUILD VERBATIM
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to