LLDB  mainline
JITLoaderGDB.h
Go to the documentation of this file.
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 
18 public:
20 
21  ~JITLoaderGDB() override;
22 
23  // Static Functions
24  static void Initialize();
25 
26  static void Terminate();
27 
29 
30  static const char *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
39 
40  uint32_t GetPluginVersion() override;
41 
42  // JITLoader interface
43  void DidAttach() override;
44 
45  void DidLaunch() override;
46 
47  void ModulesDidLoad(lldb_private::ModuleList &module_list) override;
48 
49 private:
52  lldb::SymbolType symbol_type) const;
53 
54  void SetJITBreakpoint(lldb_private::ModuleList &module_list);
55 
56  bool DidSetJITBreakpoint() const;
57 
58  bool ReadJITDescriptor(bool all_entries);
59 
60  template <typename ptr_t> bool ReadJITDescriptorImpl(bool all_entries);
61 
62  static bool
63  JITDebugBreakpointHit(void *baton,
65  lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
66 
67  static void ProcessStateChangedCallback(void *baton,
68  lldb_private::Process *process,
69  lldb::StateType state);
70 
71  // A collection of in-memory jitted object addresses and their corresponding
72  // modules
73  typedef std::map<lldb::addr_t, const lldb::ModuleSP> JITObjectMap;
75 
78 };
79 
80 #endif // LLDB_SOURCE_PLUGINS_JITLOADER_GDB_JITLOADERGDB_H
JITLoaderGDB::~JITLoaderGDB
~JITLoaderGDB() override
Definition: JITLoaderGDB.cpp:153
lldb_private::StoppointCallbackContext
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
Definition: StoppointCallbackContext.h:26
JITLoaderGDB::Terminate
static void Terminate()
Definition: JITLoaderGDB.cpp:449
lldb_private::Process
Definition: Process.h:342
JITLoaderGDB::ProcessStateChangedCallback
static void ProcessStateChangedCallback(void *baton, lldb_private::Process *process, lldb::StateType state)
JITLoaderGDB::GetPluginVersion
uint32_t GetPluginVersion() override
Definition: JITLoaderGDB.cpp:441
JITLoaderGDB::CreateInstance
static lldb::JITLoaderSP CreateInstance(lldb_private::Process *process, bool force)
Definition: JITLoaderGDB.cpp:412
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
JITLoaderGDB::GetPluginDescriptionStatic
static const char * GetPluginDescriptionStatic()
Definition: JITLoaderGDB.cpp:432
JITLoaderGDB::DebuggerInitialize
static void DebuggerInitialize(lldb_private::Debugger &debugger)
Definition: JITLoaderGDB.cpp:158
Process.h
JITLoaderGDB::DidSetJITBreakpoint
bool DidSetJITBreakpoint() const
Definition: JITLoaderGDB.cpp:453
JITLoaderGDB::JITDebugBreakpointHit
static bool JITDebugBreakpointHit(void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
Definition: JITLoaderGDB.cpp:219
lldb_private::ModuleList
Definition: ModuleList.h:71
JITLoaderGDB::GetPluginNameStatic
static lldb_private::ConstString GetPluginNameStatic()
Definition: JITLoaderGDB.cpp:407
JITLoaderGDB::Initialize
static void Initialize()
Definition: JITLoaderGDB.cpp:443
JITLoaderGDB::m_jit_objects
JITObjectMap m_jit_objects
Definition: JITLoaderGDB.h:74
lldb_private::ConstString
Definition: ConstString.h:40
JITLoaderGDB::ReadJITDescriptorImpl
bool ReadJITDescriptorImpl(bool all_entries)
Definition: JITLoaderGDB.cpp:283
lldb_private::Debugger
Definition: Debugger.h:70
JITLoaderGDB::m_jit_break_id
lldb::user_id_t m_jit_break_id
Definition: JITLoaderGDB.h:76
JITLoaderGDB::DidLaunch
void DidLaunch() override
Called after launching a process.
Definition: JITLoaderGDB.cpp:175
lldb::SymbolType
SymbolType
Symbol types.
Definition: lldb-enumerations.h:611
JITLoaderGDB::ModulesDidLoad
void ModulesDidLoad(lldb_private::ModuleList &module_list) override
Called after a new shared object has been loaded so that it can be probed for JIT entry point hooks.
Definition: JITLoaderGDB.cpp:181
uint32_t
lldb_private::JITLoader
Definition: JITLoader.h:27
JITLoaderGDB::ReadJITDescriptor
bool ReadJITDescriptor(bool all_entries)
Definition: JITLoaderGDB.cpp:275
JITLoader.h
JITLoaderGDB::JITObjectMap
std::map< lldb::addr_t, const lldb::ModuleSP > JITObjectMap
Definition: JITLoaderGDB.h:73
JITLoaderGDB
Definition: JITLoaderGDB.h:17
JITLoaderGDB::GetSymbolAddress
lldb::addr_t GetSymbolAddress(lldb_private::ModuleList &module_list, lldb_private::ConstString name, lldb::SymbolType symbol_type) const
Definition: JITLoaderGDB.cpp:457
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
JITLoaderGDB::GetPluginName
lldb_private::ConstString GetPluginName() override
Definition: JITLoaderGDB.cpp:437
JITLoaderGDB::JITLoaderGDB
JITLoaderGDB(lldb_private::Process *process)
Definition: JITLoaderGDB.cpp:148
JITLoaderGDB::DidAttach
void DidAttach() override
Called after attaching a process.
Definition: JITLoaderGDB.cpp:169
lldb::StateType
StateType
Process and Thread States.
Definition: lldb-enumerations.h:73
JITLoaderGDB::SetJITBreakpoint
void SetJITBreakpoint(lldb_private::ModuleList &module_list)
Definition: JITLoaderGDB.cpp:187
JITLoaderGDB::m_jit_descriptor_addr
lldb::addr_t m_jit_descriptor_addr
Definition: JITLoaderGDB.h:77