[lldb/Plugins] Have one initializer per ABI plugin
authorJonas Devlieghere <jonas@devlieghere.com>
Fri, 14 Feb 2020 05:49:12 +0000 (21:49 -0800)
committerJonas Devlieghere <jonas@devlieghere.com>
Fri, 14 Feb 2020 05:49:38 +0000 (21:49 -0800)
After the recent change that grouped some of the ABI plugins together,
those plugins ended up with multiple initializers per plugin. This is
incompatible with my proposed approach of generating the initializers
dynamically, which is why I've grouped them together in a new entry
point.

Differential revision: https://reviews.llvm.org/D74451

19 files changed:
lldb/source/API/SystemInitializerFull.cpp
lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp [new file with mode: 0644]
lldb/source/Plugins/ABI/AArch64/ABIAArch64.h [new file with mode: 0644]
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
lldb/source/Plugins/ABI/AArch64/CMakeLists.txt
lldb/source/Plugins/ABI/ARM/ABIARM.cpp [new file with mode: 0644]
lldb/source/Plugins/ABI/ARM/ABIARM.h [new file with mode: 0644]
lldb/source/Plugins/ABI/ARM/CMakeLists.txt
lldb/source/Plugins/ABI/Mips/ABIMips.cpp [new file with mode: 0644]
lldb/source/Plugins/ABI/Mips/ABIMips.h [new file with mode: 0644]
lldb/source/Plugins/ABI/Mips/CMakeLists.txt
lldb/source/Plugins/ABI/PowerPC/ABIPowerPC.cpp [new file with mode: 0644]
lldb/source/Plugins/ABI/PowerPC/ABIPowerPC.h [new file with mode: 0644]
lldb/source/Plugins/ABI/PowerPC/CMakeLists.txt
lldb/source/Plugins/ABI/X86/ABIX86.cpp [new file with mode: 0644]
lldb/source/Plugins/ABI/X86/ABIX86.h [new file with mode: 0644]
lldb/source/Plugins/ABI/X86/CMakeLists.txt
lldb/tools/lldb-test/SystemInitializerTest.cpp

index 888a757..7e2d80f 100644 (file)
 
 #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(ABIAArch64);
+LLDB_PLUGIN_DECLARE(ABIARM);
+LLDB_PLUGIN_DECLARE(ABISysV_arc);
+LLDB_PLUGIN_DECLARE(ABISysV_hexagon);
+LLDB_PLUGIN_DECLARE(ABIMips);
+LLDB_PLUGIN_DECLARE(ABIPowerPC);
+LLDB_PLUGIN_DECLARE(ABISysV_s390x);
+LLDB_PLUGIN_DECLARE(ABIX86);
+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)
@@ -120,26 +113,14 @@ SystemInitializerFull::SystemInitializerFull() {}
 
 SystemInitializerFull::~SystemInitializerFull() {}
 
-#define LLDB_PROCESS_AArch64(op)                                               \
-  op(ABIMacOSX_arm64);                                                         \
-  op(ABISysV_arm64);
-#define LLDB_PROCESS_ARM(op)                                                   \
-  op(ABIMacOSX_arm);                                                           \
-  op(ABISysV_arm);
+#define LLDB_PROCESS_AArch64(op) op(ABIAArch64);
+#define LLDB_PROCESS_ARM(op) op(ABIARM);
 #define LLDB_PROCESS_ARC(op) op(ABISysV_arc);
 #define LLDB_PROCESS_Hexagon(op) op(ABISysV_hexagon);
-#define LLDB_PROCESS_Mips(op)                                                  \
-  op(ABISysV_mips);                                                            \
-  op(ABISysV_mips64);
-#define LLDB_PROCESS_PowerPC(op)                                               \
-  op(ABISysV_ppc);                                                             \
-  op(ABISysV_ppc64);
+#define LLDB_PROCESS_Mips(op) op(ABIMips);
+#define LLDB_PROCESS_PowerPC(op) op(ABIPowerPC);
 #define LLDB_PROCESS_SystemZ(op) op(ABISysV_s390x);
