[LLVMdev] how to map binary code with LLVM IR

Duncan Sands baldrick at free.fr
Thu Jan 24 01:09:10 PST 2013


Hi Linhai,

> Hi,
>
>     I have some applications, which have been compiled into llvm IR and then
> linked into executable programs. I have some static information got from
> analysing llvm IR, and some dynamic information, like which binary branch is
> taken, from hardware sampler. I am wondering whether there are some ways to map
> binary code with LLVM IR. The only way I know is to use debug info, since both
> llvm IR and binary code can be mapped to source code. I feel this method is not
> precise. Are there some other methods?

I think you should use debug info, however you aren't obliged to use debug info
coming from the original language source code: you could create artificial debug
info from the IR file.  For example for each instruction in the IR file, you
attach debug info to it that says that the "file" is the given IR file, the
"function" is the function the instruction is in, and the "line" is the line
within the IR file of the instruction.

Ciao, Duncan.




More information about the llvm-dev mailing list