Coverage Report

Created: 2022-01-18 06:27

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Plugins/DynamicLoader/wasm-DYLD/DynamicLoaderWasmDYLD.cpp
Line
Count
Source (jump to first uncovered line)
1
//===-- DynamicLoaderWasmDYLD.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
9
#include "DynamicLoaderWasmDYLD.h"
10
11
#include "Plugins/ObjectFile/wasm/ObjectFileWasm.h"
12
#include "lldb/Core/Module.h"
13
#include "lldb/Core/PluginManager.h"
14
#include "lldb/Core/Section.h"
15
#include "lldb/Target/Process.h"
16
#include "lldb/Target/Target.h"
17
#include "lldb/Utility/Log.h"
18
19
using namespace lldb;
20
using namespace lldb_private;
21
using namespace lldb_private::wasm;
22
23
LLDB_PLUGIN_DEFINE(DynamicLoaderWasmDYLD)
24
25
DynamicLoaderWasmDYLD::DynamicLoaderWasmDYLD(Process *process)
26
3
    : DynamicLoader(process) {}
27
28
3.44k
void DynamicLoaderWasmDYLD::Initialize() {
29
3.44k
  PluginManager::RegisterPlugin(GetPluginNameStatic(),
30
3.44k
                                GetPluginDescriptionStatic(), CreateInstance);
31
3.44k
}
32
33
3.44k
llvm::StringRef DynamicLoaderWasmDYLD::GetPluginDescriptionStatic() {
34
3.44k
  return "Dynamic loader plug-in that watches for shared library "
35
3.44k
         "loads/unloads in WebAssembly engines.";
36
3.44k
}
37
38
DynamicLoader *DynamicLoaderWasmDYLD::CreateInstance(Process *process,
39
3
                                                     bool force) {
40
3
  bool should_create = force;
41
3
  if (!should_create) {
42
3
    should_create =
43
3
        (process->GetTarget().GetArchitecture().GetTriple().getArch() ==
44
3
         llvm::Triple::wasm32);
45
3
  }
46
47
3
  if (should_create)
48
3
    return new DynamicLoaderWasmDYLD(process);
49
50
0
  return nullptr;
51
3
}
52
53
3
void DynamicLoaderWasmDYLD::DidAttach() {
54
3
  Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
55
3
  LLDB_LOGF(log, "DynamicLoaderWasmDYLD::%s()", __FUNCTION__);
56
57
  // Ask the process for the list of loaded WebAssembly modules.
58
3
  auto error = m_process->LoadModules();
59
3
  LLDB_LOG_ERROR(log, std::move(error), "Couldn't load modules: {0}");
60
3
}
61
62
ThreadPlanSP DynamicLoaderWasmDYLD::GetStepThroughTrampolinePlan(Thread &thread,
63
0
                                                                 bool stop) {
64
0
  return ThreadPlanSP();
65
0
}