File tree Expand file tree Collapse file tree 5 files changed +36
-111
lines changed
include/llvm/ExecutionEngine/Orc/TargetProcess
lib/ExecutionEngine/Orc/TargetProcess
llvm-jitlink/llvm-jitlink-executor
unittests/ExecutionEngine/Orc Expand file tree Collapse file tree 5 files changed +36
-111
lines changed Original file line number Diff line number Diff line change 16
16
#include " llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h"
17
17
#include < cstdint>
18
18
19
+ // Keep in sync with gdb/gdb/jit.h
20
+ extern " C" {
21
+
22
+ typedef enum {
23
+ JIT_NOACTION = 0 ,
24
+ JIT_REGISTER_FN,
25
+ JIT_UNREGISTER_FN
26
+ } jit_actions_t ;
27
+
28
+ struct jit_code_entry {
29
+ struct jit_code_entry *next_entry;
30
+ struct jit_code_entry *prev_entry;
31
+ const char *symfile_addr;
32
+ uint64_t symfile_size;
33
+ };
34
+
35
+ struct jit_descriptor {
36
+ uint32_t version;
37
+ // This should be jit_actions_t, but we want to be specific about the
38
+ // bit-width.
39
+ uint32_t action_flag;
40
+ struct jit_code_entry *relevant_entry;
41
+ struct jit_code_entry *first_entry;
42
+ };
43
+ }
44
+
19
45
extern " C" llvm::orc::shared::CWrapperFunctionResult
20
46
llvm_orc_registerJITLoaderGDBWrapper (const char *Data, uint64_t Size);
21
47
Original file line number Diff line number Diff line change 21
21
// First version as landed in August 2009
22
22
static constexpr uint32_t JitDescriptorVersion = 1 ;
23
23
24
- // Keep in sync with gdb/gdb/jit.h
25
24
extern " C" {
26
25
27
- typedef enum {
28
- JIT_NOACTION = 0 ,
29
- JIT_REGISTER_FN,
30
- JIT_UNREGISTER_FN
31
- } jit_actions_t ;
32
-
33
- struct jit_code_entry {
34
- struct jit_code_entry *next_entry;
35
- struct jit_code_entry *prev_entry;
36
- const char *symfile_addr;
37
- uint64_t symfile_size;
38
- };
39
-
40
- struct jit_descriptor {
41
- uint32_t version;
42
- // This should be jit_actions_t, but we want to be specific about the
43
- // bit-width.
44
- uint32_t action_flag;
45
- struct jit_code_entry *relevant_entry;
46
- struct jit_code_entry *first_entry;
47
- };
48
-
49
26
// We put information about the JITed function in this global, which the
50
27
// debugger reads. Make sure to specify the version statically, because the
51
28
// debugger checks the version before we can set it during runtime.
Original file line number Diff line number Diff line change 8
8
9
9
#include " ExecutionUtils.h"
10
10
11
+ #include " llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h"
11
12
#include " llvm/Support/FileSystem.h"
12
13
#include " llvm/Support/FormatVariadic.h"
13
14
#include " llvm/Support/raw_ostream.h"
14
15
15
16
#include < cstdint>
16
17
#include < vector>
17
18
18
- // Declarations follow the GDB JIT interface (version 1, 2009) and must match
19
- // those of the DYLD used for testing. See:
20
- //
21
- // llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
22
- // llvm/lib/ExecutionEngine/GDBRegistrationListener.cpp
23
- //
24
- typedef enum {
25
- JIT_NOACTION = 0 ,
26
- JIT_REGISTER_FN,
27
- JIT_UNREGISTER_FN
28
- } jit_actions_t ;
29
-
30
- struct jit_code_entry {
31
- struct jit_code_entry *next_entry;
32
- struct jit_code_entry *prev_entry;
33
- const char *symfile_addr;
34
- uint64_t symfile_size;
35
- };
36
-
37
- struct jit_descriptor {
38
- uint32_t version;
39
- // This should be jit_actions_t, but we want to be specific about the
40
- // bit-width.
41
- uint32_t action_flag;
42
- struct jit_code_entry *relevant_entry;
43
- struct jit_code_entry *first_entry;
44
- };
45
-
46
19
namespace llvm {
47
20
48
21
template <typename ... Ts> static void outsv (const char *Fmt, Ts &&...Vals) {
@@ -61,6 +34,9 @@ static const char *actionFlagToStr(uint32_t ActionFlag) {
61
34
return " <invalid action_flag>" ;
62
35
}
63
36
37
+ // Declarations follow the GDB JIT interface (version 1, 2009) and must match
38
+ // those of the DYLD used for testing.
39
+ //
64
40
// Sample output:
65
41
//
66
42
// Reading __jit_debug_descriptor at 0x0000000000404048
Original file line number Diff line number Diff line change @@ -112,43 +112,16 @@ int openListener(std::string Host, std::string PortStr) {
112
112
#endif // LLVM_ON_UNIX
113
113
}
114
114
115
- // This must be kept in sync with gdb/gdb/jit.h .
116
- extern " C" {
117
-
118
- typedef enum {
119
- JIT_NOACTION = 0 ,
120
- JIT_REGISTER_FN,
121
- JIT_UNREGISTER_FN
122
- } jit_actions_t ;
123
-
124
- struct jit_code_entry {
125
- struct jit_code_entry *next_entry;
126
- struct jit_code_entry *prev_entry;
127
- const char *symfile_addr;
128
- uint64_t symfile_size;
129
- };
130
-
131
- struct jit_descriptor {
132
- uint32_t version;
133
- // This should be jit_actions_t, but we want to be specific about the
134
- // bit-width.
135
- uint32_t action_flag;
136
- struct jit_code_entry *relevant_entry;
137
- struct jit_code_entry *first_entry;
138
- };
139
-
140
- // We put information about the JITed function in this global, which the
141
- // debugger reads. Make sure to specify the version statically, because the
142
- // debugger checks the version before we can set it during runtime.
143
- extern struct jit_descriptor __jit_debug_descriptor;
115
+ // JITLink debug support plugins put information about JITed code in this GDB
116
+ // JIT Interface global from OrcTargetProcess.
117
+ extern " C" struct jit_descriptor __jit_debug_descriptor;
144
118
145
119
static void *findLastDebugDescriptorEntryPtr () {
146
120
struct jit_code_entry *Last = __jit_debug_descriptor.first_entry ;
147
121
while (Last && Last->next_entry )
148
122
Last = Last->next_entry ;
149
123
return Last;
150
124
}
151
- }
152
125
153
126
int main (int argc, char *argv[]) {
154
127
#if LLVM_ENABLE_THREADS
Original file line number Diff line number Diff line change @@ -512,43 +512,16 @@ TEST_F(OrcCAPITestBase, AddObjectBuffer) {
512
512
ASSERT_TRUE (!!SumAddr);
513
513
}
514
514
515
- // This must be kept in sync with gdb/gdb/jit.h .
516
- extern " C" {
517
-
518
- typedef enum {
519
- JIT_NOACTION = 0 ,
520
- JIT_REGISTER_FN,
521
- JIT_UNREGISTER_FN
522
- } jit_actions_t ;
523
-
524
- struct jit_code_entry {
525
- struct jit_code_entry *next_entry;
526
- struct jit_code_entry *prev_entry;
527
- const char *symfile_addr;
528
- uint64_t symfile_size;
529
- };
530
-
531
- struct jit_descriptor {
532
- uint32_t version;
533
- // This should be jit_actions_t, but we want to be specific about the
534
- // bit-width.
535
- uint32_t action_flag;
536
- struct jit_code_entry *relevant_entry;
537
- struct jit_code_entry *first_entry;
538
- };
539
-
540
- // We put information about the JITed function in this global, which the
541
- // debugger reads. Make sure to specify the version statically, because the
542
- // debugger checks the version before we can set it during runtime.
543
- extern struct jit_descriptor __jit_debug_descriptor;
515
+ // JITLink debug support plugins put information about JITed code in this GDB
516
+ // JIT Interface global from OrcTargetProcess.
517
+ extern " C" struct jit_descriptor __jit_debug_descriptor;
544
518
545
519
static void *findLastDebugDescriptorEntryPtr () {
546
520
struct jit_code_entry *Last = __jit_debug_descriptor.first_entry ;
547
521
while (Last && Last->next_entry )
548
522
Last = Last->next_entry ;
549
523
return Last;
550
524
}
551
- }
552
525
553
526
#if defined(_AIX) or not(defined(__ELF__) or defined(__MACH__))
554
527
TEST_F (OrcCAPITestBase, DISABLED_EnableDebugSupport) {
You can’t perform that action at this time.
0 commit comments