aboutsummaryrefslogtreecommitdiff
path: root/src/client/linux/handler/minidump_descriptor.h
diff options
context:
space:
mode:
authormkrebs@chromium.org <mkrebs@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-11-15 00:01:13 +0000
committermkrebs@chromium.org <mkrebs@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2012-11-15 00:01:13 +0000
commitd80f175c1aa2a66b5e5095824240fa3ac2575cd0 (patch)
treee7cd6f5d29fc45740a070c78db642b53b64dd55f /src/client/linux/handler/minidump_descriptor.h
parentFix assertion failure in WriteMappings() for zero modules (diff)
downloadbreakpad-d80f175c1aa2a66b5e5095824240fa3ac2575cd0.tar.xz
Add optional file size limit for minidumps
When there are upwards of 200 threads in a crashing process, each having an 8KB stack, this can result in a huge, 1.8MB minidump file. So I added a parameter that, if set, can compel the minidump writer to dump less stack. More specifically, if the writer expects to go over the limit (due to the number of threads), then it will dump less of a thread's stack after the first 20 threads. There are two ways to specify the limit, depending on how you write minidumps: 1) If you call WriteMinidump() directly, there's now a version of the function that takes the minidump size limit as an argument. 2) If you use the ExceptionHandler class, the MinidumpDescriptor object you pass to it now has a set_size_limit() method you would call before passing it to the constructor. BUG=chromium-os:31447, chromium:154546 TEST=Wrote a size-limit unittest; Ran unittests Review URL: https://breakpad.appspot.com/487002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1082 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/linux/handler/minidump_descriptor.h')
-rw-r--r--src/client/linux/handler/minidump_descriptor.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/client/linux/handler/minidump_descriptor.h b/src/client/linux/handler/minidump_descriptor.h
index dc2719ac..3036cadb 100644
--- a/src/client/linux/handler/minidump_descriptor.h
+++ b/src/client/linux/handler/minidump_descriptor.h
@@ -31,6 +31,8 @@
#define CLIENT_LINUX_HANDLER_MINIDUMP_DESCRIPTOR_H_
#include <assert.h>
+#include <sys/types.h>
+
#include <string>
#include "common/using_std_string.h"
@@ -48,11 +50,15 @@ class MinidumpDescriptor {
explicit MinidumpDescriptor(const string& directory)
: fd_(-1),
directory_(directory),
- c_path_(NULL) {
+ c_path_(NULL),
+ size_limit_(-1) {
assert(!directory.empty());
}
- explicit MinidumpDescriptor(int fd) : fd_(fd), c_path_(NULL) {
+ explicit MinidumpDescriptor(int fd)
+ : fd_(fd),
+ c_path_(NULL),
+ size_limit_(-1) {
assert(fd != -1);
}
@@ -71,6 +77,9 @@ class MinidumpDescriptor {
// Should be called from a normal context: this methods uses the heap.
void UpdatePath();
+ off_t size_limit() const { return size_limit_; }
+ void set_size_limit(off_t limit) { size_limit_ = limit; }
+
private:
// The file descriptor where the minidump is generated.
int fd_;
@@ -82,6 +91,8 @@ class MinidumpDescriptor {
// The C string of |path_|. Precomputed so it can be access from a compromised
// context.
const char* c_path_;
+
+ off_t size_limit_;
};
} // namespace google_breakpad