[PATCH] D79165: [DebugInfo] - DWARFDebugFrame: do not call abort() on errors.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 03:22:54 PDT 2020


grimar created this revision.
grimar added reviewers: jhenderson, ikudrin, dblaikie, MaskRay.
Herald added subscribers: rupprecht, hiraditya, aprantl, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

Imagine we have a broken .eh_frame.
Below is a possible sample output of llvm-readelf:

  ...
      entry 2 {
        initial_location: 0x10f5
        address: 0x2080
      }
    }
  }
  .eh_frame section at offset 0x2028 address 0x2028:
  LLVM ERROR: Parsing entry instructions at 0 failed
  PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
  Stack dump:
  0.  Program arguments: /home/umb/LLVM/LLVM/llvm-project/build/bin/llvm-readelf -a 1
   #0 0x000055f4a2ff5a1a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/umb/LLVM/LLVM/llvm-project/build/bin/llvm-readelf+0x2b9a1a)
  ...
  #15 0x00007fdae5dc209b __libc_start_main /build/glibc-B9XfQf/glibc-2.28/csu/../csu/libc-start.c:342:3
  #16 0x000055f4a2db746a _start (/home/umb/LLVM/LLVM/llvm-project/build/bin/llvm-readelf+0x7b46a)
  Aborted

I.e. it calls abort(), suggests to submit a bug report and exits with the code 134.
This patch changes the logic to propagate errors to callers.
This fixes the behavior for llvm-dwarfdump, llvm-readobj and other possible tools.


https://reviews.llvm.org/D79165

Files:
  llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
  llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
  llvm/test/DebugInfo/X86/eh-frame-cie-id.s
  llvm/test/tools/llvm-readobj/ELF/unwind.test
  llvm/tools/llvm-readobj/DwarfCFIEHPrinter.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79165.261173.patch
Type: text/x-patch
Size: 14454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200430/ba701b21/attachment.bin>


More information about the llvm-commits mailing list