aboutsummaryrefslogtreecommitdiff
path: root/src/client/linux/minidump_writer/linux_dumper.cc
diff options
context:
space:
mode:
authorted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e>2011-03-14 17:04:09 +0000
committerted.mielczarek <ted.mielczarek@4c0a9323-5329-0410-9bdc-e9ce6186880e>2011-03-14 17:04:09 +0000
commitb0201df935961a6d14a4a633d6cffa1d757f0e4a (patch)
tree7598967598f3cfa542f9b6457104bc6e5cd12cf2 /src/client/linux/minidump_writer/linux_dumper.cc
parentProtect "std::max", "std::min" against MACROs defined in WinDef.h. (diff)
downloadbreakpad-b0201df935961a6d14a4a633d6cffa1d757f0e4a.tar.xz
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
Diffstat (limited to 'src/client/linux/minidump_writer/linux_dumper.cc')
-rw-r--r--src/client/linux/minidump_writer/linux_dumper.cc33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/client/linux/minidump_writer/linux_dumper.cc b/src/client/linux/minidump_writer/linux_dumper.cc
index 4a4b5e72..88900f9b 100644
--- a/src/client/linux/minidump_writer/linux_dumper.cc
+++ b/src/client/linux/minidump_writer/linux_dumper.cc
@@ -306,25 +306,36 @@ LinuxDumper::EnumerateMappings(wasteful_vector<MappingInfo*>* result) const {
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);
}