[PATCH] D64014: [Object/ELF.h] - Improve error reporting.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 08:15:12 PDT 2019


grimar created this revision.
grimar added reviewers: jhenderson, jakehehrlich, MaskRay, rupprecht.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.

The errors coming from ELF.h are usually not very useful because they are
uninformative. This patch is a first step to improve the situation.

1. I introduced a global `llvm::StringSaver ErrSaver` object, with that it is now

possible to include the additional information to error messages (e.g. section info).

2. I tested this patch with a run of `check-llvm` and found that few messages are untested.

In this patch, I did not add more tests but marked all such cases with a "TODO" comment.

3. For all **tested** messages I extended the error text to provide more details (see test cases changed).


https://reviews.llvm.org/D64014

Files:
  include/llvm/Object/ELF.h
  lib/Object/ELF.cpp
  test/Object/corrupt.test
  test/Object/elf-invalid-phdr.test
  test/Object/invalid.test
  test/tools/llvm-elfabi/binary-read-bad-vaddr.test
  test/tools/llvm-objcopy/ELF/invalid-e_phoff.test
  test/tools/llvm-objcopy/ELF/invalid-e_shoff.test
  test/tools/llvm-readobj/elf-broken-dynsym-link.test
  test/tools/llvm-readobj/elf-dynamic-malformed.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64014.207314.patch
Type: text/x-patch
Size: 24551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190701/6a2d22ad/attachment.bin>


More information about the llvm-commits mailing list