Chromium Code Reviews| 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 fc29b7143517d9d5ae6a6a899515f7e5b41f1dab..500c461843aeffc34a9e6ce67fcba6224b0876d1 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> |
|
Lei Zhang
2016/02/10 23:08:50
nit: C headers before C++ headers.
|
| #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::kMaxBuildID; |
| using google_breakpad::LinuxDumper; |
| using google_breakpad::LinuxPtraceDumper; |
| using google_breakpad::MappingInfo; |
| @@ -336,18 +339,26 @@ class MicrodumpWriter { |
| bool member, |
| unsigned int mapping_id, |
| const uint8_t* identifier) { |
| - MDGUID module_identifier; |
| + uint8_t identifier_bytes[kMaxBuildID]; |
| + size_t identifier_length = 0; |
| if (identifier) { |
| // GUID was provided by caller. |
| - my_memcpy(&module_identifier, identifier, sizeof(MDGUID)); |
| + my_memcpy(&identifier_bytes, identifier, sizeof(MDGUID)); |
| + identifier_length = sizeof(MDGUID); |
| } else { |
| dumper_->ElfFileIdentifierForMapping( |
| mapping, |
| member, |
| mapping_id, |
| - reinterpret_cast<uint8_t*>(&module_identifier)); |
| + identifier_bytes, |
| + &identifier_length); |
| } |
| + // Copy as many bytes of |identifier| as will fit into a MDGUID |
| + MDGUID module_identifier = {0}; |
| + memcpy(&module_identifier, identifier_bytes, |
| + std::min(sizeof(MDGUID), identifier_length)); |
| + |
| char file_name[NAME_MAX]; |
| char file_path[NAME_MAX]; |
| LinuxDumper::GetMappingEffectiveNameAndPath( |