Only do Android-specific adjustments for Android minidumps.

Change-Id: I33b1f988766f79b473127c4b56b1c81021b89631
Reviewed-on: https://chromium-review.googlesource.com/1115436
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Lei Zhang 2018-06-26 11:34:13 -07:00
parent d531e1b2ba
commit fac0e886c8
2 changed files with 10 additions and 5 deletions

View file

@ -544,7 +544,8 @@ class MinidumpModuleList : public MinidumpStream,
bool StoreRange(const MinidumpModule& module,
uint64_t base_address,
uint32_t module_index,
uint32_t module_count);
uint32_t module_count,
bool is_android);
// The largest number of modules that will be read from a minidump. The
// default is 1024.

View file

@ -2725,8 +2725,10 @@ bool MinidumpModuleList::Read(uint32_t expected_size) {
return false;
}
if (!StoreRange(module, base_address, module_index, module_count)) {
if (base_address >= last_end_address) {
const bool is_android = minidump_->IsAndroid();
if (!StoreRange(module, base_address, module_index, module_count,
is_android)) {
if (!is_android || base_address >= last_end_address) {
BPLOG(ERROR) << "MinidumpModuleList could not store module "
<< module_index << "/" << module_count << ", "
<< module.code_file() << ", " << HexString(base_address)
@ -2737,6 +2739,7 @@ bool MinidumpModuleList::Read(uint32_t expected_size) {
// If failed due to apparent range overlap the cause may be the client
// correction applied for Android packed relocations. If this is the
// case, back out the client correction and retry.
assert(is_android);
module_size -= last_end_address - base_address;
base_address = last_end_address;
if (!range_map_->StoreRange(base_address, module_size, module_index)) {
@ -2762,7 +2765,8 @@ bool MinidumpModuleList::Read(uint32_t expected_size) {
bool MinidumpModuleList::StoreRange(const MinidumpModule& module,
uint64_t base_address,
uint32_t module_index,
uint32_t module_count) {
uint32_t module_count,
bool is_android) {
if (range_map_->StoreRange(base_address, module.size(), module_index))
return true;
@ -2770,7 +2774,7 @@ bool MinidumpModuleList::StoreRange(const MinidumpModule& module,
// entries for JITted code, so ignore these.
// TODO(wfh): Remove this code when Android is fixed.
// See https://crbug.com/439531
if (IsDevAshmem(module.code_file())) {
if (is_android && IsDevAshmem(module.code_file())) {
BPLOG(INFO) << "MinidumpModuleList ignoring overlapping module "
<< module_index << "/" << module_count << ", "
<< module.code_file() << ", " << HexString(base_address) << "+"