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
15#include "lldb/Target/Process.h"
16
18public:
20
21 ~JITLoaderGDB() override;
22
23 // Static Functions
24 static void Initialize();
25
26 static void Terminate();
27
28 static llvm::StringRef GetPluginNameStatic() { return "gdb"; }
29
30 static llvm::StringRef GetPluginDescriptionStatic();
31
33 bool force);
34
35 static void DebuggerInitialize(lldb_private::Debugger &debugger);
36
37 // PluginInterface protocol
38 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
39
40 // JITLoader interface
41 void DidAttach() override;
42
43 void DidLaunch() override;
44
45 void ModulesDidLoad(lldb_private::ModuleList &module_list) override;
46
47private:
50 lldb::SymbolType symbol_type) const;
51
53
54 bool DidSetJITBreakpoint() const;
55
56 bool ReadJITDescriptor(bool all_entries);
57
58 template <typename ptr_t> bool ReadJITDescriptorImpl(bool all_entries);
59
60 static bool
61 JITDebugBreakpointHit(void *baton,
63 lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
64
65 static void ProcessStateChangedCallback(void *baton,
66 lldb_private::Process *process,
67 lldb::StateType state);
68
69 // A collection of in-memory jitted object addresses and their corresponding
70 // modules
71 typedef std::map<lldb::addr_t, const lldb::ModuleSP> JITObjectMap;
73
76};
77
78#endif // LLDB_SOURCE_PLUGINS_JITLOADER_GDB_JITLOADERGDB_H
JITObjectMap m_jit_objects
Definition: JITLoaderGDB.h:72
lldb::addr_t m_jit_descriptor_addr
Definition: JITLoaderGDB.h:75
lldb::addr_t GetSymbolAddress(lldb_private::ModuleList &module_list, lldb_private::ConstString name, lldb::SymbolType symbol_type) const
static void Terminate()
static void Initialize()
bool ReadJITDescriptor(bool all_entries)
std::map< lldb::addr_t, const lldb::ModuleSP > JITObjectMap
Definition: JITLoaderGDB.h:71
~JITLoaderGDB() override
static lldb::JITLoaderSP CreateInstance(lldb_private::Process *process, bool force)
bool ReadJITDescriptorImpl(bool all_entries)
static void DebuggerInitialize(lldb_private::Debugger &debugger)
static llvm::StringRef GetPluginNameStatic()
Definition: JITLoaderGDB.h:28
static llvm::StringRef GetPluginDescriptionStatic()
bool DidSetJITBreakpoint() const
static bool JITDebugBreakpointHit(void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
lldb::user_id_t m_jit_break_id
Definition: JITLoaderGDB.h:74
static void ProcessStateChangedCallback(void *baton, lldb_private::Process *process, lldb::StateType state)
void DidLaunch() override
Called after launching a process.
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.
void DidAttach() override
Called after attaching a process.
void SetJITBreakpoint(lldb_private::ModuleList &module_list)
llvm::StringRef GetPluginName() override
Definition: JITLoaderGDB.h:38
A uniqued constant string class.
Definition: ConstString.h:40
A class to manage flag bits.
Definition: Debugger.h:80
A plug-in interface definition class for JIT loaders.
Definition: JITLoader.h:27
A collection class for Module objects.
Definition: ModuleList.h:103
A plug-in interface definition class for debugging a process.
Definition: Process.h:341
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
StateType
Process and Thread States.
SymbolType
Symbol types.
uint64_t user_id_t
Definition: lldb-types.h:82
uint64_t addr_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::JITLoader > JITLoaderSP
Definition: lldb-forward.h:361