aboutsummaryrefslogtreecommitdiff
path: root/src/client/linux/microdump_writer
diff options
context:
space:
mode:
authorTed Mielczarek <ted@mielczarek.org>2016-04-05 09:34:20 -0400
committerTed Mielczarek <ted@mielczarek.org>2016-04-05 09:34:20 -0400
commit6c8f80aa8b3ba8120c4158c069bb298c044dedf9 (patch)
tree2164203da75d894883e042368c34370f6c3af4c8 /src/client/linux/microdump_writer
parentsample_app: enable C++11 for Android builds (diff)
downloadbreakpad-6c8f80aa8b3ba8120c4158c069bb298c044dedf9.tar.xz
Switch the Linux minidump writer to use MDCVInfoELF for CV data.
This preserves full build ids in minidumps, which are useful for tracking down the right version of system libraries from Linux distributions. The default build id produced by GNU binutils' ld is a 160-bit SHA-1 hash of some parts of the binary, which is exactly 20 bytes: https://sourceware.org/binutils/docs-2.26/ld/Options.html#index-g_t_002d_002dbuild_002did-292 The bulk of the changes here are to change the signatures of the FileID methods to use a wasteful_vector instead of raw pointers, since build ids can be of arbitrary length. The previous change that added support for this in the processor code preserved the return value of `Minidump::debug_identifier()` as the current `GUID+age` treatment for backwards-compatibility, and exposed the full build id from `Minidump::code_identifier()`, which was previously stubbed out for Linux dumps. This change keeps the debug ID in the `dump_syms` output the same to match. R=mark@chromium.org, thestig@chromium.org BUG= Review URL: https://codereview.chromium.org/1688743002 .
Diffstat (limited to 'src/client/linux/microdump_writer')
-rw-r--r--src/client/linux/microdump_writer/microdump_writer.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/client/linux/microdump_writer/microdump_writer.cc b/src/client/linux/microdump_writer/microdump_writer.cc
index 91697ed8..d459d9ec 100644
--- a/src/client/linux/microdump_writer/microdump_writer.cc
+++ b/src/client/linux/microdump_writer/microdump_writer.cc
@@ -34,17 +34,22 @@
#include <sys/utsname.h>
+#include <algorithm>
+
#include "client/linux/dump_writer_common/thread_info.h"
#include "client/linux/dump_writer_common/ucontext_reader.h"
#include "client/linux/handler/exception_handler.h"
#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::auto_wasteful_vector;
using google_breakpad::ExceptionHandler;
+using google_breakpad::kDefaultBuildIdSize;
using google_breakpad::LinuxDumper;
using google_breakpad::LinuxPtraceDumper;
using google_breakpad::MappingInfo;
@@ -336,18 +341,28 @@ class MicrodumpWriter {
bool member,
unsigned int mapping_id,
const uint8_t* identifier) {
- MDGUID module_identifier;
+
+ auto_wasteful_vector<uint8_t, kDefaultBuildIdSize> identifier_bytes(
+ dumper_->allocator());
+
if (identifier) {
// GUID was provided by caller.
- my_memcpy(&module_identifier, identifier, sizeof(MDGUID));
+ identifier_bytes.insert(identifier_bytes.end(),
+ identifier,
+ 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(