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:
parent
3b3f0c3f61
commit
23c82999a8
@ -204,10 +204,11 @@ LinuxDumper::BuildProcPath(char* path, pid_t pid, const char* node) const {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
LinuxDumper::ElfFileIdentifierForMapping(const MappingInfo& mapping,
|
LinuxDumper::ElfFileIdentifierForMapping(const MappingInfo& mapping,
|
||||||
int mapping_id,
|
bool member,
|
||||||
|
unsigned int mapping_id,
|
||||||
uint8_t identifier[sizeof(MDGUID)])
|
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));
|
my_memset(identifier, 0, sizeof(MDGUID));
|
||||||
if (IsMappedFileOpenUnsafe(mapping))
|
if (IsMappedFileOpenUnsafe(mapping))
|
||||||
return false;
|
return false;
|
||||||
@ -239,7 +240,7 @@ LinuxDumper::ElfFileIdentifierForMapping(const MappingInfo& mapping,
|
|||||||
|
|
||||||
bool success = FileID::ElfFileIdentifierFromMappedFile(base, identifier);
|
bool success = FileID::ElfFileIdentifierFromMappedFile(base, identifier);
|
||||||
sys_munmap(base, st.st_size);
|
sys_munmap(base, st.st_size);
|
||||||
if (success && mapping_id != -1 && filename_modified) {
|
if (success && member && filename_modified) {
|
||||||
mappings_[mapping_id]->name[filename_len -
|
mappings_[mapping_id]->name[filename_len -
|
||||||
sizeof(kDeletedSuffix) + 1] = '\0';
|
sizeof(kDeletedSuffix) + 1] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -152,9 +152,10 @@ class LinuxDumper {
|
|||||||
void BuildProcPath(char* path, pid_t pid, const char* node) const;
|
void BuildProcPath(char* path, pid_t pid, const char* node) const;
|
||||||
|
|
||||||
// Generate a File ID from the .text section of a mapped entry.
|
// 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,
|
bool ElfFileIdentifierForMapping(const MappingInfo& mapping,
|
||||||
int mapping_id,
|
bool member,
|
||||||
|
unsigned int mapping_id,
|
||||||
uint8_t identifier[sizeof(MDGUID)]);
|
uint8_t identifier[sizeof(MDGUID)]);
|
||||||
|
|
||||||
// Utility method to find the location of where the kernel has
|
// Utility method to find the location of where the kernel has
|
||||||
|
@ -339,7 +339,7 @@ TEST(LinuxDumperTest, FileIDsMatch) {
|
|||||||
|
|
||||||
uint8_t identifier1[sizeof(MDGUID)];
|
uint8_t identifier1[sizeof(MDGUID)];
|
||||||
uint8_t identifier2[sizeof(MDGUID)];
|
uint8_t identifier2[sizeof(MDGUID)];
|
||||||
EXPECT_TRUE(dumper.ElfFileIdentifierForMapping(*mappings[i], i,
|
EXPECT_TRUE(dumper.ElfFileIdentifierForMapping(*mappings[i], true, i,
|
||||||
identifier1));
|
identifier1));
|
||||||
FileID fileid(exe_name);
|
FileID fileid(exe_name);
|
||||||
EXPECT_TRUE(fileid.ElfFileIdentifier(identifier2));
|
EXPECT_TRUE(fileid.ElfFileIdentifier(identifier2));
|
||||||
|
@ -801,7 +801,7 @@ class MinidumpWriter {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
MDRawModule mod;
|
MDRawModule mod;
|
||||||
if (!FillRawModule(mapping, i, mod, NULL))
|
if (!FillRawModule(mapping, true, i, mod, NULL))
|
||||||
return false;
|
return false;
|
||||||
list.CopyIndexAfterObject(j++, &mod, MD_MODULE_SIZE);
|
list.CopyIndexAfterObject(j++, &mod, MD_MODULE_SIZE);
|
||||||
}
|
}
|
||||||
@ -810,7 +810,7 @@ class MinidumpWriter {
|
|||||||
iter != mapping_list_.end();
|
iter != mapping_list_.end();
|
||||||
++iter) {
|
++iter) {
|
||||||
MDRawModule mod;
|
MDRawModule mod;
|
||||||
if (!FillRawModule(iter->first, -1, mod, iter->second))
|
if (!FillRawModule(iter->first, false, 0, mod, iter->second))
|
||||||
return false;
|
return false;
|
||||||
list.CopyIndexAfterObject(j++, &mod, MD_MODULE_SIZE);
|
list.CopyIndexAfterObject(j++, &mod, MD_MODULE_SIZE);
|
||||||
}
|
}
|
||||||
@ -820,9 +820,10 @@ class MinidumpWriter {
|
|||||||
|
|
||||||
// Fill the MDRawModule |mod| with information about the provided
|
// Fill the MDRawModule |mod| with information about the provided
|
||||||
// |mapping|. If |identifier| is non-NULL, use it instead of calculating
|
// |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,
|
bool FillRawModule(const MappingInfo& mapping,
|
||||||
int mapping_id,
|
bool member,
|
||||||
|
unsigned int mapping_id,
|
||||||
MDRawModule& mod,
|
MDRawModule& mod,
|
||||||
const u_int8_t* identifier) {
|
const u_int8_t* identifier) {
|
||||||
my_memset(&mod, 0, MD_MODULE_SIZE);
|
my_memset(&mod, 0, MD_MODULE_SIZE);
|
||||||
@ -857,7 +858,8 @@ class MinidumpWriter {
|
|||||||
// GUID was provided by caller.
|
// GUID was provided by caller.
|
||||||
memcpy(signature, identifier, sizeof(MDGUID));
|
memcpy(signature, identifier, sizeof(MDGUID));
|
||||||
} else {
|
} 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.
|
my_memset(cv_ptr, 0, sizeof(uint32_t)); // Set age to 0 on Linux.
|
||||||
cv_ptr += sizeof(uint32_t);
|
cv_ptr += sizeof(uint32_t);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user