[llvm-dev] clang dwarf

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] clang dwarf

Robin Eklind via llvm-dev
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

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] clang dwarf

Robin Eklind via llvm-dev

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:[hidden email]] 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


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev