This is an archive of the discontinued LLVM Phabricator instance.

[docs] Update DebuggingJITedCode page after fix in LLDB
ClosedPublic

Authored by sgraenitz on Nov 4 2020, 1:06 PM.

Details

Summary

Generalize the documentation to include both, GDB and LLDB. Add a link to the interface
definition. Make a note on MCJIT's restriction to ELF. Mention the regression and bugfix
in LLDB as well as the jit-loader setting for macOS. Update the command line session to
use LLDB instead of GDB.

Diff Detail

Event Timeline

sgraenitz created this revision.Nov 4 2020, 1:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 4 2020, 1:06 PM
sgraenitz requested review of this revision.Nov 4 2020, 1:06 PM

It's not really the fault of this change, but the gdb support isn't really restricted to mcjit. registerJITEventListener() works with RTDyld based Orc too.

Thanks for having a look.

That's right and it's on my wishlist. However, the example doesn't actually work with --jit-kind=orc-lazy (yet). On Linux it should use RTDyldObjectLinkingLayer and so it should notify LLDB when new code is loaded, but somehow it doesn't:

(lldb) run --jit-kind=orc-lazy showdebug.ll 5
Process 25021 launched: '/usr/bin/lli' (x86_64)
Process 25021 exited with status = 120 (0x00000078)

So far I haven't analyzed it in detail. My plan was to finish the ongoing work, update the docs, close PR36209 (finally) and schedule follow-up tasks once I find the time.

One issue with the orc-lazy JIT will be symbol renaming for lazy reexports: Upfront we only emit stubs for our function symbols and they trigger compilation of the actual code in a separate logical unit once they are called. The debug object we hand over to LLDB doesn't take that into account. (Maybe we are just inserting the wrong load address? Don't know.) Additionally, I am not sure how debug data is handled in the partitioning logic of the CompileOnDemandLayer.

If we had a orc-greedymode in lli, we could easily demonstrate debugging here (for RTDyld-based platforms) and we could also port quite a number of tests to OrcV2. Might be worth thinking about, but so far we have MCJIT for that and it still works.

Not sure any of this is worth noting in the docs?

Does anyone have objections to this documentation update? Preview is here still:
https://weliveindetail.github.io/docs-pub/html/DebuggingJITedCode.html

I'd like to land this before release 12 branches. If you have any objections, please speak up before the end of the week. Thanks.

lhames accepted this revision.Jan 11 2021, 2:44 PM

Belatedly -- LGTM.

I think an orc-greedy mode for LLI sounds like a great idea. Also, once we have it we should probably make it the default mode instead of MCJIT.

This revision is now accepted and ready to land.Jan 11 2021, 2:44 PM
This revision was landed with ongoing or failed builds.Jan 14 2021, 6:45 AM
This revision was automatically updated to reflect the committed changes.

Thanks! Eventually, I closed https://llvm.org/PR36209