Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: src/processor/minidump.cc

Issue 1275173005: Workaround for range map overlaps caused by Android package relocation. (Closed) Base URL: http://google-breakpad.googlecode.com/svn/trunk/
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 Google Inc. 1 // Copyright (c) 2010 Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 module_index << "/" << module_count; 2510 module_index << "/" << module_count;
2511 return false; 2511 return false;
2512 } 2512 }
2513 } 2513 }
2514 2514
2515 // Loop through the module list once more to read additional data and 2515 // Loop through the module list once more to read additional data and
2516 // build the range map. This is done in a second pass because 2516 // build the range map. This is done in a second pass because
2517 // MinidumpModule::ReadAuxiliaryData seeks around, and if it were 2517 // MinidumpModule::ReadAuxiliaryData seeks around, and if it were
2518 // included in the loop above, additional seeks would be needed where 2518 // included in the loop above, additional seeks would be needed where
2519 // none are now to read contiguous data. 2519 // none are now to read contiguous data.
2520 uint64_t last_end_address = 0;
2520 for (unsigned int module_index = 0; 2521 for (unsigned int module_index = 0;
2521 module_index < module_count; 2522 module_index < module_count;
2522 ++module_index) { 2523 ++module_index) {
2523 MinidumpModule* module = &(*modules)[module_index]; 2524 MinidumpModule* module = &(*modules)[module_index];
2524 2525
2525 // ReadAuxiliaryData fails if any data that the module indicates should 2526 // ReadAuxiliaryData fails if any data that the module indicates should
2526 // exist is missing, but we treat some such cases as valid anyway. See 2527 // exist is missing, but we treat some such cases as valid anyway. See
2527 // issue #222: if a debugging record is of a format that's too large to 2528 // issue #222: if a debugging record is of a format that's too large to
2528 // handle, it shouldn't render the entire dump invalid. Check module 2529 // handle, it shouldn't render the entire dump invalid. Check module
2529 // validity before giving up. 2530 // validity before giving up.
(...skipping 17 matching lines...) Expand all
2547 } 2548 }
2548 2549
2549 if (!range_map_->StoreRange(base_address, module_size, module_index)) { 2550 if (!range_map_->StoreRange(base_address, module_size, module_index)) {
2550 // Android's shared memory implementation /dev/ashmem can contain 2551 // Android's shared memory implementation /dev/ashmem can contain
2551 // duplicate entries for JITted code, so ignore these. 2552 // duplicate entries for JITted code, so ignore these.
2552 // TODO(wfh): Remove this code when Android is fixed. 2553 // TODO(wfh): Remove this code when Android is fixed.
2553 // See https://crbug.com/439531 2554 // See https://crbug.com/439531
2554 const string kDevAshmem("/dev/ashmem/"); 2555 const string kDevAshmem("/dev/ashmem/");
2555 if (module->code_file().compare( 2556 if (module->code_file().compare(
2556 0, kDevAshmem.length(), kDevAshmem) != 0) { 2557 0, kDevAshmem.length(), kDevAshmem) != 0) {
2557 BPLOG(ERROR) << "MinidumpModuleList could not store module " << 2558 if (base_address < last_end_address) {
2558 module_index << "/" << module_count << ", " << 2559 // If failed due to apparent range overlap the cause may be
2559 module->code_file() << ", " << 2560 // the client correction applied for Android packed relocations.
2560 HexString(base_address) << "+" << 2561 // If this is the case, back out the client correction and retry.
2561 HexString(module_size); 2562 module_size -= last_end_address - base_address;
2562 return false; 2563 base_address = last_end_address;
2564 if (!range_map_->StoreRange(base_address,
2565 module_size, module_index)) {
2566 BPLOG(ERROR) << "MinidumpModuleList could not store module " <<
2567 module_index << "/" << module_count << ", " <<
2568 module->code_file() << ", " <<
2569 HexString(base_address) << "+" <<
2570 HexString(module_size) << ", after adjusting";
2571 return false;
2572 }
2573 } else {
2574 BPLOG(ERROR) << "MinidumpModuleList could not store module " <<
2575 module_index << "/" << module_count << ", " <<
2576 module->code_file() << ", " <<
2577 HexString(base_address) << "+" <<
2578 HexString(module_size);
2579 return false;
2580 }
2563 } else { 2581 } else {
2564 BPLOG(INFO) << "MinidumpModuleList ignoring overlapping module " << 2582 BPLOG(INFO) << "MinidumpModuleList ignoring overlapping module " <<
2565 module_index << "/" << module_count << ", " << 2583 module_index << "/" << module_count << ", " <<
2566 module->code_file() << ", " << 2584 module->code_file() << ", " <<
2567 HexString(base_address) << "+" << 2585 HexString(base_address) << "+" <<
2568 HexString(module_size); 2586 HexString(module_size);
2569 } 2587 }
2570 } 2588 }
2589 last_end_address = base_address + module_size;
2571 } 2590 }
2572 2591
2573 modules_ = modules.release(); 2592 modules_ = modules.release();
2574 } 2593 }
2575 2594
2576 module_count_ = module_count; 2595 module_count_ = module_count;
2577 2596
2578 valid_ = true; 2597 valid_ = true;
2579 return true; 2598 return true;
2580 } 2599 }
(...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after
4622 return NULL; 4641 return NULL;
4623 } 4642 }
4624 4643
4625 *stream = new_stream.release(); 4644 *stream = new_stream.release();
4626 info->stream = *stream; 4645 info->stream = *stream;
4627 return *stream; 4646 return *stream;
4628 } 4647 }
4629 4648
4630 4649
4631 } // namespace google_breakpad 4650 } // namespace google_breakpad
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698