Merge adjacent mappings with the same name into one module in LinuxDumper.
A=Mike Hommey <mh+mozilla@glandium.org> R=ted at https://bugzilla.mozilla.org/show_bug.cgi?id=637316
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@781 4c0a9323-5329-0410-9bdc-e9ce6186880e
diff --git a/src/client/linux/minidump_writer/linux_dumper.cc b/src/client/linux/minidump_writer/linux_dumper.cc
index 4a4b5e7..88900f9 100644
--- a/src/client/linux/minidump_writer/linux_dumper.cc
+++ b/src/client/linux/minidump_writer/linux_dumper.cc
@@ -306,25 +306,36 @@
if (*i2 == ' ') {
const char* i3 = my_read_hex_ptr(&offset, i2 + 6 /* skip ' rwxp ' */);
if (*i3 == ' ') {
+ const char* name = NULL;
+ // Only copy name if the name is a valid path name, or if
+ // it's the VDSO image.
+ if (((name = my_strchr(line, '/')) == NULL) &&
+ linux_gate_loc &&
+ reinterpret_cast<void*>(start_addr) == linux_gate_loc) {
+ name = kLinuxGateLibraryName;
+ offset = 0;
+ }
+ // Merge adjacent mappings with the same name into one module,
+ // assuming they're a single library mapped by the dynamic linker
+ if (name && result->size()) {
+ MappingInfo* module = (*result)[result->size() - 1];
+ if ((start_addr == module->start_addr + module->size) &&
+ (my_strlen(name) == my_strlen(module->name)) &&
+ (my_strncmp(name, module->name, my_strlen(name)) == 0)) {
+ module->size = end_addr - module->start_addr;
+ line_reader->PopLine(line_len);
+ continue;
+ }
+ }
MappingInfo* const module = new(allocator_) MappingInfo;
memset(module, 0, sizeof(MappingInfo));
module->start_addr = start_addr;
module->size = end_addr - start_addr;
module->offset = offset;
- const char* name = NULL;
- // Only copy name if the name is a valid path name, or if
- // it's the VDSO image.
- if ((name = my_strchr(line, '/')) != NULL) {
+ if (name != NULL) {
const unsigned l = my_strlen(name);
if (l < sizeof(module->name))
memcpy(module->name, name, l);
- } else if (linux_gate_loc &&
- reinterpret_cast<void*>(module->start_addr) ==
- linux_gate_loc) {
- memcpy(module->name,
- kLinuxGateLibraryName,
- my_strlen(kLinuxGateLibraryName));
- module->offset = 0;
}
result->push_back(module);
}