Add a multi-type version of iterateSectionsWithType
authorTeng Qin <qinteng@fb.com>
Thu, 9 Nov 2017 05:43:58 +0000 (21:43 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 9 Nov 2017 06:00:31 +0000 (22:00 -0800)
commitef4c72233eea8e9ef283dc74a3f48dc4e755e35a
tree604abef4f8cb3515f1dfea8b9257c54c447053a7
parent67811c1b1209adff20d3bb40fa82039101e0ae9a
Add a multi-type version of iterateSectionsWithType

Summary:
When using `folly::symbolizer`, it's very often that we want to use `iterateSectionsWithType` iterate through sections of a few types using the same callback. Current approach would require iterating the section header multiple times.

This Diff add `iterateSectionsWithTypes`, which is basically just `iterateSectionsWithType` but accepts multiple section types.

It is very similar to D6279651. However, in this Diff we did not change implementation of `getDefinitionByAddress` and `getSymbolByName`, since going through `.dynsym` separately would improve the efficiency of single-address or single-symbol lookup. However, for the use cases that we want to iterate through all symbols of an ELF file, this new interface would be useful.

Reviewed By: anakryiko, yfeldblum

Differential Revision: D6281449

fbshipit-source-id: f9afe0a0e95d9fafcd041014abad8ca86d1a882f
folly/experimental/symbolizer/Elf-inl.h
folly/experimental/symbolizer/Elf.h