Recommit "[DWARFYAML][debug_line] Replace `InitialLength` with `Format` and `Length`."

This recommits fcc0c186e9
This commit is contained in:
Xing GUO 2020-06-13 22:04:51 +08:00
parent c669a1ed63
commit 0431e4bcb2
14 changed files with 38 additions and 46 deletions

View File

@ -713,8 +713,7 @@ DWARF:
- AbbrCode: 0x00000000
Values: []
debug_line:
- Length:
TotalLength: 202
- Length: 202
Version: 4
PrologueLength: 45
MinInstLength: 1

View File

@ -144,7 +144,8 @@ struct LineTableOpcode {
};
struct LineTable {
InitialLength Length;
dwarf::DwarfFormat Format;
uint64_t Length;
uint16_t Version;
uint64_t PrologueLength;
uint8_t MinInstLength;

View File

@ -262,8 +262,9 @@ static void emitFileEntry(raw_ostream &OS, const DWARFYAML::File &File) {
Error DWARFYAML::emitDebugLine(raw_ostream &OS, const DWARFYAML::Data &DI) {
for (const auto &LineTable : DI.DebugLines) {
writeInitialLength(LineTable.Length, OS, DI.IsLittleEndian);
uint64_t SizeOfPrologueLength = LineTable.Length.isDWARF64() ? 8 : 4;
writeInitialLength(LineTable.Format, LineTable.Length, OS,
DI.IsLittleEndian);
uint64_t SizeOfPrologueLength = LineTable.Format == dwarf::DWARF64 ? 8 : 4;
writeInteger((uint16_t)LineTable.Version, OS, DI.IsLittleEndian);
writeVariableSizedInteger(LineTable.PrologueLength, SizeOfPrologueLength,
OS, DI.IsLittleEndian);

View File

@ -175,6 +175,7 @@ void MappingTraits<DWARFYAML::LineTableOpcode>::mapping(
void MappingTraits<DWARFYAML::LineTable>::mapping(
IO &IO, DWARFYAML::LineTable &LineTable) {
IO.mapOptional("Format", LineTable.Format, dwarf::DWARF32);
IO.mapRequired("Length", LineTable.Length);
IO.mapRequired("Version", LineTable.Version);
IO.mapRequired("PrologueLength", LineTable.PrologueLength);

View File

@ -453,8 +453,7 @@ DWARF:
- AbbrCode: 0x00000000
Values:
debug_line:
- Length:
TotalLength: 65
- Length: 65
Version: 2
PrologueLength: 36
MinInstLength: 1

View File

@ -492,8 +492,7 @@ DWARF:
- AbbrCode: 0x00000000
Values:
debug_line:
- Length:
TotalLength: 65
- Length: 65
Version: 2
PrologueLength: 36
MinInstLength: 1
@ -534,8 +533,7 @@ DWARF:
...
#CHECK: debug_line:
#CHECK: - Length:
#CHECK: TotalLength: 65
#CHECK: - Length: 65
#CHECK: Version: 2
#CHECK: PrologueLength: 36
#CHECK: MinInstLength: 1

View File

@ -454,8 +454,7 @@ DWARF:
- AbbrCode: 0x00000000
Values:
debug_line:
- Length:
TotalLength: 65
- Length: 65
Version: 2
PrologueLength: 36
MinInstLength: 1

View File

@ -475,8 +475,7 @@ Slices:
- AbbrCode: 0x00000000
Values: []
debug_line:
- Length:
TotalLength: 55
- Length: 55
Version: 4
PrologueLength: 32
MinInstLength: 1
@ -954,8 +953,7 @@ Slices:
- AbbrCode: 0x00000000
Values: []
debug_line:
- Length:
TotalLength: 59
- Length: 59
Version: 4
PrologueLength: 32
MinInstLength: 1

View File

@ -694,8 +694,7 @@ DWARF:
- AbbrCode: 0x00000000
Values: []
debug_line:
- Length:
TotalLength: 102
- Length: 102
Version: 4
PrologueLength: 32
MinInstLength: 1

View File

@ -461,8 +461,7 @@ DWARF:
- AbbrCode: 0x00000000
Values: []
debug_line:
- Length:
TotalLength: 74
- Length: 74
Version: 4
PrologueLength: 36
MinInstLength: 1

View File

@ -72,8 +72,7 @@ FileHeader:
Machine: EM_X86_64
DWARF:
debug_line:
- Length:
TotalLength: 0x70
- Length: 0x70
Version: 2
PrologueLength: 50
MinInstLength: 1
@ -207,8 +206,7 @@ Sections:
Size: 0x10
DWARF:
debug_line:
- Length:
TotalLength: 0x70
- Length: 0x70
Version: 2
PrologueLength: 50
MinInstLength: 1
@ -238,8 +236,7 @@ Sections:
Content: "00"
DWARF:
debug_line:
- Length:
TotalLength: 0x70
- Length: 0x70
Version: 2
PrologueLength: 50
MinInstLength: 1
@ -308,8 +305,7 @@ Sections:
Type: SHT_STRTAB
DWARF:
debug_line:
- Length:
TotalLength: 0x70
- Length: 0x70
Version: 2
PrologueLength: 50
MinInstLength: 1

View File

@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "Error.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
@ -296,9 +297,17 @@ void dumpDebugLines(DWARFContext &DCtx, DWARFYAML::Data &Y) {
DataExtractor LineData(DCtx.getDWARFObj().getLineSection().Data,
DCtx.isLittleEndian(), CU->getAddressByteSize());
uint64_t Offset = *StmtOffset;
dumpInitialLength(LineData, Offset, DebugLines.Length);
uint64_t LineTableLength = DebugLines.Length.getLength();
uint64_t SizeOfPrologueLength = DebugLines.Length.isDWARF64() ? 8 : 4;
uint64_t LengthOrDWARF64Prefix = LineData.getU32(&Offset);
if (LengthOrDWARF64Prefix == dwarf::DW_LENGTH_DWARF64) {
DebugLines.Format = dwarf::DWARF64;
DebugLines.Length = LineData.getU64(&Offset);
} else {
DebugLines.Format = dwarf::DWARF32;
DebugLines.Length = LengthOrDWARF64Prefix;
}
uint64_t LineTableLength = DebugLines.Length;
uint64_t SizeOfPrologueLength =
DebugLines.Format == dwarf::DWARF64 ? 8 : 4;
DebugLines.Version = LineData.getU16(&Offset);
DebugLines.PrologueLength =
LineData.getUnsigned(&Offset, SizeOfPrologueLength);

View File

@ -2198,8 +2198,7 @@ TEST(DWARFDebugInfo, TestDwarfVerifyInvalidLineSequence) {
- Value: 0x0000000000000001
- Value: 0x0000000000000000
debug_line:
- Length:
TotalLength: 68
- Length: 68
Version: 2
PrologueLength: 34
MinInstLength: 1
@ -2268,8 +2267,7 @@ TEST(DWARFDebugInfo, TestDwarfVerifyInvalidLineFileIndex) {
- Value: 0x0000000000000001
- Value: 0x0000000000000000
debug_line:
- Length:
TotalLength: 61
- Length: 61
Version: 2
PrologueLength: 34
MinInstLength: 1
@ -2340,8 +2338,7 @@ TEST(DWARFDebugInfo, TestDwarfVerifyInvalidLineTablePorlogueDirIndex) {
- Value: 0x0000000000000001
- Value: 0x0000000000000000
debug_line:
- Length:
TotalLength: 61
- Length: 61
Version: 2
PrologueLength: 34
MinInstLength: 1
@ -2413,8 +2410,7 @@ TEST(DWARFDebugInfo, TestDwarfVerifyDuplicateFileWarning) {
- Value: 0x0000000000000001
- Value: 0x0000000000000000
debug_line:
- Length:
TotalLength: 71
- Length: 71
Version: 2
PrologueLength: 44
MinInstLength: 1
@ -2501,8 +2497,7 @@ TEST(DWARFDebugInfo, TestDwarfVerifyCUDontShareLineTable) {
- Value: 0x000000000000000D
- Value: 0x0000000000000000
debug_line:
- Length:
TotalLength: 60
- Length: 60
Version: 2
PrologueLength: 34
MinInstLength: 1

View File

@ -1866,8 +1866,7 @@ TEST(GSYMTest, TestDWARFInlineInfo) {
- AbbrCode: 0x00000000
Values:
debug_line:
- Length:
TotalLength: 96
- Length: 96
Version: 2
PrologueLength: 46
MinInstLength: 1
@ -2133,8 +2132,7 @@ TEST(GSYMTest, TestDWARFNoLines) {
- AbbrCode: 0x00000000
Values: []
debug_line:
- Length:
TotalLength: 92
- Length: 92
Version: 2
PrologueLength: 34
MinInstLength: 1