xref: /llvm-project/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h (revision 1fe64fe04687e5c95c33be9abac921cdd2a8e2ff)
1 //===- JITLoaderGDB.h - Register objects via GDB JIT interface -*- 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 // Register objects for access by debuggers via the GDB JIT interface.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_JITLOADERGDB_H
14 #define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_JITLOADERGDB_H
15 
16 #include "llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h"
17 #include "llvm/Support/Compiler.h"
18 #include <cstdint>
19 
20 // Keep in sync with gdb/gdb/jit.h
21 extern "C" {
22 
23 typedef enum {
24   JIT_NOACTION = 0,
25   JIT_REGISTER_FN,
26   JIT_UNREGISTER_FN
27 } jit_actions_t;
28 
29 struct jit_code_entry {
30   struct jit_code_entry *next_entry;
31   struct jit_code_entry *prev_entry;
32   const char *symfile_addr;
33   uint64_t symfile_size;
34 };
35 
36 struct jit_descriptor {
37   uint32_t version;
38   // This should be jit_actions_t, but we want to be specific about the
39   // bit-width.
40   uint32_t action_flag;
41   struct jit_code_entry *relevant_entry;
42   struct jit_code_entry *first_entry;
43 };
44 }
45 
46 extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
47 llvm_orc_registerJITLoaderGDBWrapper(const char *Data, uint64_t Size);
48 
49 extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
50 llvm_orc_registerJITLoaderGDBAllocAction(const char *Data, size_t Size);
51 
52 #endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_JITLOADERGDB_H
53