[ORC][LLJIT] Add LLJITBuilder convenience function to enable debugger support.
authorLang Hames <lhames@gmail.com>
Sun, 16 Apr 2023 19:14:15 +0000 (12:14 -0700)
committerLang Hames <lhames@gmail.com>
Sun, 16 Apr 2023 19:23:33 +0000 (12:23 -0700)
commit21b5ebd245c88c81fe09248c7dce5cc3e0e56cae
treed9f6e05fefdce35d43a79e616224ca3774a51f78
parentad74adbd33c0df4da6a5922f4925234c738eea3a
[ORC][LLJIT] Add LLJITBuilder convenience function to enable debugger support.

Clients can now call LLJITBuilder::setEnableDebuggerSupport to enable
registration of debug info via the GDB-JIT registration protocol for JIT'd
code.

Calling LLJITBuilder::setEnableDebuggerSupport(true) will cause LLJITBuilder to
add either a DebugObjectManagerPlugin (if the object format on the triple is
ELF), or a GDBJITDebugInfoRegistrationPlugin (if the object format on the
triple is MachO). At present there is no support for debugging when using COFF.

This debugger registration support will only work when JITLink is used as the
underlying JIT linker.

This patch only addresses registration of JIT'd code by the JIT. To debug JIT'd
code you may also need to enable JIT'd code debugging in your debugger. E.g.
when debugging MachO JIT'd code under LLDB you will currently need to run
(lldb) set set plugin.jit-loader.gdb.enable on
to tell LLDB to listen for JIT'd code registration.
llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
llvm/tools/lli/lli.cpp