2020-01-24 08:23:27 +01:00
|
|
|
//===-- SystemInitializerFull.cpp -----------------------------------------===//
|
2015-03-31 21:03:22 +00:00
|
|
|
//
|
2019-01-19 08:50:56 +00:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2015-03-31 21:03:22 +00:00
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
2018-05-25 20:28:16 +00:00
|
|
|
#include "SystemInitializerFull.h"
|
2015-07-30 20:28:07 +00:00
|
|
|
#include "lldb/API/SBCommandInterpreter.h"
|
2015-03-31 21:03:22 +00:00
|
|
|
#include "lldb/Core/Debugger.h"
|
2020-02-07 14:58:18 -08:00
|
|
|
#include "lldb/Core/PluginManager.h"
|
|
|
|
|
#include "lldb/Host/Config.h"
|
2015-03-31 21:03:22 +00:00
|
|
|
#include "lldb/Host/Host.h"
|
|
|
|
|
#include "lldb/Initialization/SystemInitializerCommon.h"
|
2015-07-30 20:28:07 +00:00
|
|
|
#include "lldb/Interpreter/CommandInterpreter.h"
|
2017-06-29 14:32:17 +00:00
|
|
|
#include "lldb/Utility/Timer.h"
|
2015-03-31 21:03:22 +00:00
|
|
|
#include "llvm/Support/TargetSelect.h"
|
|
|
|
|
|
2019-05-03 23:19:27 +00:00
|
|
|
#pragma clang diagnostic push
|
|
|
|
|
#pragma clang diagnostic ignored "-Wglobal-constructors"
|
|
|
|
|
#include "llvm/ExecutionEngine/MCJIT.h"
|
|
|
|
|
#pragma clang diagnostic pop
|
|
|
|
|
|
2015-03-31 21:03:22 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
2020-02-18 11:25:42 -08:00
|
|
|
#define LLDB_PLUGIN(p) LLDB_PLUGIN_DECLARE(p)
|
|
|
|
|
#include "Plugins/Plugins.def"
|
2020-02-07 17:58:30 -08:00
|
|
|
|
2015-03-31 21:03:22 +00:00
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
2020-02-17 22:57:06 -08:00
|
|
|
SystemInitializerFull::SystemInitializerFull() = default;
|
|
|
|
|
SystemInitializerFull::~SystemInitializerFull() = default;
|
2015-03-31 21:03:22 +00:00
|
|
|
|
2019-02-21 22:26:16 +00:00
|
|
|
llvm::Error SystemInitializerFull::Initialize() {
|
|
|
|
|
if (auto e = SystemInitializerCommon::Initialize())
|
2018-12-03 17:28:29 +00:00
|
|
|
return e;
|
2018-05-24 12:44:18 +00:00
|
|
|
|
2015-03-31 21:03:22 +00:00
|
|
|
// Initialize LLVM and Clang
|
|
|
|
|
llvm::InitializeAllTargets();
|
|
|
|
|
llvm::InitializeAllAsmPrinters();
|
|
|
|
|
llvm::InitializeAllTargetMCs();
|
|
|
|
|
llvm::InitializeAllDisassemblers();
|
|
|
|
|
|
2020-02-18 19:13:45 -08:00
|
|
|
#define LLDB_PLUGIN(p) LLDB_PLUGIN_INITIALIZE(p);
|
|
|
|
|
#include "Plugins/Plugins.def"
|
2020-02-17 19:02:25 -08:00
|
|
|
|
|
|
|
|
// Scan for any system or user LLDB plug-ins
|
2015-03-31 21:03:22 +00:00
|
|
|
PluginManager::Initialize();
|
|
|
|
|
|
2018-04-30 16:49:04 +00:00
|
|
|
// The process settings need to know about installed plug-ins, so the
|
2020-02-18 19:13:45 -08:00
|
|
|
// Settings must be initialized AFTER PluginManager::Initialize is called.
|
2015-03-31 21:03:22 +00:00
|
|
|
Debugger::SettingsInitialize();
|
2018-12-03 17:28:29 +00:00
|
|
|
|
|
|
|
|
return llvm::Error::success();
|
2015-03-31 21:03:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SystemInitializerFull::Terminate() {
|
2017-05-15 13:02:37 +00:00
|
|
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
|
|
|
|
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
|
2015-03-31 21:03:22 +00:00
|
|
|
|
|
|
|
|
Debugger::SettingsTerminate();
|
|
|
|
|
|
2020-02-17 19:02:25 -08:00
|
|
|
// Terminate and unload and loaded system or user LLDB plug-ins
|
2015-03-31 21:03:22 +00:00
|
|
|
PluginManager::Terminate();
|
2015-09-17 22:23:34 +00:00
|
|
|
|
2020-02-18 19:13:45 -08:00
|
|
|
#define LLDB_PLUGIN(p) LLDB_PLUGIN_TERMINATE(p);
|
|
|
|
|
#include "Plugins/Plugins.def"
|
2020-02-07 14:58:18 -08:00
|
|
|
|
2015-03-31 21:03:22 +00:00
|
|
|
// Now shutdown the common parts, in reverse order.
|
|
|
|
|
SystemInitializerCommon::Terminate();
|
|
|
|
|
}
|