I am writing a front end for a new language and am having trouble generating the DWARF debugging information. I'm outputting llvm assembly source so I'm trying to generate the "!metadata" stuff. I have found the document <http://llvm.org/docs/SourceLevelDebugging.html> a helpful start, as far as it goes. However, it doesn't quite match what I see clang produce when I use the flags "clang -g -S -emit-llvm ..." in all cases. And it is incomplete, for example, how does one deal with a function that returns multiple values? I seem to get different results when I feed the .ll file to llc than when I feed it the clang, clang gives error messages when it doesn't like the metadata structure, llc appears not to do so. Is there another document I should look at? Should I be looking at source code? Where are the structures that start with DW_TAG's parsed? In general, what's resources does a front end implementer have in order to understand how to generate the DWARF stuff via llvm assembly source? thanks, bagel
On Dec 3, 2010, at 2:39 PM, Bagel wrote:> I am writing a front end for a new language and am having trouble generating > the DWARF debugging information. I'm outputting llvm assembly source so I'm > trying to generate the "!metadata" stuff. > > I have found the document <http://llvm.org/docs/SourceLevelDebugging.html> a > helpful start, as far as it goes. However, it doesn't quite match what I see > clang produce when I use the flags "clang -g -S -emit-llvm ..." in all cases. > And it is incomplete, for example, how does one deal with a function that > returns multiple values? > > I seem to get different results when I feed the .ll file to llc than when I > feed it the clang, clang gives error messages when it doesn't like the metadata > structure, llc appears not to do so. > > Is there another document I should look at? > > Should I be looking at source code? Where are the structures that start with > DW_TAG's parsed? > > In general, what's resources does a front end implementer have in order to > understand how to generate the DWARF stuff via llvm assembly source?We are working on a document. Here is current draft: http://wiki.llvm.org/Debug_Information - Devang
On 4 December 2010 00:28, Devang Patel <dpatel at apple.com> wrote:> We are working on a document. Here is current draft: > http://wiki.llvm.org/Debug_InformationHi Devang, Do you think we should keep updating the wiki or in the HTML? Do we need this doc to be in the release docs? cheers, --renato
On 12/03/2010 06:28 PM, Devang Patel wrote:> We are working on a document. Here is current draft: > http://wiki.llvm.org/Debug_Information > > - > DevangWhile this is great news, it doesn't completely satisfy my needs. Your documentation assumes one is going to use the LLVM provided functions (such as DIFactory::). My front-end can't use them because it is not written in C or C++. I need to know the exact layouts of the LLVM assembly metadata -- the textual form -- and what the fields mean. The comments in your examples are close. Perhaps you can add another section just on the textual format? thanks, bagel