-#define LLDB_PROCESS_X86(op)                                                   \
-  op(ABIMacOSX_i386);                                                          \
-  op(ABISysV_i386);                                                            \
-  op(ABISysV_x86_64);                                                          \
-  op(ABIWindows_x86_64);
+#define LLDB_PROCESS_X86(op) op(ABIX86);
 
 #define LLDB_PROCESS_AMDGPU(op)
 #define LLDB_PROCESS_AVR(op)
diff --git a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
new file mode 100644 (file)
index 0000000..f37bc1d
--- /dev/null
@@ -0,0 +1,24 @@
+//===-- AArch64.h ---------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "ABIAArch64.h"
+#include "ABIMacOSX_arm64.h"
+#include "ABISysV_arm64.h"
+#include "lldb/Core/PluginManager.h"
+
+LLDB_PLUGIN(ABIAArch64)
+
+void ABIAArch64::Initialize() {
+  ABISysV_arm64::Initialize();
+  ABIMacOSX_arm64::Initialize();
+}
+
+void ABIAArch64::Terminate() {
+  ABISysV_arm64::Terminate();
+  ABIMacOSX_arm64::Terminate();
+}
diff --git a/lldb/source/Plugins/ABI/AArch64/ABIAArch64.h b/lldb/source/Plugins/ABI/AArch64/ABIAArch64.h
new file mode 100644 (file)
index 0000000..90919be
--- /dev/null
@@ -0,0 +1,17 @@
+//===-- AArch64.h -----------------------------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ABIAArch64_h_
+#define liblldb_ABIAArch64_h_
+
+class ABIAArch64 {
+public:
+  static void Initialize();
+  static void Terminate();
+};
+#endif
index ee38516..94f7c2a 100644 (file)
@@ -33,8 +33,6 @@
 using namespace lldb;
 using namespace lldb_private;
 
