Dean Michael Berris via llvm-dev
2016-Sep-06 01:21 UTC
[llvm-dev] How to insert instructions before each function calls?
> On 5 Sep 2016, at 16:14, SHUCAI YAO <yaos4 at mcmaster.ca> wrote: > > > Hi Dean, > > Do you have any example for this? I would like have a look at how you handle this in XRay if it is possible. >Yes, this is all upstream -- if you look in lib/CodeGen/XRayInstrument.cpp and the associated lowering code for X86 in lib/Target/X86/X86MCInstLower.cpp and/or search for PATCHABLE_RET in include/... and lib/... then that should give you a better idea of how this works. :) Cheers -- Dean
SHUCAI YAO via llvm-dev
2016-Sep-19 15:39 UTC
[llvm-dev] How to insert instructions before each function calls?
Hi Dean, Thank you very much. I solved my problems by using the similar structure. BTW, I saw there is a hacky way to do the relative jump in function of LowerPATCHABLE_FUNCTION_ENTER. I think directional local symbol can implement it too: 1. t = getDirectionalLocalSymbol first; 2. jmp t 3. then emit nops 4. createDirectionalLocalSymbol(t) Hope it can help. Thank you! Shucai On Mon, Sep 5, 2016 at 9:21 PM, Dean Michael Berris <dean.berris at gmail.com> wrote:> > On 5 Sep 2016, at 16:14, SHUCAI YAO <yaos4 at mcmaster.ca> wrote: > > > > > > Hi Dean, > > > > Do you have any example for this? I would like have a look at how you > handle this in XRay if it is possible. > > > > Yes, this is all upstream -- if you look in lib/CodeGen/XRayInstrument.cpp > and the associated lowering code for X86 in lib/Target/X86/X86MCInstLower.cpp > and/or search for PATCHABLE_RET in include/... and lib/... then that should > give you a better idea of how this works. :) > > Cheers > > -- Dean > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160919/ca3d08eb/attachment.html>
Dean Michael Berris via llvm-dev
2016-Sep-20 13:58 UTC
[llvm-dev] How to insert instructions before each function calls?
> On 20 Sep 2016, at 01:39, SHUCAI YAO <yaos4 at mcmaster.ca> wrote: > > > Hi Dean, > > Thank you very much. I solved my problems by using the similar structure.Awesome -- happy to help!> > BTW, I saw there is a hacky way to do the relative jump in function of LowerPATCHABLE_FUNCTION_ENTER. I think directional local symbol can implement it too: > 1. t = getDirectionalLocalSymbol first; > 2. jmp t > 3. then emit nops > 4. createDirectionalLocalSymbol(t) > > Hope it can help. >Interesting. Thanks, I'll try that next time in that part of the woods again. :) Cheers -- Dean