[PATCH] D101024: [Debug-Info] make DIE attributes generating under control of strict dwarf

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 20:50:59 PDT 2021


dblaikie added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h:85
+    // DWARF version.
+    if (Attribute != 0 && Asm->TM.Options.DebugStrictDwarf &&
+        DD->getDwarfVersion() < dwarf::AttributeVersion(Attribute))
----------------
shchenz wrote:
> dblaikie wrote:
> > When is the Attribute 0?
> one example:
> ```
> /// Add a Dwarf expression attribute data and value.
> void DwarfCompileUnit::addExpr(DIELoc &Die, dwarf::Form Form,
>                                const MCExpr *Expr) {
>   Die.addValue(DIEValueAllocator, (dwarf::Attribute)0, Form, DIEExpr(Expr));
> }
> ```
> 
> This is not for adding an attribute but for adding an expression for an attribute. Even `dwarf::AttributeVersion(0)` returns 0 and we will still go to `return` branch, but I think it is meaningless to get a attribute version for attribute 0?
Ah, I think that's used for putting things in blocks, etc. 

I suspect that not adding the attribute if the attribute is 0 is probably the wrong thing to do - perhaps you could check some test cases/try some small pieces of code to see what this breaks/omits? I think it'll end up omitting DWARF location expressions, for instance - so any non-trivial variable location would be incorrect/missing?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101024/new/

https://reviews.llvm.org/D101024



More information about the llvm-commits mailing list