[llvm] 0431e4b - Recommit "[DWARFYAML][debug_line] Replace `InitialLength` with `Format` and `Length`."
Xing GUO via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 13 08:35:55 PDT 2020
Author: Xing GUO
Date: 2020-06-13T23:39:11+08:00
New Revision: 0431e4bcb27bba30156ac49be4c09ac632c5a03a
URL: https://github.com/llvm/llvm-project/commit/0431e4bcb27bba30156ac49be4c09ac632c5a03a
DIFF: https://github.com/llvm/llvm-project/commit/0431e4bcb27bba30156ac49be4c09ac632c5a03a.diff
LOG: Recommit "[DWARFYAML][debug_line] Replace `InitialLength` with `Format` and `Length`."
This recommits fcc0c186e9cea0af644581069058f0e00469d20e
Added:
Modified:
lldb/unittests/Symbol/Inputs/inlined-functions.yaml
llvm/include/llvm/ObjectYAML/DWARFYAML.h
llvm/lib/ObjectYAML/DWARFEmitter.cpp
llvm/lib/ObjectYAML/DWARFYAML.cpp
llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
llvm/tools/obj2yaml/dwarf2yaml.cpp
llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
Removed:
################################################################################
diff --git a/lldb/unittests/Symbol/Inputs/inlined-functions.yaml b/lldb/unittests/Symbol/Inputs/inlined-functions.yaml
index 16e437c48bf9..14573da3498d 100644
--- a/lldb/unittests/Symbol/Inputs/inlined-functions.yaml
+++ b/lldb/unittests/Symbol/Inputs/inlined-functions.yaml
@@ -713,8 +713,7 @@ DWARF:
- AbbrCode: 0x00000000
Values: []
debug_line:
- - Length:
- TotalLength: 202
+ - Length: 202
Version: 4
PrologueLength: 45
MinInstLength: 1
diff --git a/llvm/include/llvm/ObjectYAML/DWARFYAML.h b/llvm/include/llvm/ObjectYAML/DWARFYAML.h
index 2f355b2a5b59..08b02691ffc1 100644
--- a/llvm/include/llvm/ObjectYAML/DWARFYAML.h
+++ b/llvm/include/llvm/ObjectYAML/DWARFYAML.h
@@ -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;
diff --git a/llvm/lib/ObjectYAML/DWARFEmitter.cpp b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
index b496e2a09386..9ab6aa5aeafc 100644
--- a/llvm/lib/ObjectYAML/DWARFEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
@@ -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);
diff --git a/llvm/lib/ObjectYAML/DWARFYAML.cpp b/llvm/lib/ObjectYAML/DWARFYAML.cpp
index 257db357ca73..8298047d8be9 100644
--- a/llvm/lib/ObjectYAML/DWARFYAML.cpp
+++ b/llvm/lib/ObjectYAML/DWARFYAML.cpp
@@ -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);
diff --git a/llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml b/llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
index 95f3eae597c2..af997b010b2d 100644
--- a/llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
+++ b/llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
@@ -453,8 +453,7 @@ DWARF:
- AbbrCode: 0x00000000
Values:
debug_line:
- - Length:
- TotalLength: 65
+ - Length: 65
Version: 2
PrologueLength: 36
MinInstLength: 1
diff --git a/llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml b/llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
index 5d17deb2fac2..d24fe7c8a4b8 100644
--- a/llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
+++ b/llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
@@ -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
diff --git a/llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml b/llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
index 574796cbebda..9e8865f3c08e 100644
--- a/llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
+++ b/llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
@@ -454,8 +454,7 @@ DWARF:
- AbbrCode: 0x00000000
Values:
debug_line:
- - Length:
- TotalLength: 65
+ - Length: 65
Version: 2
PrologueLength: 36
MinInstLength: 1
diff --git a/llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml b/llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
index a144a37b7f2e..3693075b8b85 100644
--- a/llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
+++ b/llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
@@ -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
diff --git a/llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml b/llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
index 664b4ee7c070..d68d330745ac 100644
--- a/llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
+++ b/llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
@@ -694,8 +694,7 @@ DWARF:
- AbbrCode: 0x00000000
Values: []
debug_line:
- - Length:
- TotalLength: 102
+ - Length: 102
Version: 4
PrologueLength: 32
MinInstLength: 1
diff --git a/llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml b/llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
index 213d66fd4371..88d9b67d7c6b 100644
--- a/llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
+++ b/llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
@@ -461,8 +461,7 @@ DWARF:
- AbbrCode: 0x00000000
Values: []
debug_line:
- - Length:
- TotalLength: 74
+ - Length: 74
Version: 4
PrologueLength: 36
MinInstLength: 1
diff --git a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
index 22d5584351ac..020fadc57b34 100644
--- a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
+++ b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
@@ -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
diff --git a/llvm/tools/obj2yaml/dwarf2yaml.cpp b/llvm/tools/obj2yaml/dwarf2yaml.cpp
index 12cb0c294d4a..88f53c18f30b 100644
--- a/llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ b/llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -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);
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
index 7331d9c95df8..d481299d0146 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -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
diff --git a/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp b/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
index 2a8a4d9c3ae2..f55e90b5590d 100644
--- a/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
+++ b/llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
@@ -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
More information about the llvm-commits
mailing list