[PATCH] D58085: [llvm-dwp] Abort when dwo_id is unset
Jordan Rupprecht via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 11 16:14:37 PST 2019
rupprecht created this revision.
rupprecht added a reviewer: dblaikie.
Herald added subscribers: llvm-commits, aprantl.
Herald added a project: LLVM.
An empty dwo_id indicates a degenerate .dwo file that should not have been generated in the first place. Instead of discovering this error later when merging with another degenerate .dwo file, print an error immediately when noticing an unset dwo_id, including the filename of the offending file.
Test case created by compiling a trivial file w/ `-fno-split-dwarf-inlining -gmlt -gsplit-dwarf -c` prior to r353771
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D58085
Files:
llvm/test/tools/llvm-dwp/Inputs/missing_dwo_id.dwo
llvm/test/tools/llvm-dwp/X86/invalid_string_form.test
llvm/test/tools/llvm-dwp/X86/missing_dwo_id.test
llvm/test/tools/llvm-dwp/X86/non_cu_top_level.test
llvm/tools/llvm-dwp/llvm-dwp.cpp
Index: llvm/tools/llvm-dwp/llvm-dwp.cpp
===================================================================
--- llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -187,6 +187,8 @@
dwarf::FormParams({Version, AddrSize, Format}));
}
}
+ if (ID.Signature == 0)
+ return make_error<DWPError>("Compile unit missing dwo_id");
return ID;
}
@@ -560,7 +562,7 @@
Expected<CompileUnitIdentifiers> EID = getCUIdentifiers(
AbbrevSection, InfoSection, CurStrOffsetSection, CurStrSection);
if (!EID)
- return EID.takeError();
+ return createFileError(Input, EID.takeError());
const auto &ID = *EID;
auto P = IndexEntries.insert(std::make_pair(ID.Signature, CurEntry));
if (!P.second)
@@ -588,7 +590,7 @@
getSubsection(CurStrOffsetSection, E, DW_SECT_STR_OFFSETS),
CurStrSection);
if (!EID)
- return EID.takeError();
+ return createFileError(Input, EID.takeError());
const auto &ID = *EID;
if (!P.second)
return buildDuplicateError(*P.first, ID, Input);
Index: llvm/test/tools/llvm-dwp/X86/non_cu_top_level.test
===================================================================
--- llvm/test/tools/llvm-dwp/X86/non_cu_top_level.test
+++ llvm/test/tools/llvm-dwp/X86/non_cu_top_level.test
@@ -1,3 +1,3 @@
RUN: not llvm-dwp %p/../Inputs/non_cu_top_level.dwo -o %t 2>&1 | FileCheck %s
-CHECK: error: top level DIE is not a compile unit
+CHECK: error: {{.*}}non_cu_top_level.dwo': top level DIE is not a compile unit
Index: llvm/test/tools/llvm-dwp/X86/missing_dwo_id.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-dwp/X86/missing_dwo_id.test
@@ -0,0 +1,3 @@
+RUN: not llvm-dwp %p/../Inputs/missing_dwo_id.dwo -o %t 2>&1 | FileCheck %s
+
+CHECK: error: {{.*}}missing_dwo_id.dwo': Compile unit missing dwo_id
Index: llvm/test/tools/llvm-dwp/X86/invalid_string_form.test
===================================================================
--- llvm/test/tools/llvm-dwp/X86/invalid_string_form.test
+++ llvm/test/tools/llvm-dwp/X86/invalid_string_form.test
@@ -1,3 +1,3 @@
RUN: not llvm-dwp %p/../Inputs/invalid_string_form.dwo -o %t 2>&1 | FileCheck %s
-CHECK: error: string field encoded without DW_FORM_string or DW_FORM_GNU_str_index
+CHECK: error: {{.*}}invalid_string_form.dwo': string field encoded without DW_FORM_string or DW_FORM_GNU_str_index
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58085.186361.patch
Type: text/x-patch
Size: 2502 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190212/38fde555/attachment.bin>
More information about the llvm-commits
mailing list