[PATCH] D89216: [dsymutil] Add the ability to run the DWARF verifier on the input

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 02:54:09 PDT 2020


avl added inline comments.


================
Comment at: llvm/tools/dsymutil/BinaryHolder.cpp:274
+    std::unique_ptr<DWARFContext> DICtx = DWARFContext::create(*Object);
+    if (!DICtx->verify(OS, DumpOpts.noImplicitRecursion()))
+      WithColor::warning() << "input verification failed for "
----------------
JDevlieghere wrote:
> avl wrote:
> > I have two suggestions/questions: 1. It would probably be better to do input verification inside DWARFLinker library(DWARFLinker::link()). Then all users of the library will be able to use this functionality. 2. Would it be useful to have failure in verification to be fatal error ?
> I think moving it into the DWARFLinker is a good idea, we already have a DWARFContext there. 
> 
> I don't think we should make input verification failure a fatal error. Depending on the issue dsymutil is capable of generating a valid dSYM from invalid DWARF.
>I don't think we should make input verification failure a fatal error. Depending on the issue dsymutil is capable of generating a valid dSYM from invalid DWARF.

There is a final set of errors which dsymutil could cure and generate a valid DWARF.  The example of such errors is "Overlapping address range". Before dsymutil, there are a lot of address ranges starting from zero(these are address ranges related to deleted code). So input verification would report error "Overlapping address range". dsymutil removes DWARF which uses these address ranges and final DWARF become valid. Other kinds of errors could not be cured by dsymutil. And then it would be useful to fail if input contains such errors. 

Probably, we could add a parameter to the DWARFContext.verify() - SkipDWARLinkerKnownErrors. So that if verifier encounter only known errors it would report success, otherwise it would report failure and dsymutil would fail during input validation ?

It looks useful if dsymutil would fail on input verification if input DWARF contains errors which could not be fixed/correctly processed by dsymutil.


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

https://reviews.llvm.org/D89216



More information about the llvm-commits mailing list