diff options
author | Sterling Augustine <saugustine@google.com> | 2020-02-10 12:19:35 -0800 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2020-02-10 12:24:46 -0800 |
commit | 0bd48c3d4ee1a94ea3d3b9d89201b23fd83c94d0 (patch) | |
tree | fbf6be309001085e9dfd6d330601599e0a77b7ba | |
parent | c1adb88a31f37c7f2990c85a1f9297f44a23d32c (diff) | |
download | llvm-0bd48c3d4ee1a94ea3d3b9d89201b23fd83c94d0.zip llvm-0bd48c3d4ee1a94ea3d3b9d89201b23fd83c94d0.tar.gz llvm-0bd48c3d4ee1a94ea3d3b9d89201b23fd83c94d0.tar.bz2 |
[DebugInfo] Support file-level include directories when generating DWARFv5 LineTable prologues.
Differential Revision: https://reviews.llvm.org/D74249
-rw-r--r-- | llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp | 3 | ||||
-rw-r--r-- | llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp index 428f48e..5d03746 100644 --- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp @@ -180,7 +180,7 @@ void checkDefaultPrologue(uint16_t Version, DwarfFormat Format, UnitLength = PrologueLength + 2; break; case 5: - PrologueLength = 39; + PrologueLength = 42; UnitLength = PrologueLength + 4; EXPECT_EQ(Prologue.getAddressSize(), 8u); EXPECT_EQ(Prologue.SegSelectorSize, 0u); @@ -204,6 +204,7 @@ void checkDefaultPrologue(uint16_t Version, DwarfFormat Format, EXPECT_STREQ(*Prologue.IncludeDirectories[0].getAsCString(), "a dir"); ASSERT_EQ(Prologue.FileNames.size(), 1u); ASSERT_EQ(Prologue.FileNames[0].Name.getForm(), DW_FORM_string); + ASSERT_EQ(Prologue.FileNames[0].DirIdx, 0u); EXPECT_STREQ(*Prologue.FileNames[0].Name.getAsCString(), "a file"); } diff --git a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp index f11e7c3..e8662a5 100644 --- a/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp @@ -164,8 +164,8 @@ DWARFDebugLine::Prologue dwarfgen::LineTable::createBasicPrologue() const { P.PrologueLength = 36; break; case 5: - P.TotalLength = 47; - P.PrologueLength = 39; + P.TotalLength = 50; + P.PrologueLength = 42; P.FormParams.AddrSize = AddrSize; break; default: @@ -343,13 +343,16 @@ static void writeV5IncludeAndFileTable(const DWARFDebugLine::Prologue &Prologue, writeCString(*Include.getAsCString(), Asm); } - Asm.emitInt8(1); // file_name_entry_format_count. + Asm.emitInt8(2); // file_name_entry_format_count. Asm.EmitULEB128(DW_LNCT_path); Asm.EmitULEB128(DW_FORM_string); + Asm.EmitULEB128(DW_LNCT_directory_index); + Asm.EmitULEB128(DW_FORM_data1); Asm.EmitULEB128(Prologue.FileNames.size()); for (auto File : Prologue.FileNames) { assert(File.Name.getAsCString() && "expected a string form for file name"); writeCString(*File.Name.getAsCString(), Asm); + Asm.emitInt8(File.DirIdx); } } |