• R/O
  • HTTP
  • SSH
  • HTTPS

thirdparty-breakpad: Commit

Breakpad, a crash reporter, from Google.

Original home: https://chromium.googlesource.com/breakpad/breakpad/


Commit MetaInfo

Révision9b23ca3a7cc4e3d310969dc9daa74b26327ac70f (tree)
l'heure2017-10-18 05:19:03
AuteurPeter Collingbourne <pcc@goog...>
CommiterMike Frysinger

Message de Log

Move main executable handling out of procmaps parser loop.

If the mapping for the main executable needed to be merged (for
example, if it was linked with lld and therefore contains an r mapping
followed by an r/x mapping), we would never reach the code that makes
it the first module. Handle that situation by moving that code into
a separate loop.

This fixes an issue where breakpad_unittests fails on Android devices
when linked with lld. It appears that the glibc dynamic loader
happens to always load executables (or at least the executables that
we create) at a lower address than DSOs, so we never hit this bug on
desktop Linux.

Testing: "make check" with both gold and lld as linker. Also
breakpad_unittests when patched into Chromium on Linux (lld) and
Android (gold and lld).

Bug: chromium:469376
Change-Id: I6329e4afd2f1bf44c25a6c3e684495e21dba83a6
Reviewed-on: https://chromium-review.googlesource.com/722286
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>

Change Summary

Modification

--- a/src/client/linux/minidump_writer/linux_dumper.cc
+++ b/src/client/linux/minidump_writer/linux_dumper.cc
@@ -611,6 +611,7 @@ bool LinuxDumper::EnumerateMappings() {
611611 }
612612 }
613613 MappingInfo* const module = new(allocator_) MappingInfo;
614+ mappings_.push_back(module);
614615 my_memset(module, 0, sizeof(MappingInfo));
615616 module->system_mapping_info.start_addr = start_addr;
616617 module->system_mapping_info.end_addr = end_addr;
@@ -623,31 +624,32 @@ bool LinuxDumper::EnumerateMappings() {
623624 if (l < sizeof(module->name))
624625 my_memcpy(module->name, name, l);
625626 }
626- // If this is the entry-point mapping, and it's not already the
627- // first one, then we need to make it be first. This is because
628- // the minidump format assumes the first module is the one that
629- // corresponds to the main executable (as codified in
630- // processor/minidump.cc:MinidumpModuleList::GetMainModule()).
631- if (entry_point_loc &&
632- (entry_point_loc >=
633- reinterpret_cast<void*>(module->start_addr)) &&
634- (entry_point_loc <
635- reinterpret_cast<void*>(module->start_addr+module->size)) &&
636- !mappings_.empty()) {
637- // push the module onto the front of the list.
638- mappings_.resize(mappings_.size() + 1);
639- for (size_t idx = mappings_.size() - 1; idx > 0; idx--)
640- mappings_[idx] = mappings_[idx - 1];
641- mappings_[0] = module;
642- } else {
643- mappings_.push_back(module);
644- }
645627 }
646628 }
647629 }
648630 line_reader->PopLine(line_len);
649631 }
650632
633+ if (entry_point_loc) {
634+ for (size_t i = 0; i < mappings_.size(); ++i) {
635+ MappingInfo* module = mappings_[i];
636+
637+ // If this module contains the entry-point, and it's not already the first
638+ // one, then we need to make it be first. This is because the minidump
639+ // format assumes the first module is the one that corresponds to the main
640+ // executable (as codified in
641+ // processor/minidump.cc:MinidumpModuleList::GetMainModule()).
642+ if ((entry_point_loc >= reinterpret_cast<void*>(module->start_addr)) &&
643+ (entry_point_loc <
644+ reinterpret_cast<void*>(module->start_addr + module->size))) {
645+ for (size_t j = i; j > 0; j--)
646+ mappings_[j] = mappings_[j - 1];
647+ mappings_[0] = module;
648+ break;
649+ }
650+ }
651+ }
652+
651653 sys_close(fd);
652654
653655 return !mappings_.empty();
Afficher sur ancien navigateur de dépôt.