Coverage Report

Created: 2022-01-22 13:19

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.h
Line
Count
Source (jump to first uncovered line)
1
//===-- JITLoaderGDB.h ------------------------------------------*- 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
#ifndef LLDB_SOURCE_PLUGINS_JITLOADER_GDB_JITLOADERGDB_H
10
#define LLDB_SOURCE_PLUGINS_JITLOADER_GDB_JITLOADERGDB_H
11
12
#include <map>
13
14
#include "lldb/Target/JITLoader.h"
15
#include "lldb/Target/Process.h"
16
17
class JITLoaderGDB : public lldb_private::JITLoader {
18
public:
19
  JITLoaderGDB(lldb_private::Process *process);
20
21
  ~JITLoaderGDB() override;
22
23
  // Static Functions
24
  static void Initialize();
25
26
  static void Terminate();
27
28
12.7k
  static llvm::StringRef GetPluginNameStatic() { return "gdb"; }
29
30
  static llvm::StringRef GetPluginDescriptionStatic();
31
32
  static lldb::JITLoaderSP CreateInstance(lldb_private::Process *process,
33
                                          bool force);
34
35
  static void DebuggerInitialize(lldb_private::Debugger &debugger);
36
37
  // PluginInterface protocol
38
0
  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
39
40
  // JITLoader interface
41
  void DidAttach() override;
42
43
  void DidLaunch() override;
44
45
  void ModulesDidLoad(lldb_private::ModuleList &module_list) override;
46
47
private:
48
  lldb::addr_t GetSymbolAddress(lldb_private::ModuleList &module_list,
49
                                lldb_private::ConstString name,
50
                                lldb::SymbolType symbol_type) const;
51
52
  void SetJITBreakpoint(lldb_private::ModuleList &module_list);
53
54
  bool DidSetJITBreakpoint() const;
55
56
  bool ReadJITDescriptor(bool all_entries);
57
58
  template <typename ptr_t> bool ReadJITDescriptorImpl(bool all_entries);
59
60
  static bool
61
  JITDebugBreakpointHit(void *baton,
62
                        lldb_private::StoppointCallbackContext *context,
63
                        lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
64
65
  static void ProcessStateChangedCallback(void *baton,
66
                                          lldb_private::Process *process,
67
                                          lldb::StateType state);
68
69
  // A collection of in-memory jitted object addresses and their corresponding
70
  // modules
71
  typedef std::map<lldb::addr_t, const lldb::ModuleSP> JITObjectMap;
72
  JITObjectMap m_jit_objects;
73
74
  lldb::user_id_t m_jit_break_id;
75
  lldb::addr_t m_jit_descriptor_addr;
76
};
77
78
#endif // LLDB_SOURCE_PLUGINS_JITLOADER_GDB_JITLOADERGDB_H