Another attempt at signed / unsigned int resolution for linux minidump writer.

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@785 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
jessicag.feedback@gmail.com 2011-03-30 21:42:27 +00:00
parent 3b3f0c3f61
commit 23c82999a8
4 changed files with 15 additions and 11 deletions

View File

@ -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';
}

View File

@ -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

View File

@ -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));

View File

@ -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);