[LLVM::IR] How to retrieve llvm::Instruction address after JIT code generation?

Hi LLVM developers,

I’ve posted yesterday a question on StackOverflow here :

http://stackoverflow.com/questions/42544386/how-to-retrieve-llvminstruction-address-after-jit-code-generation

Is someone knowing the answer ? I would really like to be able to insert manually “int 3” in the generated assembly to add my own JIT software breakpoints.

Thank you !

Sincerely,

Vivien

(1) Please post your actual question, not just a link to SO.
(2) No, this is generally not possible. LLVM IR doesn't have a 1:1
mapping to assembler and with optimisation, instructions can disappear
or be merged with others. By the nature of SSA, the order of
instructions even within a Basic Block is often not even defined.

You can create debug traps using intrinsics directly.

Joerg

Sorry for posting the SO question but it seems other people are curious of the answer to that question, and i hoped someone would answer there.

Anyway thank you for your answer !

If I can’t do it that way, I have an alternate question :

Is there a way to retrieve assembly memory address from a llvm::DebugLoc after MCJIT code generation ?
(I guessed it could be possible because GDB can be used with MCJIT)

Thanks!

Vivien

PS: i haven’t got the reply in my mailbox but had to retrieve it in the llvm-dev google group, how can I receive a reply on my mailbox directly ?