1 | //===-- JITLoader.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_TARGET_JITLOADER_H |
10 | #define LLDB_TARGET_JITLOADER_H |
11 | |
12 | #include <vector> |
13 | |
14 | #include "lldb/Core/PluginInterface.h" |
15 | #include "lldb/Target/JITLoaderList.h" |
16 | |
17 | namespace lldb_private { |
18 | |
19 | /// \class JITLoader JITLoader.h "lldb/Target/JITLoader.h" |
20 | /// A plug-in interface definition class for JIT loaders. |
21 | /// |
22 | /// Plugins of this kind listen for code generated at runtime in the target. |
23 | /// They are very similar to dynamic loader, with the difference that they do |
24 | /// not have information about the target's dyld and that there may be |
25 | /// multiple JITLoader plugins per process, while there is at most one |
26 | /// DynamicLoader. |
27 | class JITLoader : public PluginInterface { |
28 | public: |
29 | /// Find a JIT loader plugin for a given process. |
30 | /// |
31 | /// Scans the installed DynamicLoader plug-ins and tries to find all |
32 | /// applicable instances for the current process. |
33 | /// |
34 | /// \param[in] process |
35 | /// The process for which to try and locate a JIT loader |
36 | /// plug-in instance. |
37 | /// |
38 | static void LoadPlugins(Process *process, lldb_private::JITLoaderList &list); |
39 | |
40 | /// Construct with a process. |
41 | JITLoader(Process *process); |
42 | |
43 | ~JITLoader() override; |
44 | |
45 | /// Called after attaching a process. |
46 | /// |
47 | /// Allow JITLoader plug-ins to execute some code after attaching to a |
48 | /// process. |
49 | virtual void DidAttach() = 0; |
50 | |
51 | /// Called after launching a process. |
52 | /// |
53 | /// Allow JITLoader plug-ins to execute some code after the process has |
54 | /// stopped for the first time on launch. |
55 | virtual void DidLaunch() = 0; |
56 | |
57 | /// Called after a new shared object has been loaded so that it can be |
58 | /// probed for JIT entry point hooks. |
59 | virtual void ModulesDidLoad(lldb_private::ModuleList &module_list) = 0; |
60 | |
61 | protected: |
62 | // Member variables. |
63 | Process *m_process; |
64 | }; |
65 | |
66 | } // namespace lldb_private |
67 | |
68 | #endif // LLDB_TARGET_JITLOADER_H |
69 | |