[llvm][debug][jit] llvm-project debug jit-ed code

Hello Alex, I am adding llvm-dev (cc) as other people might have similar questions.

If I understand correctly, debugging works with lli if you follow the instructions from That’s a good first step, because now the only question is what’s the difference between lli and your code in main.cpp. From what you describe I don’t see an obvious problem. You say debugging main.cpp itself works fine. Here’s a few things you can try to narrow down the problem: * Set a breakpoint in the constructor of MCJIT and make sure RegisterJITEventListener() is called. * Set a breakpoint in GDBJITRegistrationListener::notifyObjectLoaded() and check that the call to getObjectForDebug() returns a non-null result. * Enable logging for the JIT interface in LLDB and check that you get output like this: (lldb) b my_func Breakpoint 1: no locations (pending). WARNING: Unable to resolve breakpoint to any actual locations. (lldb) log enable lldb jit (lldb) run JITLoaderGDB::SetJITBreakpoint looking for JIT register hook JITLoaderGDB::SetJITBreakpoint setting JIT breakpoint Process 46448 launched: ‘/path/to/main’ (x86_64) JITLoaderGDB::JITDebugBreakpointHit hit JIT breakpoint JITLoaderGDB::ReadJITDescriptorImpl registering JIT entry at 0x10e019830 (2872 bytes) 1 location added to breakpoint 1 Does that help? Best Stefan