LLDB  mainline
SystemInitializerFull.cpp
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
8 
11 #include "lldb/Core/Debugger.h"
13 #include "lldb/Host/Config.h"
14 #include "lldb/Host/Host.h"
19 #include "lldb/Utility/Timer.h"
20 #include "llvm/Support/CommandLine.h"
21 #include "llvm/Support/TargetSelect.h"
22 
23 #pragma clang diagnostic push
24 #pragma clang diagnostic ignored "-Wglobal-constructors"
25 #include "llvm/ExecutionEngine/MCJIT.h"
26 #pragma clang diagnostic pop
27 
28 #include <string>
29 
30 #define LLDB_PLUGIN(p) LLDB_PLUGIN_DECLARE(p)
31 #include "Plugins/Plugins.def"
32 
33 #if LLDB_ENABLE_PYTHON
35 
36 constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper
38  lldb_private::ScriptInterpreterPython::SharedLibraryDirectoryHelper;
39 
40 #else
41 constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper
42  *g_shlib_dir_helper = nullptr;
43 #endif
44 
45 using namespace lldb_private;
46 
50 
53  if (error)
54  return error;
55 
56  // Initialize LLVM and Clang
57  llvm::InitializeAllTargets();
58  llvm::InitializeAllAsmPrinters();
59  llvm::InitializeAllTargetMCs();
60  llvm::InitializeAllDisassemblers();
61  // Initialize the command line parser in LLVM. This usually isn't necessary
62  // as we aren't dealing with command line options here, but otherwise some
63  // other code in Clang/LLVM might be tempted to call this function from a
64  // different thread later on which won't work (as the function isn't
65  // thread-safe).
66  const char *arg0 = "lldb";
67  llvm::cl::ParseCommandLineOptions(1, &arg0);
68 
69 #define LLDB_PLUGIN(p) LLDB_PLUGIN_INITIALIZE(p);
70 #include "Plugins/Plugins.def"
71 
72  // Initialize plug-ins in core LLDB
74 
75  // Scan for any system or user LLDB plug-ins
77 
78  // The process settings need to know about installed plug-ins, so the
79  // Settings must be initialized AFTER PluginManager::Initialize is called.
81 
82  return llvm::Error::success();
83 }
84 
87 
88  // Terminate plug-ins in core LLDB
90 
91  // Terminate and unload and loaded system or user LLDB plug-ins
93 
94 #define LLDB_PLUGIN(p) LLDB_PLUGIN_TERMINATE(p);
95 #include "Plugins/Plugins.def"
96 
97  // Now shutdown the common parts, in reverse order.
99 }
lldb_private::Debugger::SettingsTerminate
static void SettingsTerminate()
Definition: Debugger.cpp:561
lldb_private::ProcessTrace::Initialize
static void Initialize()
Definition: ProcessTrace.cpp:94
lldb_private::SystemInitializerFull::Initialize
llvm::Error Initialize() override
Definition: SystemInitializerFull.cpp:51
Host.h
lldb_private::ProcessTrace::Terminate
static void Terminate()
Definition: ProcessTrace.cpp:27
SystemInitializerCommon.h
Reproducer.h
Debugger.h
lldb_private::SystemInitializerCommon
Initializes common lldb functionality.
Definition: SystemInitializerCommon.h:24
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
SystemInitializerFull.h
lldb_private::SystemInitializerCommon::Initialize
llvm::Error Initialize() override
Definition: SystemInitializerCommon.cpp:68
lldb_private::Debugger::SettingsInitialize
static void SettingsInitialize()
Definition: Debugger.cpp:559
Timer.h
ScriptInterpreterPython.h
lldb_private::SystemInitializerFull::~SystemInitializerFull
~SystemInitializerFull() override
ProcessTrace.h
lldb_private::SystemInitializerFull::Terminate
void Terminate() override
Definition: SystemInitializerFull.cpp:85
PluginManager.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
Error
llvm::Error Error
Definition: UdtRecordCompleter.cpp:30
CommandInterpreter.h
SBCommandInterpreter.h
g_shlib_dir_helper
constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper * g_shlib_dir_helper
Definition: SystemInitializerFull.cpp:42
lldb_private::SystemInitializerCommon::Terminate
void Terminate() override
Definition: SystemInitializerCommon.cpp:122
lldb_private::SystemInitializerFull::SystemInitializerFull
SystemInitializerFull()
Definition: SystemInitializerFull.cpp:47
lldb_private::PluginManager::Terminate
static void Terminate()
Definition: PluginManager.cpp:168
lldb_private::PluginManager::Initialize
static void Initialize()
Definition: PluginManager.cpp:144