[Lldb-commits] [lldb] 3e70a91 - [lldb/Plugin] Use LLDB_PLUGIN_DECLARE to forward declare plugin initializers
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 7 18:04:03 PST 2020
Author: Jonas Devlieghere
Date: 2020-02-07T18:02:21-08:00
New Revision: 3e70a9196387437abb794b294d47fde37684337d
URL: https://github.com/llvm/llvm-project/commit/3e70a9196387437abb794b294d47fde37684337d
DIFF: https://github.com/llvm/llvm-project/commit/3e70a9196387437abb794b294d47fde37684337d.diff
LOG: [lldb/Plugin] Use LLDB_PLUGIN_DECLARE to forward declare plugin initializers
Apparently Linux and Windows have the exact opposite behavior when it
comes to inline declarations of external functions. On Linux they're
considered to be part of the lldb_private namespace, while on Windows
they're considered to be part of the top level namespace. Somehow on
macOS, it doesn't really matter and both are fine...
At this point I don't know what to do, so I'm just adding the
LLDB_PLUGIN_DECLARE macros again as originally proposed in D74245.
Added:
Modified:
lldb/include/lldb/Core/PluginManager.h
lldb/source/API/SystemInitializerFull.cpp
lldb/tools/lldb-test/SystemInitializerTest.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h
index 2f227fb57f15..af4507bf3496 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -23,16 +23,20 @@
#include <stdint.h>
#define LLDB_PLUGIN(PluginName) \
+ namespace lldb_private { \
void lldb_initialize_##PluginName() { PluginName::Initialize(); } \
void lldb_terminate_##PluginName() { PluginName::Terminate(); } \
+ }
// FIXME: Generate me with CMake
-#define LLDB_PLUGIN_INITIALIZE(PluginName) \
+#define LLDB_PLUGIN_DECLARE(PluginName) \
+ namespace lldb_private { \
extern void lldb_initialize_##PluginName(); \
- lldb_initialize_##PluginName()
-#define LLDB_PLUGIN_TERMINATE(PluginName) \
extern void lldb_terminate_##PluginName(); \
- lldb_terminate_##PluginName()
+ }
+
+#define LLDB_PLUGIN_INITIALIZE(PluginName) lldb_initialize_##PluginName()
+#define LLDB_PLUGIN_TERMINATE(PluginName) lldb_terminate_##PluginName()
namespace lldb_private {
class CommandInterpreter;
diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp
index 70a2588d52bc..b14a9a2ccd28 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -24,6 +24,99 @@
#include <string>
+LLDB_PLUGIN_DECLARE(ABIMacOSX_arm64);
+LLDB_PLUGIN_DECLARE(ABISysV_arm64);
+LLDB_PLUGIN_DECLARE(ABIMacOSX_arm);
+LLDB_PLUGIN_DECLARE(ABISysV_arm);
+LLDB_PLUGIN_DECLARE(ABISysV_arc);
+LLDB_PLUGIN_DECLARE(ABISysV_hexagon);
+LLDB_PLUGIN_DECLARE(ABISysV_mips);
+LLDB_PLUGIN_DECLARE(ABISysV_mips64);
+LLDB_PLUGIN_DECLARE(ABISysV_ppc);
+LLDB_PLUGIN_DECLARE(ABISysV_ppc64);
+LLDB_PLUGIN_DECLARE(ABISysV_s390x);
+LLDB_PLUGIN_DECLARE(ABIMacOSX_i386);
+LLDB_PLUGIN_DECLARE(ABISysV_i386);
+LLDB_PLUGIN_DECLARE(ABISysV_x86_64);
+LLDB_PLUGIN_DECLARE(ABIWindows_x86_64);
+LLDB_PLUGIN_DECLARE(ObjectFileBreakpad);
+LLDB_PLUGIN_DECLARE(ObjectFileELF);
+LLDB_PLUGIN_DECLARE(ObjectFileMachO);
+LLDB_PLUGIN_DECLARE(ObjectFilePECOFF);
+LLDB_PLUGIN_DECLARE(ObjectFileWasm);
+LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive);
+LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO);
+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(PlatformRemoteiOS);
+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(UnwindAssembly_x86);
+LLDB_PLUGIN_DECLARE(EmulateInstructionARM);
+LLDB_PLUGIN_DECLARE(EmulateInstructionARM64);
+LLDB_PLUGIN_DECLARE(EmulateInstructionMIPS);
+LLDB_PLUGIN_DECLARE(EmulateInstructionMIPS64);
+LLDB_PLUGIN_DECLARE(EmulateInstructionPPC64);
+LLDB_PLUGIN_DECLARE(SymbolFileDWARFDebugMap);
+LLDB_PLUGIN_DECLARE(ItaniumABILanguageRuntime);
+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(ProcessWindows);
+#endif
+#if defined(__FreeBSD__)
+LLDB_PLUGIN_DECLARE(ProcessFreeBSD);
+#endif
+#if defined(__APPLE__)
+LLDB_PLUGIN_DECLARE(SymbolVendorMacOSX);
+LLDB_PLUGIN_DECLARE(ProcessKDP);
+LLDB_PLUGIN_DECLARE(DynamicLoaderDarwinKernel);
+#endif
+LLDB_PLUGIN_DECLARE(StructuredDataDarwinLog);
+LLDB_PLUGIN_DECLARE(PlatformRemoteGDBServer);
+LLDB_PLUGIN_DECLARE(ProcessGDBRemote);
+LLDB_PLUGIN_DECLARE(DynamicLoaderMacOSXDYLD);
+LLDB_PLUGIN_DECLARE(DynamicLoaderMacOS);
+LLDB_PLUGIN_DECLARE(DynamicLoaderPOSIXDYLD);
+LLDB_PLUGIN_DECLARE(DynamicLoaderStatic);
+LLDB_PLUGIN_DECLARE(DynamicLoaderWindowsDYLD);
+
using namespace lldb_private;
SystemInitializerFull::SystemInitializerFull() {}
diff --git a/lldb/tools/lldb-test/SystemInitializerTest.cpp b/lldb/tools/lldb-test/SystemInitializerTest.cpp
index 9230cac257b5..3d8c80db5500 100644
--- a/lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ b/lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -17,6 +17,92 @@
#include <string>
+LLDB_PLUGIN_DECLARE(ABIMacOSX_arm64);
+LLDB_PLUGIN_DECLARE(ABISysV_arm64);
+LLDB_PLUGIN_DECLARE(ABIMacOSX_arm);
+LLDB_PLUGIN_DECLARE(ABISysV_arm);
+LLDB_PLUGIN_DECLARE(ABISysV_arc);
+LLDB_PLUGIN_DECLARE(ABISysV_hexagon);
+LLDB_PLUGIN_DECLARE(ABISysV_mips);
+LLDB_PLUGIN_DECLARE(ABISysV_mips64);
+LLDB_PLUGIN_DECLARE(ABISysV_ppc);
+LLDB_PLUGIN_DECLARE(ABISysV_ppc64);
+LLDB_PLUGIN_DECLARE(ABISysV_s390x);
+LLDB_PLUGIN_DECLARE(ABIMacOSX_i386);
+LLDB_PLUGIN_DECLARE(ABISysV_i386);
+LLDB_PLUGIN_DECLARE(ABISysV_x86_64);
+LLDB_PLUGIN_DECLARE(ABIWindows_x86_64);
+LLDB_PLUGIN_DECLARE(ObjectFileBreakpad);
+LLDB_PLUGIN_DECLARE(ObjectFileELF);
+LLDB_PLUGIN_DECLARE(ObjectFileMachO);
+LLDB_PLUGIN_DECLARE(ObjectFilePECOFF);
+LLDB_PLUGIN_DECLARE(ObjectFileWasm);
+LLDB_PLUGIN_DECLARE(ObjectContainerBSDArchive);
+LLDB_PLUGIN_DECLARE(ObjectContainerUniversalMachO);
+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(PlatformRemoteiOS);
+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(UnwindAssembly_x86);
+LLDB_PLUGIN_DECLARE(EmulateInstructionARM);
+LLDB_PLUGIN_DECLARE(EmulateInstructionARM64);
+LLDB_PLUGIN_DECLARE(EmulateInstructionMIPS);
+LLDB_PLUGIN_DECLARE(EmulateInstructionMIPS64);
+LLDB_PLUGIN_DECLARE(EmulateInstructionPPC64);
+LLDB_PLUGIN_DECLARE(SymbolFileDWARFDebugMap);
+LLDB_PLUGIN_DECLARE(ItaniumABILanguageRuntime);
+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(ProcessWindows);
+#endif
+#if defined(__FreeBSD__)
+LLDB_PLUGIN_DECLARE(ProcessFreeBSD);
+#endif
+#if defined(__APPLE__)
+LLDB_PLUGIN_DECLARE(SymbolVendorMacOSX);
+LLDB_PLUGIN_DECLARE(ProcessKDP);
+LLDB_PLUGIN_DECLARE(DynamicLoaderDarwinKernel);
+#endif
+LLDB_PLUGIN_DECLARE(StructuredDataDarwinLog);
+LLDB_PLUGIN_DECLARE(PlatformRemoteGDBServer);
+LLDB_PLUGIN_DECLARE(ProcessGDBRemote);
+LLDB_PLUGIN_DECLARE(DynamicLoaderMacOSXDYLD);
+LLDB_PLUGIN_DECLARE(DynamicLoaderMacOS);
+LLDB_PLUGIN_DECLARE(DynamicLoaderPOSIXDYLD);
+LLDB_PLUGIN_DECLARE(DynamicLoaderStatic);
+LLDB_PLUGIN_DECLARE(DynamicLoaderWindowsDYLD);
+
using namespace lldb_private;
SystemInitializerTest::SystemInitializerTest() {}
More information about the lldb-commits
mailing list