[llvm-dev] Dumping debug information from BC files

via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 18 00:04:23 PST 2018

Thank you for your reply.

When I'm running "llvm-readobj" on an .obj file I get a result like shown 
in my attachment. This is very easy to read. I don't know if this is the 
codeview format. I would like to get this kind of debug information form a 
.bc file too, because I JIT them and wanted to try to build a debugger. 
With the file from "llvm-readobj" I see no problem - but when using the 
metadata I have no clue how to find variables on the stack - there are 
only this intrinsics, but I don't know how to handle them. 
Maybe I asked the wrong question :/

From:   Reid Kleckner <rnk at google.com>
To:     陳韋任 <chenwj.cs97g at g2.nctu.edu.tw>
Cc:     bjoern.gaier at horiba.com, LLVM Developers Mailing List 
<llvm-dev at lists.llvm.org>
Date:   17.01.2018 18:29
Subject:        Re: [llvm-dev] Dumping debug information from BC files

The debug information is actually still in a different format in the .bc 
file, it is LLVM metadata. I think the best reference for it is here: 

You can dump it just by disassembling the .bc file to textual IR using 
llvm-dis and examining the !DI* metadata nodes. You will have to run the 
file through llc to generate an object file to generate actual CodeView or 

On Wed, Jan 17, 2018 at 5:09 AM, 陳韋任 via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
3.) Then I used clang-cl to generate a .bc file - but now I'm not able to 
use "llvm-readobj" anymore. Is there any tool available which can dump 
this debug information too? 

​.bc is LLVM bitcode [1], not the usual object file. `llvm-readobj` 
should works only on the latter.

​[1] https://llvm.org/docs/BitCodeFormat.html

Wei-Ren Chen (陳韋任)
Homepage: https://people.cs.nctu.edu.tw/~chenwj

LLVM Developers mailing list
llvm-dev at lists.llvm.org

Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, 
USt.ID-Nr. DE 114 165 789
Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, 
Heiko Lampert, Hiroshi Kawamura, Takashi Nagano, Takeshi Fukushima.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180118/a0040c14/attachment.html>

More information about the llvm-dev mailing list