diff options
author | Peter Collingbourne <pcc@google.com> | 2017-05-26 09:19:37 -0700 |
---|---|---|
committer | Mark Mentovai <mark@chromium.org> | 2017-05-26 16:43:47 +0000 |
commit | 08bea455d44de8ca287ae0b10b2028fbd8c62619 (patch) | |
tree | b86b24d67c6be860f41fc823b192338797e53b9b /src/common/linux/elfutils.h | |
parent | Make the cross-compilation glue for dump_syms Mac handle x86_64h. (diff) | |
download | breakpad-08bea455d44de8ca287ae0b10b2028fbd8c62619.tar.xz |
Teach the ELF parser to handle multiple PT_NOTE phdrs.
It is legal for an ELF to contain multiple PT_NOTEs, and that is in
fact what lld's output looks like.
Testing: "make check" and breakpad_unittests when patched into
chromium.
Bug: chromium:716484
Change-Id: I01d3f8679961e2cb7e789d4007de8914c6af357d
Reviewed-on: https://chromium-review.googlesource.com/513512
Reviewed-by: Primiano Tucci <primiano@chromium.org>
Reviewed-by: Ted Mielczarek <ted@mielczarek.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Diffstat (limited to 'src/common/linux/elfutils.h')
-rw-r--r-- | src/common/linux/elfutils.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/common/linux/elfutils.h b/src/common/linux/elfutils.h index bcc74ea4..3a77dd08 100644 --- a/src/common/linux/elfutils.h +++ b/src/common/linux/elfutils.h @@ -37,6 +37,8 @@ #include <link.h> #include <stdint.h> +#include "common/memory.h" + namespace google_breakpad { // Traits classes so consumers can write templatized code to deal @@ -99,14 +101,17 @@ FindElfSectionByName(const char* name, const char* names_end, int nsection); -// Attempt to find the first segment of type |segment_type| in the ELF -// binary data at |elf_mapped_base|. On success, returns true and sets -// |*segment_start| to point to the start of the segment data, and -// and |*segment_size| to the size of the segment's data. -bool FindElfSegment(const void *elf_mapped_base, - uint32_t segment_type, - const void **segment_start, - size_t *segment_size); +struct ElfSegment { + const void* start; + size_t size; +}; + +// Attempt to find all segments of type |segment_type| in the ELF +// binary data at |elf_mapped_base|. On success, returns true and fills +// |*segments| with a list of segments of the given type. +bool FindElfSegments(const void* elf_mapped_base, + uint32_t segment_type, + wasteful_vector<ElfSegment>* segments); // Convert an offset from an Elf header into a pointer to the mapped // address in the current process. Takes an extra template parameter |