summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
diff options
context:
space:
mode:
authorAli Tamur <tamur@google.com>2019-03-25 20:08:00 +0000
committerAli Tamur <tamur@google.com>2019-03-25 20:08:00 +0000
commit312ab05887d0e2caa29aaf843cefe39379a98d36 (patch)
tree51352d1277613660c9034ea41c76d16a9c7f1b98 /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
parentcefafc4999305e08605b705b5611dd9b87d96f0a (diff)
downloadbcm5719-llvm-312ab05887d0e2caa29aaf843cefe39379a98d36.tar.gz
bcm5719-llvm-312ab05887d0e2caa29aaf843cefe39379a98d36.zip
[llvm] Prevent duplicate files in debug line header in dwarf 5.
Summary: Motivation: In previous dwarf versions, file name indexes started from 1, and the primary source file was not explicit. Dwarf 5 standard (6.2.4) prescribes the primary source file to be explicitly given an entry with an index number 0. The current implementation honors the specification by just duplicating the main source file, once with index number 0, and later maybe with another index number. While this is compliant with the letter of the standard, the duplication causes problems for consumers of this information such as lldb. (Some files are duplicated, where only some of them have a line table although all refer to the same file) With this change, dwarf 5 debug line section files always start from 0, and the zeroth entry is not duplicated whenever possible. This requires different handling of dwarf 4 and dwarf 5 during generation (e.g. when a function returns an index zero for a file name, it signals an error in dwarf 4, but not in dwarf 5) However, I think the minor complication is worth it, because it enables all consumers (lldb, gdb, dwarfdump, objdump, and so on) to treat all files in the file name list homogenously. Reviewers: dblaikie, probinson, aprantl, espindola Reviewed By: probinson Subscribers: emaste, jvesely, nhaehnle, aprantl, javed.absar, arichardson, hiraditya, MaskRay, rupprecht, jdoerfert, llvm-commits Tags: #llvm, #debug-info Differential Revision: https://reviews.llvm.org/D59515 llvm-svn: 356941
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
index d9addb52376..683d3245e56 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
@@ -101,6 +101,7 @@ class DwarfCompileUnit final : public DwarfUnit {
}
public:
+ unsigned getDwarfVersion() const { return DD->getDwarfVersion(); }
DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A,
DwarfDebug *DW, DwarfFile *DWU);
OpenPOWER on IntegriCloud