1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[DebugInfo] Support file-level include directories when generating DWARFv5 LineTable prologues.

Differential Revision: https://reviews.llvm.org/D74249
This commit is contained in:
Sterling Augustine 2020-02-10 12:19:35 -08:00 committed by David Blaikie
parent 19d0f52080
commit ddc0ec1309
2 changed files with 8 additions and 4 deletions

View File

@ -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");
}

View File

@ -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);
}
}