From 833cadc0a11f0a061cc8057ee56debe89e412973 Mon Sep 17 00:00:00 2001 From: Tobias Sargeant Date: Wed, 18 Jan 2017 15:19:51 +0000 Subject: Add API to skip dump if crashing thread doesn't reference a given module This CL makes it possible to skip a dump if the crashing thread doesn't have any pointers to a given module. The concrete use case is WebView where we would like to skip generating microdump output when webview is unreferenced by the stack and thus cannot be responsible for the crash in a way that would be debuggable. The range of interesting addresses is chosen by examining the process mappings to find the one that contains a pointer that is known to be in the right shared object (i.e. an appropriately chosen function pointer) passed from the client. If the extracted stack does not contain a pointer in this range, then we do not generate a microdump. If the stack extraction fails, we still generate a microdump (without a stack). BUG=664460 Change-Id: If19406a13168264f7751245fc39591bd6cdbf5df Reviewed-on: https://chromium-review.googlesource.com/419476 Reviewed-by: Robert Sesek Reviewed-by: Primiano Tucci --- src/client/linux/handler/minidump_descriptor.h | 43 +++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'src/client/linux/handler/minidump_descriptor.h') diff --git a/src/client/linux/handler/minidump_descriptor.h b/src/client/linux/handler/minidump_descriptor.h index 782a60a4..f601427c 100644 --- a/src/client/linux/handler/minidump_descriptor.h +++ b/src/client/linux/handler/minidump_descriptor.h @@ -53,14 +53,18 @@ class MinidumpDescriptor { MinidumpDescriptor() : mode_(kUninitialized), fd_(-1), - size_limit_(-1) {} + size_limit_(-1), + address_within_principal_mapping_(0), + skip_dump_if_principal_mapping_not_referenced_(false) {} explicit MinidumpDescriptor(const string& directory) : mode_(kWriteMinidumpToFile), fd_(-1), directory_(directory), c_path_(NULL), - size_limit_(-1) { + size_limit_(-1), + address_within_principal_mapping_(0), + skip_dump_if_principal_mapping_not_referenced_(false) { assert(!directory.empty()); } @@ -68,14 +72,18 @@ class MinidumpDescriptor { : mode_(kWriteMinidumpToFd), fd_(fd), c_path_(NULL), - size_limit_(-1) { + size_limit_(-1), + address_within_principal_mapping_(0), + skip_dump_if_principal_mapping_not_referenced_(false) { assert(fd != -1); } explicit MinidumpDescriptor(const MicrodumpOnConsole&) : mode_(kWriteMicrodumpToConsole), fd_(-1), - size_limit_(-1) {} + size_limit_(-1), + address_within_principal_mapping_(0), + skip_dump_if_principal_mapping_not_referenced_(false) {} explicit MinidumpDescriptor(const MinidumpDescriptor& descriptor); MinidumpDescriptor& operator=(const MinidumpDescriptor& descriptor); @@ -101,6 +109,23 @@ class MinidumpDescriptor { off_t size_limit() const { return size_limit_; } void set_size_limit(off_t limit) { size_limit_ = limit; } + uintptr_t address_within_principal_mapping() const { + return address_within_principal_mapping_; + } + void set_address_within_principal_mapping( + uintptr_t address_within_principal_mapping) { + address_within_principal_mapping_ = address_within_principal_mapping; + } + + bool skip_dump_if_principal_mapping_not_referenced() { + return skip_dump_if_principal_mapping_not_referenced_; + } + void set_skip_dump_if_principal_mapping_not_referenced( + bool skip_dump_if_principal_mapping_not_referenced) { + skip_dump_if_principal_mapping_not_referenced_ = + skip_dump_if_principal_mapping_not_referenced; + } + MicrodumpExtraInfo* microdump_extra_info() { assert(IsMicrodumpOnConsole()); return µdump_extra_info_; @@ -132,6 +157,16 @@ class MinidumpDescriptor { off_t size_limit_; + // This member points somewhere into the main module for this + // process (the module that is considerered interesting for the + // purposes of debugging crashes). + uintptr_t address_within_principal_mapping_; + + // If set, threads that do not reference the address range + // associated with |address_within_principal_mapping_| will not have their + // stacks logged. + bool skip_dump_if_principal_mapping_not_referenced_; + // The extra microdump data (e.g. product name/version, build // fingerprint, gpu fingerprint) that should be appended to the dump // (microdump only). Microdumps don't have the ability of appending -- cgit v1.2.1