[PATCH] D96627: [llvm-jitlink] Implement JITLoaderGDB ObjectLinkingLayer plugin for ELF x86-64

Stefan Gränitz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 12 12:27:28 PST 2021


sgraenitz created this revision.
sgraenitz added reviewers: lhames, dblaikie.
Herald added subscribers: pengfei, hiraditya, mgorny.
sgraenitz requested review of this revision.
Herald added a project: LLVM.

First proposal for debugging support in JITLink. For now, only in-process x86-64 ELF. Please consider it a work-in-progress.

The JITLinkGDBLoaderPlugin forwards object files from ObjectLinkingLayer to an attached debugger through the GDB JIT Interface [1]. It implements ObjectLinkingLayer::Plugin::notifyLoaded() and expects an additional argument: a callback function that prepares a in-memory debug object for the given MaterializationResponsibility on request. The patch aims to keep overhead in generic execution paths minimal. Additional efforts for debug registration should reside in the callback.

Furthermore, responsibility for the preparation of the actual debug object buffer lies with the respective JITLink backend, so we can keep all format/architecture-specific code in one place. In this first sketch it's accomplished with another callback from linkPhase1 to the backend. While the JITLinkContext might be considered the natural owner of the function pointer, it is currently stored in the LinkGraph, because this is our only connection to the backend. The goal was to keep patch small and seek feedback first.

[1] https://sourceware.org/gdb/current/onlinedocs/gdb/JIT-Interface.html


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96627

Files:
  llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/LLJITWithObjectLinkingLayerPlugin.cpp
  llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h
  llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
  llvm/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
  llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
  llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp
  llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.h
  llvm/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp
  llvm/tools/llvm-jitlink/CMakeLists.txt
  llvm/tools/llvm-jitlink/llvm-jitlink-gdb-loader.cpp
  llvm/tools/llvm-jitlink/llvm-jitlink-gdb-loader.h
  llvm/tools/llvm-jitlink/llvm-jitlink.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96627.323448.patch
Type: text/x-patch
Size: 21010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210212/a9071a1d/attachment.bin>


More information about the llvm-commits mailing list