aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorstuartmorgan <stuartmorgan@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-12-17 20:41:22 +0000
committerstuartmorgan <stuartmorgan@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-12-17 20:41:22 +0000
commit717bf0ded2895d950d0a69ecca780245ec96176d (patch)
treefa0daded231801181b4985d7bb18afd2d812aa0a /src
parentFix MinidumpGenerator::WriteExceptionStream for writing cross-architecture dumps (diff)
downloadbreakpad-717bf0ded2895d950d0a69ecca780245ec96176d.tar.xz
Keep a log of uploaded crash IDs on the Mac. Review URL: http://breakpad.appspot.com/245001
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@748 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src')
-rw-r--r--src/client/mac/Framework/Breakpad.h5
-rw-r--r--src/client/mac/sender/crash_report_sender.m27
2 files changed, 31 insertions, 1 deletions
diff --git a/src/client/mac/Framework/Breakpad.h b/src/client/mac/Framework/Breakpad.h
index 52ea6c6b..fa861431 100644
--- a/src/client/mac/Framework/Breakpad.h
+++ b/src/client/mac/Framework/Breakpad.h
@@ -50,10 +50,13 @@ extern "C" {
#include <CoreFoundation/CoreFoundation.h>
#include <Foundation/Foundation.h>
- // Keys for configuration file
+// Keys for configuration file
#define kReporterMinidumpDirectoryKey "MinidumpDir"
#define kReporterMinidumpIDKey "MinidumpID"
+// Filename for recording uploaded IDs
+#define kReporterLogFilename "uploads.log"
+
// The default subdirectory of the Library to put crash dumps in
// The subdirectory is
// ~/Library/<kDefaultLibrarySubdirectory>/<GoogleBreakpadProduct>
diff --git a/src/client/mac/sender/crash_report_sender.m b/src/client/mac/sender/crash_report_sender.m
index cdee262b..5bf806a3 100644
--- a/src/client/mac/sender/crash_report_sender.m
+++ b/src/client/mac/sender/crash_report_sender.m
@@ -255,6 +255,9 @@ NSString *const kDefaultServerType = @"google";
// in their comments/email.
- (void)controlTextDidBeginEditing:(NSNotification *)aNotification;
+// Records the uploaded crash ID to the log file.
+- (void)logUploadWithID:(const char *)uploadID;
+
@end
@implementation Reporter
@@ -992,6 +995,7 @@ doCommandBySelector:(SEL)commandSelector {
} else {
NSCharacterSet *trimSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
reportID = [[result stringByTrimmingCharactersInSet:trimSet] UTF8String];
+ [self logUploadWithID:reportID];
}
// rename the minidump file according to the id returned from the server
@@ -1036,6 +1040,29 @@ doCommandBySelector:(SEL)commandSelector {
[upload release];
}
+- (void)logUploadWithID:(const char *)uploadID {
+ NSString *minidumpDir =
+ [parameters_ objectForKey:@kReporterMinidumpDirectoryKey];
+ NSString *logFilePath = [NSString stringWithFormat:@"%@/%s",
+ minidumpDir, kReporterLogFilename];
+ NSString *logLine = [NSString stringWithFormat:@"%0.f,%s\n",
+ [[NSDate date] timeIntervalSince1970], uploadID];
+ NSData *logData = [logLine dataUsingEncoding:kCFStringEncodingUTF8];
+
+ NSFileManager *fileManager = [NSFileManager defaultManager];
+ if ([fileManager fileExistsAtPath:logFilePath]) {
+ NSFileHandle *logFileHandle =
+ [NSFileHandle fileHandleForWritingAtPath:logFilePath];
+ [logFileHandle seekToEndOfFile];
+ [logFileHandle writeData:logData];
+ [logFileHandle closeFile];
+ } else {
+ [fileManager createFileAtPath:logFilePath
+ contents:logData
+ attributes:nil];
+ }
+}
+
//=============================================================================
- (void)dealloc {
[parameters_ release];