[llvm] Revisit advanced LLJIT examples and tests (PR #76236)
Stefan Gränitz via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 22 07:43:24 PST 2023
================
@@ -112,6 +112,44 @@ int openListener(std::string Host, std::string PortStr) {
#endif // LLVM_ON_UNIX
}
+// This must be kept in sync with gdb/gdb/jit.h .
+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 should be jit_actions_t, but we want to be specific about the
+ // bit-width.
+ uint32_t action_flag;
+ struct jit_code_entry *relevant_entry;
+ struct jit_code_entry *first_entry;
+};
+
+// We put information about the JITed function in this global, which the
+// debugger reads. Make sure to specify the version statically, because the
+// debugger checks the version before we can set it during runtime.
+extern struct jit_descriptor __jit_debug_descriptor;
+
+static void *findLastDebugDescriptorEntryPtr() {
+ struct jit_code_entry *Last = __jit_debug_descriptor.first_entry;
+ while (Last && Last->next_entry)
+ Last = Last->next_entry;
+ return Last;
+}
+}
+
----------------
weliveindetail wrote:
This is the forth copy across LLVM and it's time to deduplicate. I will move it into `llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h` in an isolated NFC to bring it back to 2 (OrcTargetProcess and legacy ExecutionEngine).
https://github.com/llvm/llvm-project/pull/76236
More information about the llvm-commits
mailing list