aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/linux/minidump_writer/linux_dumper.cc7
-rw-r--r--src/client/linux/minidump_writer/linux_dumper.h5
-rw-r--r--src/client/linux/minidump_writer/linux_dumper_unittest.cc2
-rw-r--r--src/client/linux/minidump_writer/minidump_writer.cc12
4 files changed, 15 insertions, 11 deletions
diff --git a/src/client/linux/minidump_writer/linux_dumper.cc b/src/client/linux/minidump_writer/linux_dumper.cc
index 88900f9b..76dc4db4 100644
--- a/src/client/linux/minidump_writer/linux_dumper.cc
+++ b/src/client/linux/minidump_writer/linux_dumper.cc
@@ -204,10 +204,11 @@ LinuxDumper::BuildProcPath(char* path, pid_t pid, const char* node) const {
bool
LinuxDumper::ElfFileIdentifierForMapping(const MappingInfo& mapping,
- int mapping_id,
+ bool member,
+ unsigned int mapping_id,
uint8_t identifier[sizeof(MDGUID)])
{
- assert(mapping_id == -1 || mapping_id < mappings_.size());
+ assert(!member || mapping_id < mappings_.size());
my_memset(identifier, 0, sizeof(MDGUID));
if (IsMappedFileOpenUnsafe(mapping))
return false;
@@ -239,7 +240,7 @@ LinuxDumper::ElfFileIdentifierForMapping(const MappingInfo& mapping,
bool success = FileID::ElfFileIdentifierFromMappedFile(base, identifier);
sys_munmap(base, st.st_size);
- if (success && mapping_id != -1 && filename_modified) {
+ if (success && member && filename_modified) {
mappings_[mapping_id]->name[filename_len -
sizeof(kDeletedSuffix) + 1] = '\0';
}
diff --git a/src/client/linux/minidump_writer/linux_dumper.h b/src/client/linux/minidump_writer/linux_dumper.h
index c1126a1f..15280200 100644
--- a/src/client/linux/minidump_writer/linux_dumper.h
+++ b/src/client/linux/minidump_writer/linux_dumper.h
@@ -152,9 +152,10 @@ class LinuxDumper {
void BuildProcPath(char* path, pid_t pid, const char* node) const;
// Generate a File ID from the .text section of a mapped entry.
- // mapping_id may be -1 if this is not a member of mappings_.
+ // If not a member, mapping_id is ignored.
bool ElfFileIdentifierForMapping(const MappingInfo& mapping,
- int mapping_id,
+ bool member,
+ unsigned int mapping_id,
uint8_t identifier[sizeof(MDGUID)]);
// Utility method to find the location of where the kernel has
diff --git a/src/client/linux/minidump_writer/linux_dumper_unittest.cc b/src/client/linux/minidump_writer/linux_dumper_unittest.cc
index 3d31c6fc..c537ce93 100644
--- a/src/client/linux/minidump_writer/linux_dumper_unittest.cc
+++ b/src/client/linux/minidump_writer/linux_dumper_unittest.cc
@@ -339,7 +339,7 @@ TEST(LinuxDumperTest, FileIDsMatch) {
uint8_t identifier1[sizeof(MDGUID)];
uint8_t identifier2[sizeof(MDGUID)];
- EXPECT_TRUE(dumper.ElfFileIdentifierForMapping(*mappings[i], i,
+ EXPECT_TRUE(dumper.ElfFileIdentifierForMapping(*mappings[i], true, i,
identifier1));
FileID fileid(exe_name);
EXPECT_TRUE(fileid.ElfFileIdentifier(identifier2));
diff --git a/src/client/linux/minidump_writer/minidump_writer.cc b/src/client/linux/minidump_writer/minidump_writer.cc
index 10084ac4..b738beea 100644
--- a/src/client/linux/minidump_writer/minidump_writer.cc
+++ b/src/client/linux/minidump_writer/minidump_writer.cc
@@ -801,7 +801,7 @@ class MinidumpWriter {
continue;
MDRawModule mod;
- if (!FillRawModule(mapping, i, mod, NULL))
+ if (!FillRawModule(mapping, true, i, mod, NULL))
return false;
list.CopyIndexAfterObject(j++, &mod, MD_MODULE_SIZE);
}
@@ -810,7 +810,7 @@ class MinidumpWriter {
iter != mapping_list_.end();
++iter) {
MDRawModule mod;
- if (!FillRawModule(iter->first, -1, mod, iter->second))
+ if (!FillRawModule(iter->first, false, 0, mod, iter->second))
return false;
list.CopyIndexAfterObject(j++, &mod, MD_MODULE_SIZE);
}
@@ -820,9 +820,10 @@ class MinidumpWriter {
// Fill the MDRawModule |mod| with information about the provided
// |mapping|. If |identifier| is non-NULL, use it instead of calculating
- // a file ID from the mapping. |mapping_id| can be -1.
+ // a file ID from the mapping.
bool FillRawModule(const MappingInfo& mapping,
- int mapping_id,
+ bool member,
+ unsigned int mapping_id,
MDRawModule& mod,
const u_int8_t* identifier) {
my_memset(&mod, 0, MD_MODULE_SIZE);
@@ -857,7 +858,8 @@ class MinidumpWriter {
// GUID was provided by caller.
memcpy(signature, identifier, sizeof(MDGUID));
} else {
- dumper_.ElfFileIdentifierForMapping(mapping, mapping_id, signature);
+ dumper_.ElfFileIdentifierForMapping(mapping, member,
+ mapping_id, signature);
}
my_memset(cv_ptr, 0, sizeof(uint32_t)); // Set age to 0 on Linux.
cv_ptr += sizeof(uint32_t);