[llvm-dev] clang dwarf

via llvm-dev llvm-dev at lists.llvm.org
Wed May 16 06:13:01 PDT 2018


If you compile your program with `-gline-tables-only` the IR will contain metadata for source locations, and the instructions will have references to the metadata.  The IR representation isn't actually DWARF, but it should have the information you want.
Of course `-g` will also have the source-location information, but also a lot of other debugging information that you probably do not want, and so for your purposes that would bloat the IR for no benefit.
--paulr

From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Muhui Jiang via llvm-dev
Sent: Wednesday, May 16, 2018 3:59 AM
To: llvm-dev
Subject: [llvm-dev] clang dwarf

Hi

I am building the llvm IR to generate the control flow graph. I am using autotools(configure, make) to compile my whole program. I use the -save-temps option to save the llvm IR. Now I would like to generate a control flow graph on binary level. I may need the dwarf information to know the mapping between source code and binary code. Besides, I may also need to know the relationship between llvm IR and the source code. Thus, I can translate the control flow graph that I extracted with a pass on LLVM IR to a binary level control flow graph.

Does anyone has some suggestions or comments? Many Thanks

Regards
Muhui
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180516/9ce717eb/attachment.html>


More information about the llvm-dev mailing list