[Lldb-commits] [lldb] 2d146aa - [lldb/Plugin] Generate LLDB_PLUGIN_DECLARE with CMake

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 18 11:30:10 PST 2020


Author: Jonas Devlieghere
Date: 2020-02-18T11:29:56-08:00
New Revision: 2d146aa2a2cdef330877b511b54886823e71f92c

URL: https://github.com/llvm/llvm-project/commit/2d146aa2a2cdef330877b511b54886823e71f92c
DIFF: https://github.com/llvm/llvm-project/commit/2d146aa2a2cdef330877b511b54886823e71f92c.diff

LOG: [lldb/Plugin] Generate LLDB_PLUGIN_DECLARE with CMake

Generate the LLDB_PLUGIN_DECLARE macros with CMake and a def file. I'm
landing D73067 in pieces so I can bisect what exactly is breaking the
Windows bot.

Added: 
    lldb/source/Plugins/Plugins.def.in

Modified: 
    lldb/source/API/SystemInitializerFull.cpp
    lldb/source/Plugins/CMakeLists.txt
    lldb/tools/lldb-test/CMakeLists.txt
    lldb/tools/lldb-test/SystemInitializerTest.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp
index 21a00cb8c79e..0613cd5a9e1f 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -24,91 +24,8 @@
 
 #include <string>
 
-LLDB_PLUGIN_DECLARE(ABIAArch64)
-LLDB_PLUGIN_DECLARE(ABIARM)
-LLDB_PLUGIN_DECLARE(ABIARC)
-LLDB_PLUGIN_DECLARE(ABIHexagon)
-LLDB_PLUGIN_DECLARE(ABIMips)
-LLDB_PLUGIN_DECLARE(ABIPowerPC)
-LLDB_PLUGIN_DECLARE(ABISystemZ)
-LLDB_PLUGIN_DECLARE(ABIX86)
-LLDB_PLUGIN_DECLARE(ObjectFileBreakpad)
-LLDB_PLUGIN_DECLARE(ObjectFileELF)
-LLDB_PLUGIN_DECLARE(ObjectFileJIT)
-LLDB_PLUGIN_DECLARE(ObjectFileMachO)
-LLDB_PLUGIN_DECLARE(ObjectFilePECOFF)
-LLDB_PLUGIN_DECLARE(ObjectFileWasm)
-LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive)
-LLDB_PLUGIN_DECLARE(ObjectContainerMachOArchive)
-LLDB_PLUGIN_DECLARE(ScriptInterpreterNone)
-#if LLDB_ENABLE_PYTHON
-LLDB_PLUGIN_DECLARE(OperatingSystemPython)
-LLDB_PLUGIN_DECLARE(ScriptInterpreterPython)
-#endif
-#if LLDB_ENABLE_LUA
-LLDB_PLUGIN_DECLARE(ScriptInterpreterLua)
-#endif
-LLDB_PLUGIN_DECLARE(PlatformFreeBSD)
-LLDB_PLUGIN_DECLARE(PlatformLinux)
-LLDB_PLUGIN_DECLARE(PlatformNetBSD)
-LLDB_PLUGIN_DECLARE(PlatformOpenBSD)
-LLDB_PLUGIN_DECLARE(PlatformWindows)
-LLDB_PLUGIN_DECLARE(PlatformAndroid)
-LLDB_PLUGIN_DECLARE(PlatformMacOSX)
-LLDB_PLUGIN_DECLARE(TypeSystemClang)
-LLDB_PLUGIN_DECLARE(ArchitectureArm)
-LLDB_PLUGIN_DECLARE(ArchitectureMips)
-LLDB_PLUGIN_DECLARE(ArchitecturePPC64)
-LLDB_PLUGIN_DECLARE(DisassemblerLLVMC)
-LLDB_PLUGIN_DECLARE(JITLoaderGDB)
-LLDB_PLUGIN_DECLARE(ProcessElfCore)
-LLDB_PLUGIN_DECLARE(ProcessMachCore)
-LLDB_PLUGIN_DECLARE(ProcessMinidump)
-LLDB_PLUGIN_DECLARE(MemoryHistoryASan)
-LLDB_PLUGIN_DECLARE(InstrumentationRuntimeASan)
-LLDB_PLUGIN_DECLARE(InstrumentationRuntimeTSan)
-LLDB_PLUGIN_DECLARE(InstrumentationRuntimeUBSan)
-LLDB_PLUGIN_DECLARE(InstrumentationRuntimeMainThreadChecker)
-LLDB_PLUGIN_DECLARE(SymbolVendorELF)
-LLDB_PLUGIN_DECLARE(SymbolFileBreakpad)
-LLDB_PLUGIN_DECLARE(SymbolFileDWARF)
-LLDB_PLUGIN_DECLARE(SymbolFilePDB)
-LLDB_PLUGIN_DECLARE(SymbolFileSymtab)
-LLDB_PLUGIN_DECLARE(SymbolVendorWasm)
-LLDB_PLUGIN_DECLARE(UnwindAssemblyInstEmulation)
-LLDB_PLUGIN_DECLARE(UnwindAssemblyX86)
-LLDB_PLUGIN_DECLARE(InstructionARM)
-LLDB_PLUGIN_DECLARE(InstructionARM64)
-LLDB_PLUGIN_DECLARE(InstructionMIPS)
-LLDB_PLUGIN_DECLARE(InstructionMIPS64)
-LLDB_PLUGIN_DECLARE(InstructionPPC64)
-LLDB_PLUGIN_DECLARE(CXXItaniumABI)
-LLDB_PLUGIN_DECLARE(AppleObjCRuntime)
-LLDB_PLUGIN_DECLARE(SystemRuntimeMacOSX)
-LLDB_PLUGIN_DECLARE(RenderScriptRuntime)
-LLDB_PLUGIN_DECLARE(CPlusPlusLanguage)
-LLDB_PLUGIN_DECLARE(ObjCLanguage)
-LLDB_PLUGIN_DECLARE(ObjCPlusPlusLanguage)
-#if defined(_WIN32)
-LLDB_PLUGIN_DECLARE(ProcessWindowsCommon)
-#endif
-#if defined(__FreeBSD__)
-LLDB_PLUGIN_DECLARE(ProcessFreeBSD)
-#endif
-#if defined(__APPLE__)
-LLDB_PLUGIN_DECLARE(SymbolVendorMacOSX)
-LLDB_PLUGIN_DECLARE(ProcessMacOSXKernel)
-#endif
-LLDB_PLUGIN_DECLARE(StructuredDataDarwinLog)
-LLDB_PLUGIN_DECLARE(PlatformGDB)
-LLDB_PLUGIN_DECLARE(ProcessGDBRemote)
-LLDB_PLUGIN_DECLARE(DynamicLoaderDarwinKernel)
-LLDB_PLUGIN_DECLARE(DynamicLoaderHexagonDYLD)
-LLDB_PLUGIN_DECLARE(DynamicLoaderMacOSXDYLD)
-LLDB_PLUGIN_DECLARE(DynamicLoaderPosixDYLD)
-LLDB_PLUGIN_DECLARE(DynamicLoaderStatic)
-LLDB_PLUGIN_DECLARE(DynamicLoaderWasmDYLD)
-LLDB_PLUGIN_DECLARE(DynamicLoaderWindowsDYLD)
+#define LLDB_PLUGIN(p) LLDB_PLUGIN_DECLARE(p)
+#include "Plugins/Plugins.def"
 
 using namespace lldb_private;
 

