Bill O'Hara
2010-Jul-06 22:07 UTC
[LLVMdev] simple way to print disassembly of final code from jit?
Hi, With the new llvm-mc code for disassembling, what is the recommended way to disassemble the final code produced by a JIT compiler backend? (Eg. in the toy.cpp example from the tutorial). I can get the void* for the final code, but I don't know its length - superficially at least it appears I need to know the length to disassemble it as a buffer? Thanks b.
Reid Kleckner
2010-Jul-07 03:41 UTC
[LLVMdev] simple way to print disassembly of final code from jit?
If you're on a recent flavor of Linux, you may be able to just go into gdb and type "disas <pointer-to-JITed-code>". More detail here: http://llvm.org/docs/DebuggingJITedCode.html If you still want to do it programmatically, I think you might be stuck. IIRC the length known by the JIT memory allocator is an overestimate (it's rounded up for alignment), so the disassembler will hit garbage at the end. Reid On Tue, Jul 6, 2010 at 3:07 PM, Bill O'Hara <billtohara at gmail.com> wrote:> Hi, > > With the new llvm-mc code for disassembling, what is the recommended > way to disassemble the final code produced by a JIT compiler backend? > (Eg. in the toy.cpp example from the tutorial). > > I can get the void* for the final code, but I don't know its length - > superficially at least it appears I need to know the length to > disassemble it as a buffer? > > Thanks > b. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Bill O'Hara
2010-Jul-07 04:40 UTC
[LLVMdev] simple way to print disassembly of final code from jit?
Thanks Reid - I'm on Windows. I guess I just assumed I was missing something obvious in how to hook up the JIT and disassembler! Given the nice looking disassembly code I found, I thought people would be doing it all the time :-) b. On Tue, Jul 6, 2010 at 8:41 PM, Reid Kleckner <reid.kleckner at gmail.com> wrote:> If you're on a recent flavor of Linux, you may be able to just go into > gdb and type "disas <pointer-to-JITed-code>". More detail here: > http://llvm.org/docs/DebuggingJITedCode.html > > If you still want to do it programmatically, I think you might be > stuck. IIRC the length known by the JIT memory allocator is an > overestimate (it's rounded up for alignment), so the disassembler will > hit garbage at the end. > > Reid > > On Tue, Jul 6, 2010 at 3:07 PM, Bill O'Hara <billtohara at gmail.com> wrote: >> Hi, >> >> With the new llvm-mc code for disassembling, what is the recommended >> way to disassemble the final code produced by a JIT compiler backend? >> (Eg. in the toy.cpp example from the tutorial). >> >> I can get the void* for the final code, but I don't know its length - >> superficially at least it appears I need to know the length to >> disassemble it as a buffer? >> >> Thanks >> b. >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >
Reasonably Related Threads
- [LLVMdev] simple way to print disassembly of final code from jit?
- [LLVMdev] simple way to print disassembly of final code from jit?
- [LLVMdev] simple way to print disassembly of final code from jit?
- [LLVMdev] simple way to print disassembly of final code from jit?
- [LLVMdev] disassembly/decompiling