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"
18#include "lldb/Utility/Timer.h"
19#include "llvm/Support/CommandLine.h"
20#include "llvm/Support/TargetSelect.h"
21
22#pragma clang diagnostic push
23#pragma clang diagnostic ignored "-Wglobal-constructors"
24#include "llvm/ExecutionEngine/MCJIT.h"
25#pragma clang diagnostic pop
26
27#include <string>
28
29#define LLDB_PLUGIN(p) LLDB_PLUGIN_DECLARE(p)
30#include "Plugins/Plugins.def"
31
32#if LLDB_ENABLE_PYTHON
34
35constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper
37 lldb_private::ScriptInterpreterPython::SharedLibraryDirectoryHelper;
38
39#else
40constexpr lldb_private::HostInfo::SharedLibraryDirectoryHelper
42#endif
43
44using namespace lldb_private;
45
49
52 if (error)
53 return error;
54
55 // Initialize LLVM and Clang
56 llvm::InitializeAllTargets();
57 llvm::InitializeAllAsmPrinters();
58 llvm::InitializeAllTargetMCs();
59 llvm::InitializeAllDisassemblers();
60 // Initialize the command line parser in LLVM. This usually isn't necessary
61 // as we aren't dealing with command line options here, but otherwise some
62 // other code in Clang/LLVM might be tempted to call this function from a
63 // different thread later on which won't work (as the function isn't
64 // thread-safe).
65 const char *arg0 = "lldb";
66 llvm::cl::ParseCommandLineOptions(1, &arg0);
67
68#define LLDB_PLUGIN(p) LLDB_PLUGIN_INITIALIZE(p);
69#include "Plugins/Plugins.def"
70
71 // Initialize plug-ins in core LLDB
73
74 // Scan for any system or user LLDB plug-ins
76
77 // The process settings need to know about installed plug-ins, so the
78 // Settings must be initialized AFTER PluginManager::Initialize is called.
80
81 // Use the Debugger's LLDBAssert callback.
83
84 return llvm::Error::success();
85}
86
89
90 // Terminate plug-ins in core LLDB
92
93 // Terminate and unload and loaded system or user LLDB plug-ins
95
96#define LLDB_PLUGIN(p) LLDB_PLUGIN_TERMINATE(p);
97#include "Plugins/Plugins.def"
98
99 // Now shutdown the common parts, in reverse order.
101}
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:1399
static void SettingsInitialize()
Definition: Debugger.cpp:629
static void SettingsTerminate()
Definition: Debugger.cpp:631
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