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

This reverts commit fcc0c186e9.
This commit is contained in:
Xing GUO 2020-06-13 17:57:02 +08:00
parent fcc0c186e9
commit 325f7607b0
8 changed files with 22 additions and 26 deletions

View File

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

View File

@ -262,9 +262,8 @@ 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.Format, LineTable.Length, OS,
DI.IsLittleEndian);
uint64_t SizeOfPrologueLength = LineTable.Format == dwarf::DWARF64 ? 8 : 4;
writeInitialLength(LineTable.Length, OS, DI.IsLittleEndian);
uint64_t SizeOfPrologueLength = LineTable.Length.isDWARF64() ? 8 : 4;
writeInteger((uint16_t)LineTable.Version, OS, DI.IsLittleEndian);
writeVariableSizedInteger(LineTable.PrologueLength, SizeOfPrologueLength,
OS, DI.IsLittleEndian);

View File

@ -175,7 +175,6 @@ 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,7 +453,8 @@ DWARF:
- AbbrCode: 0x00000000
Values:
debug_line:
- Length: 65
- Length:
TotalLength: 65
Version: 2
PrologueLength: 36
MinInstLength: 1

View File

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

View File

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

View File

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

View File

@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#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"
@ -297,17 +296,9 @@ void dumpDebugLines(DWARFContext &DCtx, DWARFYAML::Data &Y) {
DataExtractor LineData(DCtx.getDWARFObj().getLineSection().Data,
DCtx.isLittleEndian(), CU->getAddressByteSize());
uint64_t Offset = *StmtOffset;
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;
dumpInitialLength(LineData, Offset, DebugLines.Length);
uint64_t LineTableLength = DebugLines.Length.getLength();
uint64_t SizeOfPrologueLength = DebugLines.Length.isDWARF64() ? 8 : 4;
DebugLines.Version = LineData.getU16(&Offset);
DebugLines.PrologueLength =
LineData.getUnsigned(&Offset, SizeOfPrologueLength);