| Index: client/linux/minidump_writer/linux_dumper.h
|
| diff --git a/client/linux/minidump_writer/linux_dumper.h b/client/linux/minidump_writer/linux_dumper.h
|
| index 87dfadb4fda85b88c964007af58dfc1be1f94d06..1ca74824dee1ab9408b8647d1ba144b9d5c23e30 100644
|
| --- a/client/linux/minidump_writer/linux_dumper.h
|
| +++ b/client/linux/minidump_writer/linux_dumper.h
|
| @@ -39,6 +39,7 @@
|
| #define CLIENT_LINUX_MINIDUMP_WRITER_LINUX_DUMPER_H_
|
|
|
| #include <elf.h>
|
| +#include <link.h>
|
| #include <linux/limits.h>
|
| #include <stdint.h>
|
| #include <sys/types.h>
|
| @@ -73,8 +74,12 @@ class LinuxDumper {
|
|
|
| virtual ~LinuxDumper();
|
|
|
| - // Parse the data for |threads| and |mappings|.
|
| + // Parse the data for |threads| and |mappings|. LateInit() should be
|
| + // called after all other caller's initialization is complete, and in
|
| + // particular after it has called ThreadsSuspend(), so that ptrace is
|
| + // available.
|
| virtual bool Init();
|
| + virtual bool LateInit();
|
|
|
| // Return true if the dumper performs a post-mortem dump.
|
| virtual bool IsPostMortem() const = 0;
|
| @@ -149,6 +154,56 @@ class LinuxDumper {
|
|
|
| virtual bool EnumerateThreads() = 0;
|
|
|
| +#if defined(__ANDROID__)
|
| + // Android M and later support packed ELF relocations in shared libraries.
|
| + // Packing relocations changes the vaddr of the LOAD segments, such that
|
| + // the effective load bias is no longer the same as the start address of
|
| + // the memory mapping containing the executable parts of the library. The
|
| + // packing is applied to the stripped library run on the target, but not to
|
| + // any other library, and in particular not to the library used to generate
|
| + // breakpad symbols. As a result, we need to adjust the start_addr value for
|
| + // any mapping that results from a shared library that contains Android
|
| + // packed relocations, so that it properly represents the effective library
|
| + // load bias. The following functions support this adjustment.
|
| +
|
| + // Check that a given mapping at |start_addr| is for an ELF shared library.
|
| + // If it is, place the ELF header in |ehdr| and return true.
|
| + virtual bool GetLoadedElfHeader(uintptr_t start_addr, ElfW(Ehdr)* ehdr);
|
| +
|
| + // For the ELF file mapped at |start_addr|, find the min vaddr of all
|
| + // program header LOAD segments, the vaddr for the DYNAMIC segment, and
|
| + // a count of DYNAMIC entries. Return values in |min_vaddr_ptr|,
|
| + // |dyn_vaddr_ptr|, and |dyn_count_ptr|.
|
| + virtual void ParseLoadedElfProgramHeaders(ElfW(Ehdr)* ehdr,
|
| + uintptr_t start_addr,
|
| + uintptr_t* min_vaddr_ptr,
|
| + uintptr_t* dyn_vaddr_ptr,
|
| + size_t* dyn_count_ptr);
|
| +
|
| + // Search the DYNAMIC tags for the ELF file with the given |load_bias|, and
|
| + // return true if the tags indicate that the file contains Android packed
|
| + // relocations.
|
| + virtual bool HasAndroidPackedRelocations(uintptr_t load_bias,
|
| + uintptr_t dyn_vaddr,
|
| + size_t dyn_count);
|
| +
|
| + // If the ELF file mapped at |start_addr| contained Android packed
|
| + // relocations, return the load bias that the system linker (or Chromium
|
| + // crazy linker) will have used. If the file did not contain Android
|
| + // packed relocations, returns |start_addr|, indicating that no adjustment
|
| + // is necessary.
|
| + virtual uintptr_t GetEffectiveLoadBias(ElfW(Ehdr)* ehdr,
|
| + uintptr_t start_addr);
|
| +
|
| + // Called from LateInit(). Iterates mappings_ and rewrites the start_addr
|
| + // field of any that represent ELF shared libraries with Android packed
|
| + // relocations, so that start_addr is the load_bias that the system linker
|
| + // (or Chromium crazy linker) used. This value matches the addresses produced
|
| + // when the non-relocation-packed library is used for breakpad symbol
|
| + // generation.
|
| + virtual bool LatePostprocessMappings();
|
| +#endif // __ANDROID__
|
| +
|
| // For the case where a running program has been deleted, it'll show up in
|
| // /proc/pid/maps as "/path/to/program (deleted)". If this is the case, then
|
| // see if '/path/to/program (deleted)' matches /proc/pid/exe and return
|
|
|