1 //===-- JITLoaderGDB.h ------------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef liblldb_JITLoaderGDB_h_
10 #define liblldb_JITLoaderGDB_h_
14 #include "lldb/Target/JITLoader.h"
15 #include "lldb/Target/Process.h"
17 class JITLoaderGDB : public lldb_private::JITLoader {
19 JITLoaderGDB(lldb_private::Process *process);
21 ~JITLoaderGDB() override;
24 static void Initialize();
26 static void Terminate();
28 static lldb_private::ConstString GetPluginNameStatic();
30 static const char *GetPluginDescriptionStatic();
32 static lldb::JITLoaderSP CreateInstance(lldb_private::Process *process,
35 static void DebuggerInitialize(lldb_private::Debugger &debugger);
37 // PluginInterface protocol
38 lldb_private::ConstString GetPluginName() override;
40 uint32_t GetPluginVersion() override;
42 // JITLoader interface
43 void DidAttach() override;
45 void DidLaunch() override;
47 void ModulesDidLoad(lldb_private::ModuleList &module_list) override;
50 lldb::addr_t GetSymbolAddress(lldb_private::ModuleList &module_list,
51 lldb_private::ConstString name,
52 lldb::SymbolType symbol_type) const;
54 void SetJITBreakpoint(lldb_private::ModuleList &module_list);
56 bool DidSetJITBreakpoint() const;
58 bool ReadJITDescriptor(bool all_entries);
60 template <typename ptr_t> bool ReadJITDescriptorImpl(bool all_entries);
63 JITDebugBreakpointHit(void *baton,
64 lldb_private::StoppointCallbackContext *context,
65 lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
67 static void ProcessStateChangedCallback(void *baton,
68 lldb_private::Process *process,
69 lldb::StateType state);
71 // A collection of in-memory jitted object addresses and their corresponding
73 typedef std::map<lldb::addr_t, const lldb::ModuleSP> JITObjectMap;
74 JITObjectMap m_jit_objects;
76 lldb::user_id_t m_jit_break_id;
77 lldb::addr_t m_jit_descriptor_addr;
80 #endif // liblldb_JITLoaderGDB_h_