[llvm] 369ea47 - [Symbolize] Handle error after the notes loop

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 11:00:35 PST 2020


Author: Petr Hosek
Date: 2020-01-27T11:00:27-08:00
New Revision: 369ea47b9249f1843730d8d0c0ca5df46826d032

URL: https://github.com/llvm/llvm-project/commit/369ea47b9249f1843730d8d0c0ca5df46826d032
DIFF: https://github.com/llvm/llvm-project/commit/369ea47b9249f1843730d8d0c0ca5df46826d032.diff

LOG: [Symbolize] Handle error after the notes loop

We always have to check the error, even if we're going to ignore it.

Added: 
    llvm/test/DebugInfo/symbolize-build-id-error.test

Modified: 
    llvm/lib/DebugInfo/Symbolize/Symbolize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
index 35e3ead6317b..ebb4a0c297d3 100644
--- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp
@@ -300,6 +300,7 @@ Optional<ArrayRef<uint8_t>> getBuildID(const ELFFile<ELFT> *Obj) {
     for (auto N : Obj->notes(P, Err))
       if (N.getType() == ELF::NT_GNU_BUILD_ID && N.getName() == ELF::ELF_NOTE_GNU)
         return N.getDesc();
+    consumeError(std::move(Err));
   }
   return {};
 }

diff  --git a/llvm/test/DebugInfo/symbolize-build-id-error.test b/llvm/test/DebugInfo/symbolize-build-id-error.test
new file mode 100644
index 000000000000..ef3972537c9f
--- /dev/null
+++ b/llvm/test/DebugInfo/symbolize-build-id-error.test
@@ -0,0 +1,23 @@
+# RUN: yaml2obj %s -o %t
+
+# RUN: llvm-symbolizer --debug-file-directory=%p/Inputs --obj=%t 0x20112f | FileCheck %s
+
+# CHECK:      ??
+# CHECK-NEXT: ??:0:0
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_EXEC
+  Machine: EM_X86_64
+Sections:
+  - Name:    .note.invalid
+    Type:    SHT_NOTE
+    Flags:   [ SHF_ALLOC ]
+    Content: 0123456789
+ProgramHeaders:
+  - Type: PT_NOTE
+    Flags: [ PF_R ]
+    Sections:
+      - Section: .note.invalid


        


More information about the llvm-commits mailing list