summaryrefslogtreecommitdiffstats
path: root/chrome/app
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-15 16:39:20 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-15 16:39:20 +0000
commit9dba11137698bbf5c72a39ccb01fc61da9f4821f (patch)
treef992fb233fdacde34921182b1fd46f6b5a5712c5 /chrome/app
parent555fce323fa89322deeefdaf15df3e2cc7319e6c (diff)
downloadchromium_src-9dba11137698bbf5c72a39ccb01fc61da9f4821f.zip
chromium_src-9dba11137698bbf5c72a39ccb01fc61da9f4821f.tar.gz
chromium_src-9dba11137698bbf5c72a39ccb01fc61da9f4821f.tar.bz2
Add env variable to write minidumps to a preset directory.
Add an |BREAKPAD_DUMP_LOCATION| environmental variable to allow overriding the default location for minidump generation. This is for ChromeBot who need a single copy of the Chrome bundle which can be run several times alternating the location of crash dumps. This isn't implemented as a command line flag because only some command line flags are passed to child processes and we need a robust solution. TEST=Minidumps should still be written for browser and renderer crashes. Review URL: http://codereview.chromium.org/264038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29126 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app')
-rw-r--r--chrome/app/breakpad_mac.mm29
1 files changed, 29 insertions, 0 deletions
diff --git a/chrome/app/breakpad_mac.mm b/chrome/app/breakpad_mac.mm
index 11d9c00..11b08d6 100644
--- a/chrome/app/breakpad_mac.mm
+++ b/chrome/app/breakpad_mac.mm
@@ -9,6 +9,8 @@
#include "base/base_switches.h"
#import "base/basictypes.h"
#include "base/command_line.h"
+#include "base/file_path.h"
+#include "base/file_util.h"
#import "base/logging.h"
#include "base/mac_util.h"
#import "base/scoped_nsautorelease_pool.h"
@@ -85,6 +87,33 @@ void InitCrashReporter() {
if (is_browser)
[breakpad_config setObject:@"NO" forKey:@BREAKPAD_SEND_AND_EXIT];
+ // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate
+ // location to write brekapad crash dumps can be set.
+ const char* alternate_minidump_location = getenv("BREAKPAD_DUMP_LOCATION");
+ if (alternate_minidump_location) {
+ FilePath alternate_minidump_location_path(alternate_minidump_location);
+ if (!file_util::PathExists(alternate_minidump_location_path)) {
+ LOG(ERROR) << "Directory " << alternate_minidump_location <<
+ " doesn't exist";
+ } else {
+ NSFileManager* file_manager = [NSFileManager defaultManager];
+ size_t minidump_location_len = strlen(alternate_minidump_location);
+ DCHECK(minidump_location_len > 0);
+ NSString* minidump_location = [file_manager
+ stringWithFileSystemRepresentation:alternate_minidump_location
+ length:minidump_location_len];
+ [breakpad_config
+ setObject:minidump_location
+ forKey:@BREAKPAD_DUMP_DIRECTORY];
+ if (is_browser) {
+ // Print out confirmation message to the stdout, but only print
+ // from browser process so we don't flood the terminal.
+ LOG(WARNING) << "Breakpad dumps will now be written in " <<
+ alternate_minidump_location;
+ }
+ }
+ }
+
// Initialize Breakpad.
gBreakpadRef = BreakpadCreate(breakpad_config);
if (!gBreakpadRef) {