diff  --git a/lldb/source/Plugins/CMakeLists.txt b/lldb/source/Plugins/CMakeLists.txt
index 08817baec14c..24fb85811797 100644
--- a/lldb/source/Plugins/CMakeLists.txt
+++ b/lldb/source/Plugins/CMakeLists.txt
@@ -21,3 +21,25 @@ add_subdirectory(SystemRuntime)
 add_subdirectory(SymbolVendor)
 add_subdirectory(TypeSystem)
 add_subdirectory(UnwindAssembly)
+
+set(LLDB_STRIPPED_PLUGINS)
+get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
+
+set(LLDB_ENUM_PLUGINS "")
+
+foreach(p ${LLDB_ALL_PLUGINS})
+  # Strip lldbPlugin form the plugin name.
+  string(SUBSTRING ${p} 10 -1 pStripped)
+  if(${pStripped} MATCHES "^ScriptInterpreter*")
+    set(LLDB_ENUM_PLUGINS "${LLDB_ENUM_PLUGINS}LLDB_SCRIPT_PLUGIN(${pStripped})\n")
+  else()
+    set(LLDB_ENUM_PLUGINS "${LLDB_ENUM_PLUGINS}LLDB_PLUGIN(${pStripped})\n")
+  endif()
+endforeach(p)
+
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/Plugins.def.in
+  ${CMAKE_CURRENT_BINARY_DIR}/Plugins.def
+  )
+
+set_property(GLOBAL PROPERTY LLDB_PLUGINS_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR})

