1 //===-- SystemInitializerTest.cpp -------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "SystemInitializerTest.h"
10 #include "lldb/Core/Debugger.h"
11 #include "lldb/Core/PluginManager.h"
12 #include "lldb/Host/Host.h"
13 #include "lldb/Initialization/SystemInitializerCommon.h"
14 #include "lldb/Interpreter/CommandInterpreter.h"
15 #include "lldb/Utility/Timer.h"
16 #include "llvm/Support/TargetSelect.h"
20 #define LLDB_PLUGIN(p) LLDB_PLUGIN_DECLARE(p)
21 #include "Plugins/Plugins.def"
23 using namespace lldb_private
;
25 SystemInitializerTest::SystemInitializerTest()
26 : SystemInitializerCommon(nullptr) {}
27 SystemInitializerTest::~SystemInitializerTest() = default;
29 llvm::Error
SystemInitializerTest::Initialize() {
30 if (auto e
= SystemInitializerCommon::Initialize())
33 // Initialize LLVM and Clang
34 llvm::InitializeAllTargets();
35 llvm::InitializeAllAsmPrinters();
36 llvm::InitializeAllTargetMCs();
37 llvm::InitializeAllDisassemblers();
39 #define LLDB_SCRIPT_PLUGIN(p)
40 #define LLDB_PLUGIN(p) LLDB_PLUGIN_INITIALIZE(p);
41 #include "Plugins/Plugins.def"
43 // We ignored all the script interpreter earlier, so initialize
44 // ScriptInterpreterNone explicitly.
45 LLDB_PLUGIN_INITIALIZE(ScriptInterpreterNone
);
47 // Scan for any system or user LLDB plug-ins
48 PluginManager::Initialize();
50 // The process settings need to know about installed plug-ins, so the
51 // Settings must be initialized AFTER PluginManager::Initialize is called.
52 Debugger::SettingsInitialize();
54 return llvm::Error::success();
57 void SystemInitializerTest::Terminate() {
58 Debugger::SettingsTerminate();
60 // Terminate and unload and loaded system or user LLDB plug-ins
61 PluginManager::Terminate();
63 #define LLDB_SCRIPT_PLUGIN(p)
64 #define LLDB_PLUGIN(p) LLDB_PLUGIN_TERMINATE(p);
65 #include "Plugins/Plugins.def"
67 // We ignored all the script interpreter earlier, so terminate
68 // ScriptInterpreterNone explicitly.
69 LLDB_PLUGIN_INITIALIZE(ScriptInterpreterNone
);
71 // Now shutdown the common parts, in reverse order.
72 SystemInitializerCommon::Terminate();