aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/Target/JITLoader.h
blob: 97f2a9796a80510b46c1d20c4712edaecffbdcc4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//===-- JITLoader.h ---------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_JITLoader_h_
#define liblldb_JITLoader_h_

#include <vector>

#include "lldb/Core/PluginInterface.h"
#include "lldb/Target/JITLoaderList.h"

namespace lldb_private {

//----------------------------------------------------------------------
/// @class JITLoader JITLoader.h "lldb/Target/JITLoader.h"
/// @brief A plug-in interface definition class for JIT loaders.
///
/// Plugins of this kind listen for code generated at runtime in the
/// target. They are very similar to dynamic loader, with the difference
/// that they do not have information about the target's dyld and
/// that there may be multiple JITLoader plugins per process, while
/// there is at most one DynamicLoader.
//----------------------------------------------------------------------
class JITLoader : public PluginInterface {
public:
  //------------------------------------------------------------------
  /// Find a JIT loader plugin for a given process.
  ///
  /// Scans the installed DynamicLoader plug-ins and tries to find
  /// all applicable instances for the current process.
  ///
  /// @param[in] process
  ///     The process for which to try and locate a JIT loader
  ///     plug-in instance.
  ///
  //------------------------------------------------------------------
  static void LoadPlugins(Process *process, lldb_private::JITLoaderList &list);

  //------------------------------------------------------------------
  /// Construct with a process.
  //------------------------------------------------------------------
  JITLoader(Process *process);

  ~JITLoader() override;

  //------------------------------------------------------------------
  /// Called after attaching a process.
  ///
  /// Allow JITLoader plug-ins to execute some code after
  /// attaching to a process.
  //------------------------------------------------------------------
  virtual void DidAttach() = 0;

  //------------------------------------------------------------------
  /// Called after launching a process.
  ///
  /// Allow JITLoader plug-ins to execute some code after
  /// the process has stopped for the first time on launch.
  //------------------------------------------------------------------
  virtual void DidLaunch() = 0;

  //------------------------------------------------------------------
  /// Called after a new shared object has been loaded so that it can
  /// be probed for JIT entry point hooks.
  //------------------------------------------------------------------
  virtual void ModulesDidLoad(lldb_private::ModuleList &module_list) = 0;

protected:
  //------------------------------------------------------------------
  // Member variables.
  //------------------------------------------------------------------
  Process *m_process;
};

} // namespace lldb_private

#endif // liblldb_JITLoader_h_