Index: src/client/linux/microdump_writer/microdump_writer.cc |
diff --git a/src/client/linux/microdump_writer/microdump_writer.cc b/src/client/linux/microdump_writer/microdump_writer.cc |
index 91697ed840f930635c494764cac29ca6dd55b09a..2cbeb4f315483af9166ef2602b01e6d7f704460c 100644 |
--- a/src/client/linux/microdump_writer/microdump_writer.cc |
+++ b/src/client/linux/microdump_writer/microdump_writer.cc |
@@ -32,6 +32,7 @@ |
#include "client/linux/microdump_writer/microdump_writer.h" |
+#include <algorithm> |
#include <sys/utsname.h> |
#include "client/linux/dump_writer_common/thread_info.h" |
@@ -40,11 +41,13 @@ |
#include "client/linux/handler/microdump_extra_info.h" |
#include "client/linux/log/log.h" |
#include "client/linux/minidump_writer/linux_ptrace_dumper.h" |
+#include "common/linux/file_id.h" |
#include "common/linux/linux_libc_support.h" |
namespace { |
using google_breakpad::ExceptionHandler; |
+using google_breakpad::kDefaultBuildIdSize; |
using google_breakpad::LinuxDumper; |
using google_breakpad::LinuxPtraceDumper; |
using google_breakpad::MappingInfo; |
@@ -53,6 +56,7 @@ using google_breakpad::MicrodumpExtraInfo; |
using google_breakpad::RawContextCPU; |
using google_breakpad::ThreadInfo; |
using google_breakpad::UContextReader; |
+using google_breakpad::wasteful_vector; |
const size_t kLineBufferSize = 2048; |
@@ -336,18 +340,25 @@ class MicrodumpWriter { |
bool member, |
unsigned int mapping_id, |
const uint8_t* identifier) { |
- MDGUID module_identifier; |
+ wasteful_vector<uint8_t> identifier_bytes(dumper_->allocator(), |
+ kDefaultBuildIdSize); |
if (identifier) { |
// GUID was provided by caller. |
- my_memcpy(&module_identifier, identifier, sizeof(MDGUID)); |
+ identifier_bytes.resize(sizeof(MDGUID)); |
+ my_memcpy(&identifier_bytes[0], identifier, sizeof(MDGUID)); |
} else { |
dumper_->ElfFileIdentifierForMapping( |
mapping, |
member, |
mapping_id, |
- reinterpret_cast<uint8_t*>(&module_identifier)); |
+ identifier_bytes); |
} |
+ // Copy as many bytes of |identifier| as will fit into a MDGUID |
+ MDGUID module_identifier = {0}; |
+ memcpy(&module_identifier, &identifier_bytes[0], |
+ std::min(sizeof(MDGUID), identifier_bytes.size())); |
+ |
char file_name[NAME_MAX]; |
char file_path[NAME_MAX]; |
dumper_->GetMappingEffectiveNameAndPath( |