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

Joerg Sonnenberger via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 2 05:56:22 PST 2017


On Thu, Mar 02, 2017 at 12:28:34PM +0100, Vivien Millet via llvm-dev wrote:
> 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.

(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


More information about the llvm-dev mailing list