1 //===-- JITLoader.h ---------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_JITLoader_h_
11 #define liblldb_JITLoader_h_
15 #include "lldb/Core/PluginInterface.h"
16 #include "lldb/Target/JITLoaderList.h"
18 namespace lldb_private {
20 //----------------------------------------------------------------------
21 /// @class JITLoader JITLoader.h "lldb/Target/JITLoader.h"
22 /// A plug-in interface definition class for JIT loaders.
24 /// Plugins of this kind listen for code generated at runtime in the target.
25 /// They are very similar to dynamic loader, with the difference that they do
26 /// not have information about the target's dyld and that there may be
27 /// multiple JITLoader plugins per process, while there is at most one
29 //----------------------------------------------------------------------
30 class JITLoader : public PluginInterface {
32 //------------------------------------------------------------------
33 /// Find a JIT loader plugin for a given process.
35 /// Scans the installed DynamicLoader plug-ins and tries to find all
36 /// applicable instances for the current process.
38 /// @param[in] process
39 /// The process for which to try and locate a JIT loader
42 //------------------------------------------------------------------
43 static void LoadPlugins(Process *process, lldb_private::JITLoaderList &list);
45 //------------------------------------------------------------------
46 /// Construct with a process.
47 //------------------------------------------------------------------
48 JITLoader(Process *process);
50 ~JITLoader() override;
52 //------------------------------------------------------------------
53 /// Called after attaching a process.
55 /// Allow JITLoader plug-ins to execute some code after attaching to a
57 //------------------------------------------------------------------
58 virtual void DidAttach() = 0;
60 //------------------------------------------------------------------
61 /// Called after launching a process.
63 /// Allow JITLoader plug-ins to execute some code after the process has
64 /// stopped for the first time on launch.
65 //------------------------------------------------------------------
66 virtual void DidLaunch() = 0;
68 //------------------------------------------------------------------
69 /// Called after a new shared object has been loaded so that it can be
70 /// probed for JIT entry point hooks.
71 //------------------------------------------------------------------
72 virtual void ModulesDidLoad(lldb_private::ModuleList &module_list) = 0;
75 //------------------------------------------------------------------
77 //------------------------------------------------------------------
81 } // namespace lldb_private
83 #endif // liblldb_JITLoader_h_