diff  --git a/lldb/source/Plugins/Plugins.def.in b/lldb/source/Plugins/Plugins.def.in
new file mode 100644
index 000000000000..926ab6d024a7
--- /dev/null
+++ b/lldb/source/Plugins/Plugins.def.in
@@ -0,0 +1,35 @@
+/*===- lldb/source/Plugin/Plugins.def ---------------------------*- C++ -*-===*\
+|*                                                                            *|
+|* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
+|* Exceptions.                                                                *|
+|* See https://llvm.org/LICENSE.txt for license information.                  *|
+|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
+|*                                                                            *|
+|*===----------------------------------------------------------------------===*|
+|*                                                                            *|
+|* This file enumerates all of the plugins supported by this build of LLDB.   *|
+|* Clients of this file should define the LLDB_PLUGIN macro to be a           *|
+|* function-like macro with a single parameter (the name of the plugin)       *|
+|* including this file will then enumerate all of the plugins. Script         *|
+|* interpreter plugins can be enumerated separately by defining               *|
+|* LLDB_SCRIPT_PLUGIN in which case they are not part of LLDB_PLUGIN.         *|
+|*                                                                            *|
+|*                                                                            *|
+|* The set of plugins supported by LLDB is generated at configuration         *|
+|* time, at which point this header is generated. Do not modify this          *|
+|* header directly.                                                           *|
+|*                                                                            *|
+\*===----------------------------------------------------------------------===*/
+
+#ifndef LLDB_PLUGIN
+#  error Please define the macro LLDB_PLUGIN(PluginName)
+#endif
+
+#ifndef LLDB_SCRIPT_PLUGIN
+#define LLDB_SCRIPT_PLUGIN(p) LLDB_PLUGIN(p)
+#endif
+
+ at LLDB_ENUM_PLUGINS@
+
+#undef LLDB_PLUGIN
+#undef LLDB_SCRIPT_PLUGIN

diff  --git a/lldb/tools/lldb-test/CMakeLists.txt b/lldb/tools/lldb-test/CMakeLists.txt
index 2ab1ceacdcd1..f3530fd7b859 100644
--- a/lldb/tools/lldb-test/CMakeLists.txt
+++ b/lldb/tools/lldb-test/CMakeLists.txt
@@ -23,5 +23,6 @@ add_lldb_tool(lldb-test
   LINK_COMPONENTS
     Support
   )
-  
-include_directories(${LLDB_SOURCE_DIR}/source)
+
+target_include_directories(lldb-test PRIVATE ${LLDB_SOURCE_DIR}/source)
+target_include_directories(lldb-test PRIVATE ${LLDB_BINARY_DIR}/source)

diff  --git a/lldb/tools/lldb-test/SystemInitializerTest.cpp b/lldb/tools/lldb-test/SystemInitializerTest.cpp
index 1a3bf612674d..020533554602 100644
--- a/lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ b/lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -17,84 +17,8 @@
 
 #include <string>
 
