1#include <inttypes.h>
2
3// GDB JIT interface
4enum JITAction { JIT_NOACTION, JIT_REGISTER_FN, JIT_UNREGISTER_FN };
5
6struct JITCodeEntry
7{
8 struct JITCodeEntry* next;
9 struct JITCodeEntry* prev;
10 const char *symfile_addr;
11 uint64_t symfile_size;
12};
13
14struct JITDescriptor
15{
16 uint32_t version;
17 uint32_t action_flag;
18 struct JITCodeEntry* relevant_entry;
19 struct JITCodeEntry* first_entry;
20};
21
22struct JITDescriptor __jit_debug_descriptor = { 1, JIT_NOACTION, 0, 0 };
23
24void __jit_debug_register_code()
25{
26}
27// end GDB JIT interface
28
29struct JITCodeEntry entry;
30
31int main()
32{
33 // Create a code entry with a bogus size
34 entry.next = entry.prev = 0;
35 entry.symfile_addr = (char *)&entry;
36 entry.symfile_size = (uint64_t)47<<32;
37
38 __jit_debug_descriptor.relevant_entry = __jit_debug_descriptor.first_entry = &entry;
39 __jit_debug_descriptor.action_flag = JIT_REGISTER_FN;
40
41 __jit_debug_register_code();
42
43 return 0;
44}
45

source code of lldb/test/API/functionalities/jitloader_gdb/main.c