diff options
author | qsr@chromium.org <qsr@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2011-10-20 15:22:48 +0000 |
---|---|---|
committer | qsr@chromium.org <qsr@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2011-10-20 15:22:48 +0000 |
commit | 446616ee2276a4b9a30adf796c3a7bc692eb8239 (patch) | |
tree | 7addca2038878761508fc6c3597b32be796ae842 /src/client/mac | |
parent | Fix svn:executable and svn:eol-style properties in src/client/windows. (diff) | |
download | breakpad-446616ee2276a4b9a30adf796c3a7bc692eb8239.tar.xz |
Allow to retrieve id of a module from memory instead of going to disk for iOS.
Allow macho_id and macho_walker to read data from memory.
Wire up this when reading module on iOS.
Review URL: http://breakpad.appspot.com/319001
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@873 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/mac')
-rw-r--r-- | src/client/mac/handler/minidump_generator.cc | 28 | ||||
-rw-r--r-- | src/client/mac/handler/minidump_generator.h | 4 |
2 files changed, 25 insertions, 7 deletions
diff --git a/src/client/mac/handler/minidump_generator.cc b/src/client/mac/handler/minidump_generator.cc index 05ee8312..f245f66d 100644 --- a/src/client/mac/handler/minidump_generator.cc +++ b/src/client/mac/handler/minidump_generator.cc @@ -54,6 +54,7 @@ #include "client/minidump_file_writer-inl.h" #include "common/mac/file_id.h" +#include "common/mac/macho_id.h" #include "common/mac/string_utilities.h" using MacStringUtils::ConvertToString; @@ -1160,7 +1161,7 @@ bool MinidumpGenerator::WriteModuleStream(unsigned int index, module->version_info.file_version_lo |= (modVersion & 0xff); } - if (!WriteCVRecord(module, image->GetCPUType(), name.c_str())) { + if (!WriteCVRecord(module, image->GetCPUType(), name.c_str(), false)) { return false; } } else { @@ -1206,7 +1207,11 @@ bool MinidumpGenerator::WriteModuleStream(unsigned int index, module->size_of_image = static_cast<u_int32_t>(seg->vmsize); module->module_name_rva = string_location.rva; - if (!WriteCVRecord(module, cpu_type, name)) + bool in_memory = false; +#if TARGET_OS_IPHONE + in_memory = true; +#endif + if (!WriteCVRecord(module, cpu_type, name, in_memory)) return false; return true; @@ -1244,7 +1249,7 @@ int MinidumpGenerator::FindExecutableModule() { } bool MinidumpGenerator::WriteCVRecord(MDRawModule *module, int cpu_type, - const char *module_path) { + const char *module_path, bool in_memory) { TypedMDRVA<MDCVInfoPDB70> cv(&writer_); // Only return the last path component of the full module path @@ -1270,10 +1275,23 @@ bool MinidumpGenerator::WriteCVRecord(MDRawModule *module, int cpu_type, cv_ptr->age = 0; // Get the module identifier - FileID file_id(module_path); unsigned char identifier[16]; + bool result = false; + if (in_memory) { + MacFileUtilities::MachoID macho(module_path, + reinterpret_cast<void *>(module->base_of_image), + static_cast<size_t>(module->size_of_image)); + result = macho.UUIDCommand(cpu_type, identifier); + if (!result) + result = macho.MD5(cpu_type, identifier); + } + + if (!result) { + FileID file_id(module_path); + result = file_id.MachoIdentifier(cpu_type, identifier); + } - if (file_id.MachoIdentifier(cpu_type, identifier)) { + if (result) { cv_ptr->signature.data1 = (uint32_t)identifier[0] << 24 | (uint32_t)identifier[1] << 16 | (uint32_t)identifier[2] << 8 | (uint32_t)identifier[3]; diff --git a/src/client/mac/handler/minidump_generator.h b/src/client/mac/handler/minidump_generator.h index 3ceb95be..7e932073 100644 --- a/src/client/mac/handler/minidump_generator.h +++ b/src/client/mac/handler/minidump_generator.h @@ -128,8 +128,8 @@ class MinidumpGenerator { bool WriteContext(breakpad_thread_state_data_t state, MDLocationDescriptor *register_location); bool WriteThreadStream(mach_port_t thread_id, MDRawThread *thread); - bool WriteCVRecord(MDRawModule *module, int cpu_type, - const char *module_path); + bool WriteCVRecord(MDRawModule *module, int cpu_type, + const char *module_path, bool in_memory); bool WriteModuleStream(unsigned int index, MDRawModule *module); size_t CalculateStackSize(mach_vm_address_t start_addr); int FindExecutableModule(); |