-LLDB_PLUGIN_DECLARE(ABIAArch64)
-LLDB_PLUGIN_DECLARE(ABIARM)
-LLDB_PLUGIN_DECLARE(ABIARC)
-LLDB_PLUGIN_DECLARE(ABIHexagon)
-LLDB_PLUGIN_DECLARE(ABIMips)
-LLDB_PLUGIN_DECLARE(ABIPowerPC)
-LLDB_PLUGIN_DECLARE(ABISystemZ)
-LLDB_PLUGIN_DECLARE(ABIX86)
-LLDB_PLUGIN_DECLARE(ObjectFileBreakpad)
-LLDB_PLUGIN_DECLARE(ObjectFileELF)
-LLDB_PLUGIN_DECLARE(ObjectFileJIT)
-LLDB_PLUGIN_DECLARE(ObjectFileMachO)
-LLDB_PLUGIN_DECLARE(ObjectFilePECOFF)
-LLDB_PLUGIN_DECLARE(ObjectFileWasm)
-LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive)
-LLDB_PLUGIN_DECLARE(ObjectContainerMachOArchive)
-LLDB_PLUGIN_DECLARE(ScriptInterpreterNone)
-LLDB_PLUGIN_DECLARE(PlatformFreeBSD)
-LLDB_PLUGIN_DECLARE(PlatformLinux)
-LLDB_PLUGIN_DECLARE(PlatformNetBSD)
-LLDB_PLUGIN_DECLARE(PlatformOpenBSD)
-LLDB_PLUGIN_DECLARE(PlatformWindows)
-LLDB_PLUGIN_DECLARE(PlatformAndroid)
-LLDB_PLUGIN_DECLARE(PlatformMacOSX)
-LLDB_PLUGIN_DECLARE(TypeSystemClang)
-LLDB_PLUGIN_DECLARE(ArchitectureArm)
-LLDB_PLUGIN_DECLARE(ArchitectureMips)
-LLDB_PLUGIN_DECLARE(ArchitecturePPC64)
-LLDB_PLUGIN_DECLARE(DisassemblerLLVMC)
-LLDB_PLUGIN_DECLARE(JITLoaderGDB)
-LLDB_PLUGIN_DECLARE(ProcessElfCore)
-LLDB_PLUGIN_DECLARE(ProcessMachCore)
-LLDB_PLUGIN_DECLARE(ProcessMinidump)
-LLDB_PLUGIN_DECLARE(MemoryHistoryASan)
-LLDB_PLUGIN_DECLARE(InstrumentationRuntimeASan)
-LLDB_PLUGIN_DECLARE(InstrumentationRuntimeTSan)
-LLDB_PLUGIN_DECLARE(InstrumentationRuntimeUBSan)
-LLDB_PLUGIN_DECLARE(InstrumentationRuntimeMainThreadChecker)
-LLDB_PLUGIN_DECLARE(SymbolVendorELF)
-LLDB_PLUGIN_DECLARE(SymbolFileBreakpad)
-LLDB_PLUGIN_DECLARE(SymbolFileDWARF)
-LLDB_PLUGIN_DECLARE(SymbolFilePDB)
-LLDB_PLUGIN_DECLARE(SymbolFileSymtab)
-LLDB_PLUGIN_DECLARE(SymbolVendorWasm)
-LLDB_PLUGIN_DECLARE(UnwindAssemblyInstEmulation)
-LLDB_PLUGIN_DECLARE(UnwindAssemblyX86)
-LLDB_PLUGIN_DECLARE(InstructionARM)
-LLDB_PLUGIN_DECLARE(InstructionARM64)
-LLDB_PLUGIN_DECLARE(InstructionMIPS)
-LLDB_PLUGIN_DECLARE(InstructionMIPS64)
-LLDB_PLUGIN_DECLARE(InstructionPPC64)
-LLDB_PLUGIN_DECLARE(CXXItaniumABI)
-LLDB_PLUGIN_DECLARE(AppleObjCRuntime)
-LLDB_PLUGIN_DECLARE(SystemRuntimeMacOSX)
-LLDB_PLUGIN_DECLARE(RenderScriptRuntime)
-LLDB_PLUGIN_DECLARE(CPlusPlusLanguage)
-LLDB_PLUGIN_DECLARE(ObjCLanguage)
-LLDB_PLUGIN_DECLARE(ObjCPlusPlusLanguage)
-#if defined(_WIN32)
-LLDB_PLUGIN_DECLARE(ProcessWindowsCommon)
-#endif
-#if defined(__FreeBSD__)
-LLDB_PLUGIN_DECLARE(ProcessFreeBSD)
-#endif
-#if defined(__APPLE__)
-LLDB_PLUGIN_DECLARE(SymbolVendorMacOSX)
-LLDB_PLUGIN_DECLARE(ProcessMacOSXKernel)
-#endif
-LLDB_PLUGIN_DECLARE(StructuredDataDarwinLog)
-LLDB_PLUGIN_DECLARE(PlatformGDB)
-LLDB_PLUGIN_DECLARE(ProcessGDBRemote)
-LLDB_PLUGIN_DECLARE(DynamicLoaderDarwinKernel)
-LLDB_PLUGIN_DECLARE(DynamicLoaderHexagonDYLD)
-LLDB_PLUGIN_DECLARE(DynamicLoaderMacOSXDYLD)
-LLDB_PLUGIN_DECLARE(DynamicLoaderPosixDYLD)
-LLDB_PLUGIN_DECLARE(DynamicLoaderStatic)
-LLDB_PLUGIN_DECLARE(DynamicLoaderWasmDYLD)
-LLDB_PLUGIN_DECLARE(DynamicLoaderWindowsDYLD)
+#define LLDB_PLUGIN(p) LLDB_PLUGIN_DECLARE(p)
+#include "Plugins/Plugins.def"
 
 using namespace lldb_private;
 


        


More information about the lldb-commits mailing list