[Lldb-commits] [lldb] bcde387 - [lldb/Plugins] Initialize all ABI plugins by their plugin name

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 17 19:55:58 PST 2020


Author: Jonas Devlieghere
Date: 2020-02-17T19:55:43-08:00
New Revision: bcde387f46b74ee2954497b682425e4cac80f082

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

LOG: [lldb/Plugins] Initialize all ABI plugins by their plugin name

Added: 
    

Modified: 
    lldb/include/lldb/Core/PluginManager.h
    lldb/source/API/SystemInitializerFull.cpp
    lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
    lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
    lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
    lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp
    lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.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 1544ecc386c7..d42e53ac6fe3 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -22,12 +22,15 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#define LLDB_PLUGIN_DEFINE(PluginName)                                         \
+#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)                          \
   namespace lldb_private {                                                     \
-  void lldb_initialize_##PluginName() { PluginName::Initialize(); }            \
-  void lldb_terminate_##PluginName() { PluginName::Terminate(); }              \
+  void lldb_initialize_##PluginName() { ClassName::Initialize(); }             \
+  void lldb_terminate_##PluginName() { ClassName::Terminate(); }               \
   }
 
+#define LLDB_PLUGIN_DEFINE(PluginName)                                         \
+  LLDB_PLUGIN_DEFINE_ADV(PluginName, PluginName)
+
 // FIXME: Generate me with CMake
 #define LLDB_PLUGIN_DECLARE(PluginName)                                        \
   namespace lldb_private {                                                     \

diff  --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp
index b629e53e9dfe..1933cc57259e 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -26,11 +26,11 @@
 
 LLDB_PLUGIN_DECLARE(ABIAArch64)
 LLDB_PLUGIN_DECLARE(ABIARM)
-LLDB_PLUGIN_DECLARE(ABISysV_arc)
-LLDB_PLUGIN_DECLARE(ABISysV_hexagon)
+LLDB_PLUGIN_DECLARE(ABIARC)
+LLDB_PLUGIN_DECLARE(ABIHexagon)
 LLDB_PLUGIN_DECLARE(ABIMips)
 LLDB_PLUGIN_DECLARE(ABIPowerPC)
-LLDB_PLUGIN_DECLARE(ABISysV_s390x)
+LLDB_PLUGIN_DECLARE(ABISystemZ)
 LLDB_PLUGIN_DECLARE(ABIX86)
 LLDB_PLUGIN_DECLARE(ObjectFileBreakpad)
 LLDB_PLUGIN_DECLARE(ObjectFileELF)
@@ -116,11 +116,11 @@ SystemInitializerFull::~SystemInitializerFull() {}
 
 #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_ARC(op) op(ABIARC);
+#define LLDB_PROCESS_Hexagon(op) op(ABIHexagon);
 #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_SystemZ(op) op(ABISystemZ);
 #define LLDB_PROCESS_X86(op) op(ABIX86);
 
 #define LLDB_PROCESS_AMDGPU(op)

diff  --git a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
index 94f7c2aff641..8ba63b9ba4a1 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
@@ -1665,7 +1665,7 @@ ABIMacOSX_arm64::CreateInstance(ProcessSP process_sp, const ArchSpec &arch) {
   const llvm::Triple::VendorType vendor_type = arch.GetTriple().getVendor();
 
   if (vendor_type == llvm::Triple::Apple) {
-    if (arch_type == llvm::Triple::aarch64 || 
+    if (arch_type == llvm::Triple::aarch64 ||
         arch_type == llvm::Triple::aarch64_32) {
       return ABISP(
           new ABIMacOSX_arm64(std::move(process_sp), MakeMCRegisterInfo(arch)));

diff  --git a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
index 1690f1c511f2..10e3b0ff2f7d 100644
--- a/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
+++ b/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp
@@ -55,7 +55,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-LLDB_PLUGIN_DEFINE(ABISysV_arc)
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_arc, ABIARC)
 
 namespace {
 namespace dwarf {
@@ -146,7 +146,7 @@ size_t ABISysV_arc::GetRedZoneSize() const { return 0; }
 bool ABISysV_arc::IsRegisterFileReduced(RegisterContext &reg_ctx) const {
   if (!m_is_reg_file_reduced) {
     const auto *const rf_build_reg = reg_ctx.GetRegisterInfoByName("rf_build");
-    
+
     const auto reg_value = reg_ctx.ReadRegisterAsUnsigned(rf_build_reg,
                                                           /*fail_value*/ 0);
     // RF_BUILD "Number of Entries" bit.
@@ -241,7 +241,7 @@ bool ABISysV_arc::PrepareTrivialCall(Thread &thread, addr_t sp, addr_t pc,
   // Make sure number of parameters matches prototype.
   assert(!prototype.isFunctionVarArg());
   assert(prototype.getFunctionNumParams() == args.size());
-  
+
   const size_t regs_for_args_count = IsRegisterFileReduced(*reg_ctx) ? 4U : 8U;
 
   // Number of arguments passed on stack.

diff  --git a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
index 73d8308ae0dc..ef500cb198a8 100644
--- a/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
+++ b/lldb/source/Plugins/ABI/ARM/ABIMacOSX_arm.cpp
@@ -34,8 +34,6 @@
 using namespace lldb;
 using namespace lldb_private;
 
-LLDB_PLUGIN_DEFINE(ABIMacOSX_arm)
-
 static RegisterInfo g_register_infos[] = {
     //  NAME       ALT       SZ OFF ENCODING         FORMAT          EH_FRAME
     //  DWARF               GENERIC                     PROCESS PLUGIN

diff  --git a/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp b/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp
index 601d9c2f0f05..32313d4cd815 100644
--- a/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp
+++ b/lldb/source/Plugins/ABI/Hexagon/ABISysV_hexagon.cpp
@@ -32,7 +32,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-LLDB_PLUGIN_DEFINE(ABISysV_hexagon)
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_hexagon, ABIHexagon)
 
 static RegisterInfo g_register_infos[] = {
     // hexagon-core.xml

diff  --git a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
index bfeaa1226df2..eced2adc7591 100644
--- a/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
+++ b/lldb/source/Plugins/ABI/SystemZ/ABISysV_s390x.cpp
@@ -32,7 +32,7 @@
 using namespace lldb;
 using namespace lldb_private;
 
-LLDB_PLUGIN_DEFINE(ABISysV_s390x)
+LLDB_PLUGIN_DEFINE_ADV(ABISysV_s390x, ABISystemZ)
 
 enum dwarf_regnums {
   // General Purpose Registers

diff  --git a/lldb/tools/lldb-test/SystemInitializerTest.cpp b/lldb/tools/lldb-test/SystemInitializerTest.cpp
index b33b08640471..89febfaf118c 100644
--- a/lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ b/lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -17,14 +17,14 @@
 
 #include <string>
 
-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(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(ObjectFileMachO)
@@ -102,14 +102,14 @@ SystemInitializerTest::~SystemInitializerTest() {}
 
 #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_ARC(op) op(ABIARC);
+#define LLDB_PROCESS_Hexagon(op) op(ABIHexagon);
 #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_SystemZ(op) op(ABISystemZ);
 #define LLDB_PROCESS_X86(op) op(ABIX86);
 
 #define LLDB_PROCESS_AMDGPU(op)
-#define LLDB_PROCESS_ARC(op)
 #define LLDB_PROCESS_AVR(op)
 #define LLDB_PROCESS_BPF(op)
 #define LLDB_PROCESS_Lanai(op)


        


More information about the lldb-commits mailing list