[llvm-dev] About Stackmap section

Philip Reames via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 12 12:03:18 PDT 2015


On 08/09/2015 07:43 AM, marwayusuf at feng.bu.edu.eg via llvm-dev wrote:
>
> Dear All
>
> I need to read the stackmap section at runtime of the inspected 
> application. I've read the documentation of stackmap and found this 
> paragraph:
>
> "A JIT compiler can easily access this section by providing its own 
> memory manager via the LLVM C APILLVMCreateSimpleMCJITMemoryManager(). 
> When creating the memory manager, the JIT provides a 
> callback:LLVMMemoryManagerAllocateDataSectionCallback(). When LLVM 
> creates this section, it invokes the callback and passes the section 
> name. The JIT can record the in-memory address of the section at this 
> time and later parse it to recover the stack map data.
>
> On Darwin, the stack map section name is “__llvm_stackmaps”. The 
> segment name is “__LLVM_STACKMAPS”."
>
> However I can't figure how to make LLVMCreateSimpleMCJITMemoryManager 
> or LLVMMemoryManagerAllocateDataSectionCallback or make use of them. 
> And I could not find examples for their useage. Any help is appreciated.
>
I'm going to completely ignore the C API because I'm not familiar with 
it, but the ideas should map over.

You need to create a custom MCJIT memory manager object which implements 
the "allocateDataSection" method on "SectionMemoryManager" such that it 
captures information about the section being created when actually doing 
the allocation.  If you're relocating sections, you'll also need to 
track this through mapSectionAddress.  If you save information about the 
relevant section in a side structure, you can use the in tree stack map 
parser to decode the section.

Hope that helps.

Philip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150812/1ef3524e/attachment.html>


More information about the llvm-dev mailing list