[llvm-dev] [assembler + debuginfo] interaction with .file directive and debuginfo

Brian Cain via llvm-dev llvm-dev at lists.llvm.org
Fri Aug 24 09:26:59 PDT 2018


gcc as of 4.2.4 generates the debuginfo even with “.file” (as did clang 6.0.0).  I’ll check a modern gcc.

 

From: David Blaikie <dblaikie at gmail.com> 
Sent: Friday, August 24, 2018 11:10 AM
To: paul.robinson at sony.com
Cc: bcain at codeaurora.org; llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] [assembler + debuginfo] interaction with .file directive and debuginfo

 

What does gcc do?

 

On Fri, Aug 24, 2018 at 9:05 AM via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > wrote:

There are two forms of the .file directive.  One is simply

               .file "path"

and the other is

               .file <file-number> [ "dir"] "path" [ …. other stuff ]

 

The latter is sometimes referred to as the "DWARF" form of the .file directive.  I don't know the history about the different forms. I have certainly messed with the latter form to accommodate the needs of DWARF v5.

 

I think it's pretty certain that the DWARF form of .file means that the .s file was generated with debug info, and therefore the correct behavior of "clang –g foo.s" in that case is to ignore the –g and assume the assembler source has all the right stuff.

 

If the older form of .file can mean nothing more than "emit a file symbol" and not imply that the assembler source file itself already contains debug info, then seeing that form should not cause the assembler to ignore –g.  But as I said, I don't know the history and I don't understand how the first form is generally used.

 

I'm quite willing to believe I did not understand the (largely unstated) specification for the non-DWARF form of .file, and if others agree that it should not imply that debug info already exists, then reporting that as a bug is appropriate.  I can't say I'd be able to find time to try to *fix* it before October, as I'm already over-committed, but I'd anticipate getting to it around that time.

--paulr

 

From: bcain at codeaurora.org <mailto:bcain at codeaurora.org>  [mailto:bcain at codeaurora.org <mailto:bcain at codeaurora.org> ] 
Sent: Thursday, August 23, 2018 3:18 PM
To: llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> 
Cc: Robinson, Paul
Subject: [assembler + debuginfo] interaction with .file directive and debuginfo 

 

[ I discussed this briefly with Paul off list and he suggested it would be better here. ]

 

Among the changes in 7.0.0 are some that were added to support DWARFv5’s .debug_line.   

 

The presence of “.file” mutes debug info generated by the assembler as of r328208 – logic in AsmParser::enabledGenDwarfForAssembly().

 

The comment there states: “If we haven't encountered any .file directives (which would imply that the assembler source was produced with debug info already) then emit one describing the assembler source file itself.”

 

Does .file imply that the assembly source was already produced with debug info?  Perhaps not in all cases.  If you wanted to emit an ELF::STT_FILE into your object, for example, you might add ```.file "foo.s"```.

 

I think we should change this behavior to the previous – check for “-g” but ignore “.file” directives.   Or maybe there’s a compromise to be found among the different versions of “.file” with various args?  Thoughts?

 

-Brian

_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> 
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

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


More information about the llvm-dev mailing list