Commit fbb4d1e4 authored by Jonas Devlieghere's avatar Jonas Devlieghere
Browse files

[lldb/Plugins] Use external functions to (de)initialize plugins

This is a step towards making the initialize and terminate calls be
generated by CMake, which in turn is towards making it possible to
disable plugins at configuration time.

Differential revision: https://reviews.llvm.org/D74245
parent bb717d3f
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -22,6 +22,20 @@
#include <stddef.h>
#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)                                     \
  extern void lldb_initialize_##PluginName();                                  \
  lldb_initialize_##PluginName()
#define LLDB_PLUGIN_TERMINATE(PluginName)                                      \
  extern void lldb_terminate_##PluginName();                                   \
  lldb_terminate_##PluginName()

namespace lldb_private {
class CommandInterpreter;
class ConstString;
@@ -42,15 +56,13 @@ public:

  static ABICreateInstance GetABICreateCallbackAtIndex(uint32_t idx);

  static ABICreateInstance
  GetABICreateCallbackForPluginName(ConstString name);
  static ABICreateInstance GetABICreateCallbackForPluginName(ConstString name);

  // Architecture
  using ArchitectureCreateInstance =
      std::unique_ptr<Architecture> (*)(const ArchSpec &);

  static void RegisterPlugin(ConstString name,
                             llvm::StringRef description,
  static void RegisterPlugin(ConstString name, llvm::StringRef description,
                             ArchitectureCreateInstance create_callback);

  static void UnregisterPlugin(ArchitectureCreateInstance create_callback);
+169 −268

File changed.

Preview size limit exceeded, changes collapsed.

+2 −0
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@
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[] = {
+2 −0
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@
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
+2 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@
using namespace lldb;
using namespace lldb_private;

LLDB_PLUGIN(ABISysV_arc);

namespace {
namespace dwarf {
enum regnums {
Loading