[RISCV] Reduce redundancy in vnsrl tests
[llvm-project.git] / lldb / source / API / SystemInitializerFull.cpp
blob31f3a9f30b81f0535f90b1965a0dc93336ae1081
1 //===-- SystemInitializerFull.cpp -----------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 #include "SystemInitializerFull.h"
10 #include "lldb/API/SBCommandInterpreter.h"
11 #include "lldb/Core/Debugger.h"
12 #include "lldb/Core/PluginManager.h"
13 #include "lldb/Core/Progress.h"
14 #include "lldb/Host/Config.h"
15 #include "lldb/Host/Host.h"
16 #include "lldb/Initialization/SystemInitializerCommon.h"
17 #include "lldb/Interpreter/CommandInterpreter.h"
18 #include "lldb/Target/ProcessTrace.h"
19 #include "lldb/Utility/Timer.h"
20 #include "lldb/Version/Version.h"
21 #include "llvm/Support/CommandLine.h"
22 #include "llvm/Support/TargetSelect.h"
24 #pragma clang diagnostic push
25 #pragma clang diagnostic ignored "-Wglobal-constructors"
26 #include "llvm/ExecutionEngine/MCJIT.h"
27 #pragma clang diagnostic pop
29 #include <string>
31 #define LLDB_PLUGIN(p) LLDB_PLUGIN_DECLARE(p)
32 #include "Plugins/Plugins.def"
34 #if LLDB_ENABLE_PYTHON
35 #include "Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h"
37 constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper
38 *g_shlib_dir_helper =
39 lldb_private::ScriptInterpreterPython::SharedLibraryDirectoryHelper;
41 #else
42 constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper
43 *g_shlib_dir_helper = nullptr;
44 #endif
46 using namespace lldb_private;
48 SystemInitializerFull::SystemInitializerFull()
49 : SystemInitializerCommon(g_shlib_dir_helper) {}
50 SystemInitializerFull::~SystemInitializerFull() = default;
52 llvm::Error SystemInitializerFull::Initialize() {
53 llvm::Error error = SystemInitializerCommon::Initialize();
54 if (error)
55 return error;
57 // Initialize LLVM and Clang
58 llvm::InitializeAllTargets();
59 llvm::InitializeAllAsmPrinters();
60 llvm::InitializeAllTargetMCs();
61 llvm::InitializeAllDisassemblers();
63 // Initialize the command line parser in LLVM. This usually isn't necessary
64 // as we aren't dealing with command line options here, but otherwise some
65 // other code in Clang/LLVM might be tempted to call this function from a
66 // different thread later on which won't work (as the function isn't
67 // thread-safe).
68 const char *arg0 = "lldb";
69 llvm::cl::ParseCommandLineOptions(1, &arg0);
71 // Initialize the progress manager.
72 ProgressManager::Initialize();
74 #define LLDB_PLUGIN(p) LLDB_PLUGIN_INITIALIZE(p);
75 #include "Plugins/Plugins.def"
77 // Scan for any system or user LLDB plug-ins.
78 PluginManager::Initialize();
80 // The process settings need to know about installed plug-ins, so the
81 // Settings must be initialized AFTER PluginManager::Initialize is called.
82 Debugger::SettingsInitialize();
84 // Use the Debugger's LLDBAssert callback.
85 SetLLDBAssertCallback(Debugger::AssertCallback);
87 // Use the system log to report errors that would otherwise get dropped.
88 SetLLDBErrorLog(GetLog(SystemLog::System));
90 LLDB_LOG(GetLog(SystemLog::System), "{0}", GetVersion());
92 return llvm::Error::success();
95 void SystemInitializerFull::Terminate() {
96 Debugger::SettingsTerminate();
98 // Terminate plug-ins in core LLDB.
99 ProcessTrace::Terminate();
101 // Terminate and unload and loaded system or user LLDB plug-ins.
102 PluginManager::Terminate();
104 #define LLDB_PLUGIN(p) LLDB_PLUGIN_TERMINATE(p);
105 #include "Plugins/Plugins.def"
107 // Terminate the progress manager.
108 ProgressManager::Terminate();
110 // Now shutdown the common parts, in reverse order.
111 SystemInitializerCommon::Terminate();