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"
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
36constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper
38 lldb_private::ScriptInterpreterPython::SharedLibraryDirectoryHelper;
39
40#else
41constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper
43#endif
44
45using 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
62 // Initialize the command line parser in LLVM. This usually isn't necessary
63 // as we aren't dealing with command line options here, but otherwise some
64 // other code in Clang/LLVM might be tempted to call this function from a
65 // different thread later on which won't work (as the function isn't
66 // thread-safe).
67 const char *arg0 = "lldb";
68 llvm::cl::ParseCommandLineOptions(1, &arg0);
69
70 // Initialize the progress manager.
72
73#define LLDB_PLUGIN(p) LLDB_PLUGIN_INITIALIZE(p);
74#include "Plugins/Plugins.def"
75
76 // Scan for any system or user LLDB plug-ins.
78
79 // The process settings need to know about installed plug-ins, so the
80 // Settings must be initialized AFTER PluginManager::Initialize is called.
82
83 // Use the Debugger's LLDBAssert callback.
85
86 return llvm::Error::success();
87}
88
91
92 // Terminate plug-ins in core LLDB.
94
95 // Terminate and unload and loaded system or user LLDB plug-ins.
97
98#define LLDB_PLUGIN(p) LLDB_PLUGIN_TERMINATE(p);
99#include "Plugins/Plugins.def"
100
101 // Terminate the progress manager.
103
104 // Now shutdown the common parts, in reverse order.
106}
static llvm::raw_ostream & error(Stream &strm)
constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper * g_shlib_dir_helper
static void AssertCallback(llvm::StringRef message, llvm::StringRef backtrace, llvm::StringRef prompt)
Definition: Debugger.cpp:1412
static void SettingsInitialize()
Definition: Debugger.cpp:642
static void SettingsTerminate()
Definition: Debugger.cpp:644
Initializes common lldb functionality.
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
void SetLLDBAssertCallback(LLDBAssertCallback callback)
Definition: LLDBAssert.cpp:62