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/Core/Progress.h"
14#include "lldb/Host/Config.h"
15#include "lldb/Host/Host.h"
19#include "lldb/Utility/Timer.h"
21#include "llvm/Support/CommandLine.h"
22#include "llvm/Support/TargetSelect.h"
23
24#pragma clang diagnostic push
25#pragma clang diagnostic ignored "-Wglobal-constructors"
26#include "llvm/ExecutionEngine/MCJIT.h"
27#pragma clang diagnostic pop
28
29#include <string>
30
31#define LLDB_PLUGIN(p) LLDB_PLUGIN_DECLARE(p)
32#include "Plugins/Plugins.def"
33
34#if LLDB_ENABLE_PYTHON
36
37constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper
39 lldb_private::ScriptInterpreterPython::SharedLibraryDirectoryHelper;
40
41#else
42constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper
44#endif
45
46using namespace lldb_private;
47
51
54 if (error)
55 return error;
56
57 // Initialize LLVM and Clang
58 llvm::InitializeAllTargets();
59 llvm::InitializeAllAsmPrinters();
60 llvm::InitializeAllTargetMCs();
61 llvm::InitializeAllDisassemblers();
62
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);
70
71 // Initialize the progress manager.
73
74#define LLDB_PLUGIN(p) LLDB_PLUGIN_INITIALIZE(p);
75#include "Plugins/Plugins.def"
76
77 // Scan for any system or user LLDB plug-ins.
79
80 // The process settings need to know about installed plug-ins, so the
81 // Settings must be initialized AFTER PluginManager::Initialize is called.
83
84 // Use the Debugger's LLDBAssert callback.
86
87 // Use the system log to report errors that would otherwise get dropped.
89
91
92 return llvm::Error::success();
93}
94
97
98 // Terminate plug-ins in core LLDB.
100
101 // Terminate and unload and loaded system or user LLDB plug-ins.
103
104#define LLDB_PLUGIN(p) LLDB_PLUGIN_TERMINATE(p);
105#include "Plugins/Plugins.def"
106
107 // Terminate the progress manager.
109
110 // Now shutdown the common parts, in reverse order.
112}
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
Definition: Log.h:369
constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper * g_shlib_dir_helper
static void AssertCallback(llvm::StringRef message, llvm::StringRef backtrace, llvm::StringRef prompt)
Definition: Debugger.cpp:1460
static void SettingsInitialize()
Definition: Debugger.cpp:671
static void SettingsTerminate()
Definition: Debugger.cpp:673
Initializes common lldb functionality.
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:332
void SetLLDBAssertCallback(LLDBAssertCallback callback)
Definition: LLDBAssert.cpp:62
const char * GetVersion()
Retrieves a string representing the complete LLDB version, which includes the lldb version number,...
Definition: Version.cpp:38
void SetLLDBErrorLog(Log *log)
Getter and setter for the error log (see g_error_log).
Definition: Log.cpp:468