aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-dwp/llvm-dwp.cpp
diff options
context:
space:
mode:
authorSourabh Singh Tomar <SourabhSingh.Tomar@amd.com>2020-02-11 23:59:40 +0530
committerSourabh Singh Tomar <SourabhSingh.Tomar@amd.com>2020-02-19 10:33:39 +0530
commita71feda24ea092ec14474216532b3ce9883b81ab (patch)
tree131ec801c8be35569fd80a68323ec8187a63d8d2 /llvm/tools/llvm-dwp/llvm-dwp.cpp
parentd840e5452315e69d44cfe44b766e633964681b6a (diff)
downloadllvm-a71feda24ea092ec14474216532b3ce9883b81ab.zip
llvm-a71feda24ea092ec14474216532b3ce9883b81ab.tar.gz
llvm-a71feda24ea092ec14474216532b3ce9883b81ab.tar.bz2
[DebugInfo]: Added support for DWARFv5 Info section header parsing in llvm-dwp utility.
Summary: This patch teaches llvm-dwp to parse DWARFv5 info section header. Tested this using asm test case caontaining DWARFv5 info. Assemling it to DWO object, checking corresponding content using llvm-dwarfdump. Then finally, packaging it to DWP using llvm-dwp and again checking corresponding content using llvm-dwarfdump. Reviewers: dblaikie, aprantl, probinson. Reviewed By: dblaikie. Differential Revision: https://reviews.llvm.org/D74425
Diffstat (limited to 'llvm/tools/llvm-dwp/llvm-dwp.cpp')
-rw-r--r--llvm/tools/llvm-dwp/llvm-dwp.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index 6292c95..f437063 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -140,6 +140,8 @@ static Expected<CompileUnitIdentifiers> getCUIdentifiers(StringRef Abbrev,
DataExtractor InfoData(Info, true, 0);
dwarf::DwarfFormat Format = dwarf::DwarfFormat::DWARF32;
uint64_t Length = InfoData.getU32(&Offset);
+ CompileUnitIdentifiers ID;
+ Optional<uint64_t> Signature = None;
// If the length is 0xffffffff, then this indictes that this is a DWARF 64
// stream and the length is actually encoded into a 64 bit value that follows.
if (Length == 0xffffffffU) {
@@ -147,9 +149,18 @@ static Expected<CompileUnitIdentifiers> getCUIdentifiers(StringRef Abbrev,
Length = InfoData.getU64(&Offset);
}
uint16_t Version = InfoData.getU16(&Offset);
+ if (Version >= 5) {
+ auto UnitType = InfoData.getU8(&Offset);
+ if (UnitType != dwarf::DW_UT_split_compile)
+ return make_error<DWPError>(
+ std::string("unit type DW_UT_split_compile type not found in "
+ "debug_info header. Unexpected unit type 0x" +
+ utostr(UnitType) + " found!"));
+ }
InfoData.getU32(&Offset); // Abbrev offset (should be zero)
uint8_t AddrSize = InfoData.getU8(&Offset);
-
+ if (Version >= 5)
+ Signature = InfoData.getU64(&Offset);
uint32_t AbbrCode = InfoData.getULEB128(&Offset);
DataExtractor AbbrevData(Abbrev, true, 0);
@@ -161,8 +172,6 @@ static Expected<CompileUnitIdentifiers> getCUIdentifiers(StringRef Abbrev,
AbbrevData.getU8(&AbbrevOffset);
uint32_t Name;
dwarf::Form Form;
- CompileUnitIdentifiers ID;
- Optional<uint64_t> Signature = None;
while ((Name = AbbrevData.getULEB128(&AbbrevOffset)) |
(Form = static_cast<dwarf::Form>(AbbrevData.getULEB128(&AbbrevOffset))) &&
(Name != 0 || Form != 0)) {
@@ -175,7 +184,8 @@ static Expected<CompileUnitIdentifiers> getCUIdentifiers(StringRef Abbrev,
ID.Name = *EName;
break;
}
- case dwarf::DW_AT_GNU_dwo_name: {
+ case dwarf::DW_AT_GNU_dwo_name:
+ case dwarf::DW_AT_dwo_name: {
Expected<const char *> EName =
getIndexedString(Form, InfoData, Offset, StrOffsets, Str);
if (!EName)