forked from jeremy-rifkin/cpptrace
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgdb_jit.hpp
More file actions
53 lines (45 loc) · 1.39 KB
/
gdb_jit.hpp
File metadata and controls
53 lines (45 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef CPPTRACE_GDB_JIT_HPP
#define CPPTRACE_GDB_JIT_HPP
#include <cpptrace/basic.hpp>
#include <cstdint>
CPPTRACE_BEGIN_NAMESPACE
namespace detail {
// https://sourceware.org/gdb/current/onlinedocs/gdb.html/JIT-Interface.html
extern "C" {
typedef enum
{
JIT_NOACTION = 0,
JIT_REGISTER_FN,
JIT_UNREGISTER_FN
} jit_actions_t;
struct jit_code_entry
{
struct jit_code_entry *next_entry;
struct jit_code_entry *prev_entry;
const char *symfile_addr;
uint64_t symfile_size;
};
struct jit_descriptor
{
uint32_t version;
/* This type should be jit_actions_t, but we use uint32_t
to be explicit about the bitwidth. */
uint32_t action_flag;
struct jit_code_entry *relevant_entry;
struct jit_code_entry *first_entry;
};
extern struct jit_descriptor __jit_debug_descriptor;
}
}
namespace experimental {
inline void register_jit_objects_from_gdb_jit_interface() {
clear_all_jit_objects();
detail::jit_code_entry* entry = detail::__jit_debug_descriptor.first_entry;
while(entry) {
register_jit_object(entry->symfile_addr, entry->symfile_size);
entry = entry->next_entry;
}
}
}
CPPTRACE_END_NAMESPACE
#endif