summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2018-01-18 20:33:35 +0000
committerPaul Robinson <paul.robinson@sony.com>2018-01-18 20:33:35 +0000
commit8181d23b3db2199e37fea9c93bc42a2a6a5ade98 (patch)
tree429d7cbfb19950174b50d528af976790d3769e7b /llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
parent9463321da62637be21acdf06460ad2848868c331 (diff)
downloadbcm5719-llvm-8181d23b3db2199e37fea9c93bc42a2a6a5ade98.tar.gz
bcm5719-llvm-8181d23b3db2199e37fea9c93bc42a2a6a5ade98.zip
[DWARFv5] Number the line-table's directory array correctly.
The compilation directory has always been #0, but as of DWARF v5 it is explicitly listed in the line-table section instead of implicitly being a reference to the compile_unit DIE's DW_AT_comp_dir attribute. This means the dumper should number the dumped array starting with 0 or 1 depending on the DWARF version of the line table. References in the generated DWARF are correct, it's just the dumper that was wrong. Also some assembler-coded tests were similarly confused about directory numbers. llvm-svn: 322884
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index 861122cfbaf..7bc6f10e516 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -73,10 +73,13 @@ void DWARFDebugLine::Prologue::dump(raw_ostream &OS) const {
OS << format("standard_opcode_lengths[%s] = %u\n",
LNStandardString(I + 1).data(), StandardOpcodeLengths[I]);
- if (!IncludeDirectories.empty())
+ if (!IncludeDirectories.empty()) {
+ // DWARF v5 starts directory indexes at 0.
+ uint32_t DirBase = getVersion() >= 5 ? 0 : 1;
for (uint32_t I = 0; I != IncludeDirectories.size(); ++I)
- OS << format("include_directories[%3u] = '", I + 1)
+ OS << format("include_directories[%3u] = '", I + DirBase)
<< IncludeDirectories[I] << "'\n";
+ }
if (!FileNames.empty()) {
if (HasMD5)
OpenPOWER on IntegriCloud