Coverage Report

Created: 2023-09-21 18:56

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/tools/lldb-test/SystemInitializerTest.cpp
Line
Count
Source (jump to first uncovered line)
1
//===-- SystemInitializerTest.cpp -------------------------------*- C++ -*-===//
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
9
#include "SystemInitializerTest.h"
10
#include "lldb/Core/Debugger.h"
11
#include "lldb/Core/PluginManager.h"
12
#include "lldb/Host/Host.h"
13
#include "lldb/Initialization/SystemInitializerCommon.h"
14
#include "lldb/Interpreter/CommandInterpreter.h"
15
#include "lldb/Utility/Timer.h"
16
#include "llvm/Support/TargetSelect.h"
17
18
#include <string>
19
20
#define LLDB_PLUGIN(p) LLDB_PLUGIN_DECLARE(p)
21
#include "Plugins/Plugins.def"
22
23
using namespace lldb_private;
24
25
SystemInitializerTest::SystemInitializerTest()
26
109
    : SystemInitializerCommon(nullptr) {}
27
109
SystemInitializerTest::~SystemInitializerTest() = default;
28
29
109
llvm::Error SystemInitializerTest::Initialize() {
30
109
  if (auto e = SystemInitializerCommon::Initialize())
31
0
    return e;
32
33
  // Initialize LLVM and Clang
34
109
  llvm::InitializeAllTargets();
35
109
  llvm::InitializeAllAsmPrinters();
36
109
  llvm::InitializeAllTargetMCs();
37
109
  llvm::InitializeAllDisassemblers();
38
39
109
#define LLDB_SCRIPT_PLUGIN(p)
40
8.82k
#define LLDB_PLUGIN(p) LLDB_PLUGIN_INITIALIZE(p);
41
109
#include "Plugins/Plugins.def"
42
43
  // We ignored all the script interpreter earlier, so initialize
44
  // ScriptInterpreterNone explicitly.
45
109
  LLDB_PLUGIN_INITIALIZE(ScriptInterpreterNone);
46
47
  // Scan for any system or user LLDB plug-ins
48
109
  PluginManager::Initialize();
49
50
  // The process settings need to know about installed plug-ins, so the
51
  // Settings must be initialized AFTER PluginManager::Initialize is called.
52
109
  Debugger::SettingsInitialize();
53
54
109
  return llvm::Error::success();
55
109
}
56
57
109
void SystemInitializerTest::Terminate() {
58
109
  Debugger::SettingsTerminate();
59
60
  // Terminate and unload and loaded system or user LLDB plug-ins
61
109
  PluginManager::Terminate();
62
63
109
#define LLDB_SCRIPT_PLUGIN(p)
64
8.82k
#define LLDB_PLUGIN(p) LLDB_PLUGIN_TERMINATE(p);
65
109
#include "Plugins/Plugins.def"
66
67
  // We ignored all the script interpreter earlier, so terminate
68
  // ScriptInterpreterNone explicitly.
69
109
  LLDB_PLUGIN_INITIALIZE(ScriptInterpreterNone);
70
71
  // Now shutdown the common parts, in reverse order.
72
109
  SystemInitializerCommon::Terminate();
73
109
}