[PATCH] D58085: [llvm-dwp] Abort when dwo_id is unset

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 12 07:01:18 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL353846: [llvm-dwp] Abort when dwo_id is unset (authored by rupprecht, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D58085?vs=186390&id=186457#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58085/new/

https://reviews.llvm.org/D58085

Files:
  llvm/trunk/test/tools/llvm-dwp/Inputs/missing_dwo_id.dwo
  llvm/trunk/test/tools/llvm-dwp/X86/invalid_string_form.test
  llvm/trunk/test/tools/llvm-dwp/X86/missing_dwo_id.test
  llvm/trunk/test/tools/llvm-dwp/X86/non_cu_top_level.test
  llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp


Index: llvm/trunk/test/tools/llvm-dwp/X86/invalid_string_form.test
===================================================================
--- llvm/trunk/test/tools/llvm-dwp/X86/invalid_string_form.test
+++ llvm/trunk/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
Index: llvm/trunk/test/tools/llvm-dwp/X86/missing_dwo_id.test
===================================================================
--- llvm/trunk/test/tools/llvm-dwp/X86/missing_dwo_id.test
+++ llvm/trunk/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/trunk/test/tools/llvm-dwp/X86/non_cu_top_level.test
===================================================================
--- llvm/trunk/test/tools/llvm-dwp/X86/non_cu_top_level.test
+++ llvm/trunk/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/trunk/tools/llvm-dwp/llvm-dwp.cpp
===================================================================
--- llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp
+++ llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp
@@ -13,6 +13,7 @@
 #include "DWPError.h"
 #include "DWPStringPool.h"
 #include "llvm/ADT/MapVector.h"
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
 #include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
@@ -159,6 +160,7 @@
   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)) {
@@ -180,13 +182,16 @@
       break;
     }
     case dwarf::DW_AT_GNU_dwo_id:
-      ID.Signature = InfoData.getU64(&Offset);
+      Signature = InfoData.getU64(&Offset);
       break;
     default:
       DWARFFormValue::skipValue(Form, InfoData, &Offset,
                                 dwarf::FormParams({Version, AddrSize, Format}));
     }
   }
+  if (!Signature)
+    return make_error<DWPError>("compile unit missing dwo_id");
+  ID.Signature = *Signature;
   return ID;
 }
 
@@ -560,7 +565,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 +593,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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58085.186457.patch
Type: text/x-patch
Size: 3448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190212/adb1bc34/attachment.bin>


More information about the llvm-commits mailing list