via llvm-dev
2018-Aug-23 22:18 UTC
[llvm-dev] [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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180823/43055309/attachment.html>
via llvm-dev
2018-Aug-24 16:04 UTC
[llvm-dev] [assembler + debuginfo] interaction with .file directive and debuginfo
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] Sent: Thursday, August 23, 2018 3:18 PM To: 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180824/13d345b8/attachment.html>
David Blaikie via llvm-dev
2018-Aug-24 16:10 UTC
[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> 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] > *Sent:* Thursday, August 23, 2018 3:18 PM > *To:* 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 > 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/7ed05030/attachment.html>
Apparently Analagous Threads
- [assembler + debuginfo] interaction with .file directive and debuginfo
- [LLVMdev] DebugInfo library and relocations in the .debug_line section
- [LLVMdev] DebugInfo library and relocations in the .debug_line section
- [LLVMdev] DebugInfo library and relocations in the .debug_line section
- [LLVMdev] DebugInfo library and relocations in the .debug_line section