-LLDB_PLUGIN(ABIMacOSX_arm64)
-
 static const char *pluginDesc = "Mac OS X ABI for arm64 targets";
 
 static RegisterInfo g_register_infos[] = {
index 606ccbb..96488c1 100644 (file)
@@ -33,8 +33,6 @@
 using namespace lldb;
 using namespace lldb_private;
 
-LLDB_PLUGIN(ABISysV_arm64)
-
 static RegisterInfo g_register_infos[] = {
     //  NAME       ALT       SZ OFF ENCODING          FORMAT
     //  EH_FRAME             DWARF                  GENERIC
index b58a487..40db86f 100644 (file)
@@ -1,4 +1,5 @@
 add_lldb_library(lldbPluginABIAArch64 PLUGIN
+  ABIAArch64.cpp
   ABIMacOSX_arm64.cpp
   ABISysV_arm64.cpp
 
diff --git a/lldb/source/Plugins/ABI/ARM/ABIARM.cpp b/lldb/source/Plugins/ABI/ARM/ABIARM.cpp
new file mode 100644 (file)
index 0000000..790cb87
--- /dev/null
@@ -0,0 +1,24 @@
+//===-- ARM.h -------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "ABIARM.h"
+#include "ABIMacOSX_arm.h"
+#include "ABISysV_arm.h"
+#include "lldb/Core/PluginManager.h"
+
+LLDB_PLUGIN(ABIARM)
+
+void ABIARM::Initialize() {
+  ABISysV_arm::Initialize();
+  ABIMacOSX_arm::Initialize();
+}
+
+void ABIARM::Terminate() {
+  ABISysV_arm::Terminate();
+  ABIMacOSX_arm::Terminate();
+}
diff --git a/lldb/source/Plugins/ABI/ARM/ABIARM.h b/lldb/source/Plugins/ABI/ARM/ABIARM.h
new file mode 100644 (file)
index 0000000..3ebc7b6
--- /dev/null
@@ -0,0 +1,17 @@
+//===-- ARM.h -------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ABIARM_h_
+#define liblldb_ABIARM_h_
+
+class ABIARM {
+public:
+  static void Initialize();
+  static void Terminate();
+};
+#endif
index 87c74b6..0082296 100644 (file)
@@ -1,4 +1,5 @@
 add_lldb_library(lldbPluginABIARM PLUGIN
+  ABIARM.cpp
   ABIMacOSX_arm.cpp
   ABISysV_arm.cpp
 
diff --git a/lldb/source/Plugins/ABI/Mips/ABIMips.cpp b/lldb/source/Plugins/ABI/Mips/ABIMips.cpp
new file mode 100644 (file)
index 0000000..08e694a
--- /dev/null
@@ -0,0 +1,24 @@
+//===-- Mips.h ------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "ABIMips.h"
+#include "ABISysV_mips.h"
+#include "ABISysV_mips64.h"
+#include "lldb/Core/PluginManager.h"
+
+LLDB_PLUGIN(ABIMips)
+
+void ABIMips::Initialize() {
+  ABISysV_mips::Initialize();
+  ABISysV_mips64::Initialize();
+}
+
+void ABIMips::Terminate() {
+  ABISysV_mips::Terminate();
+  ABISysV_mips64::Terminate();
+}
diff --git a/lldb/source/Plugins/ABI/Mips/ABIMips.h b/lldb/source/Plugins/ABI/Mips/ABIMips.h
new file mode 100644 (file)
index 0000000..92cd713
--- /dev/null
@@ -0,0 +1,17 @@
+//===-- Mips.h -----------------------------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ABIMips_h_
+#define liblldb_ABIMips_h_
+
+class ABIMips {
+public:
+  static void Initialize();
+  static void Terminate();
+};
+#endif
index 7636cee..9c3b18a 100644 (file)
@@ -1,4 +1,5 @@
 add_lldb_library(lldbPluginABIMips PLUGIN
+  ABIMips.cpp
   ABISysV_mips.cpp
   ABISysV_mips64.cpp
 
diff --git a/lldb/source/Plugins/ABI/PowerPC/ABIPowerPC.cpp b/lldb/source/Plugins/ABI/PowerPC/ABIPowerPC.cpp
new file mode 100644 (file)
index 0000000..b1591db
--- /dev/null
@@ -0,0 +1,24 @@
+//===-- PowerPC.h ---------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "ABIPowerPC.h"
+#include "ABISysV_ppc.h"
+#include "ABISysV_ppc64.h"
+#include "lldb/Core/PluginManager.h"
+
+LLDB_PLUGIN(ABIPowerPC)
+
+void ABIPowerPC::Initialize() {
+  ABISysV_ppc::Initialize();
+  ABISysV_ppc64::Initialize();
+}
+
+void ABIPowerPC::Terminate() {
+  ABISysV_ppc::Terminate();
+  ABISysV_ppc64::Terminate();
+}
diff --git a/lldb/source/Plugins/ABI/PowerPC/ABIPowerPC.h b/lldb/source/Plugins/ABI/PowerPC/ABIPowerPC.h
new file mode 100644 (file)
index 0000000..becbdcd
--- /dev/null
@@ -0,0 +1,17 @@
+//===-- PowerPC.h -----------------------------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ABIPowerPC_h_
+#define liblldb_ABIPowerPC_h_
+
+class ABIPowerPC {
+public:
+  static void Initialize();
+  static void Terminate();
+};
+#endif
index 53c663f..57d8e59 100644 (file)
@@ -1,4 +1,5 @@
 add_lldb_library(lldbPluginABIPowerPC PLUGIN
+  ABIPowerPC.cpp
   ABISysV_ppc.cpp
   ABISysV_ppc64.cpp
 
diff --git a/lldb/source/Plugins/ABI/X86/ABIX86.cpp b/lldb/source/Plugins/ABI/X86/ABIX86.cpp
new file mode 100644 (file)
index 0000000..207d0b2
--- /dev/null
@@ -0,0 +1,30 @@
+//===-- X86.h -------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "ABIX86.h"
+#include "ABIMacOSX_i386.h"
+#include "ABISysV_i386.h"
+#include "ABISysV_x86_64.h"
+#include "ABIWindows_x86_64.h"
+#include "lldb/Core/PluginManager.h"
+
+LLDB_PLUGIN(ABIX86)
+
+void ABIX86::Initialize() {
+  ABIMacOSX_i386::Initialize();
+  ABISysV_i386::Initialize();
+  ABISysV_x86_64::Initialize();
+  ABIWindows_x86_64::Initialize();
+}
+
+void ABIX86::Terminate() {
+  ABIMacOSX_i386::Terminate();
+  ABISysV_i386::Terminate();
+  ABISysV_x86_64::Terminate();
+  ABIWindows_x86_64::Terminate();
+}
diff --git a/lldb/source/Plugins/ABI/X86/ABIX86.h b/lldb/source/Plugins/ABI/X86/ABIX86.h
new file mode 100644 (file)
index 0000000..f99bb0c
--- /dev/null
@@ -0,0 +1,17 @@
+//===-- X86.h ---------------------------------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_ABIX86_h_
+#define liblldb_ABIX86_h_
+
+class ABIX86 {
+public:
+  static void Initialize();
+  static void Terminate();
+};
+#endif
index 757abbb..ec8ed62 100644 (file)
@@ -1,4 +1,5 @@
 add_lldb_library(lldbPluginABIX86 PLUGIN
+  ABIX86.cpp
   ABIMacOSX_i386.cpp
   ABISysV_i386.cpp
   ABISysV_x86_64.cpp
index 3e82b8c..92b4a46 100644 (file)
 
 #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(ABIAArch64);
+LLDB_PLUGIN_DECLARE(ABIARM);
+LLDB_PLUGIN_DECLARE(ABISysV_arc);
+LLDB_PLUGIN_DECLARE(ABISysV_hexagon);
+LLDB_PLUGIN_DECLARE(ABIMips);
+LLDB_PLUGIN_DECLARE(ABIPowerPC);
+LLDB_PLUGIN_DECLARE(ABISysV_s390x);
+LLDB_PLUGIN_DECLARE(ABIX86);
 LLDB_PLUGIN_DECLARE(ObjectFileBreakpad)
 LLDB_PLUGIN_DECLARE(ObjectFileELF)
 LLDB_PLUGIN_DECLARE(ObjectFileMachO)
@@ -106,25 +99,13 @@ SystemInitializerTest::SystemInitializerTest() {}
 
 SystemInitializerTest::~SystemInitializerTest() {}
 
-#define LLDB_PROCESS_AArch64(op)                                               \
-  op(ABIMacOSX_arm64);                                                         \
-  op(ABISysV_arm64);
-#define LLDB_PROCESS_ARM(op)                                                   \
-  op(ABIMacOSX_arm);                                                           \
-  op(ABISysV_arm);
+#define LLDB_PROCESS_AArch64(op) op(ABIAArch64);
+#define LLDB_PROCESS_ARM(op) op(ABIARM);
 #define LLDB_PROCESS_Hexagon(op) op(ABISysV_hexagon);
-#define LLDB_PROCESS_Mips(op)                                                  \
-  op(ABISysV_mips);                                                            \
-  op(ABISysV_mips64);
-#define LLDB_PROCESS_PowerPC(op)                                               \
-  op(ABISysV_ppc);                                                             \
-  op(ABISysV_ppc64);
+#define LLDB_PROCESS_Mips(op) op(ABIMips);
+#define LLDB_PROCESS_PowerPC(op) op(ABIPowerPC);
 #define LLDB_PROCESS_SystemZ(op) op(ABISysV_s390x);
-#define LLDB_PROCESS_X86(op)                                                   \
-  op(ABIMacOSX_i386);                                                          \
-  op(ABISysV_i386);                                                            \
-  op(ABISysV_x86_64);                                                          \
-  op(ABIWindows_x86_64);
+#define LLDB_PROCESS_X86(op) op(ABIX86);
 
 #define LLDB_PROCESS_AMDGPU(op)
 #define LLDB_PROCESS_ARC(op)