Skip to content

Commit 67d3745

Browse files
committed
Update breakpad to chrome_64
1 parent 333ac64 commit 67d3745

File tree

181 files changed

+8350
-158123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+8350
-158123
lines changed

vendor/google-breakpad/src/build/common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@
894894
],
895895
'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
896896
'msvs_disabled_warnings': [
897-
4100, 4127, 4396, 4503, 4512, 4819, 4995, 4702
897+
4091, 4100, 4127, 4366, 4396, 4503, 4512, 4819, 4995, 4702
898898
],
899899
'msvs_settings': {
900900
'VCCLCompilerTool': {

vendor/google-breakpad/src/build/testing.gypi

Lines changed: 0 additions & 90 deletions
This file was deleted.

vendor/google-breakpad/src/client/ios/Breakpad.mm

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,23 @@
3636
#include <pthread.h>
3737
#include <sys/stat.h>
3838
#include <sys/sysctl.h>
39+
#include <TargetConditionals.h>
40+
41+
#include <string>
3942

4043
#import "client/ios/handler/ios_exception_minidump_generator.h"
4144
#import "client/mac/crash_generation/ConfigFile.h"
4245
#import "client/mac/handler/exception_handler.h"
4346
#import "client/mac/handler/minidump_generator.h"
44-
#import "client/mac/sender/uploader.h"
4547
#import "client/mac/handler/protected_memory_allocator.h"
46-
#import "common/simple_string_dictionary.h"
48+
#import "client/mac/sender/uploader.h"
49+
#import "common/long_string_dictionary.h"
50+
51+
#if !TARGET_OS_TV && !TARGET_OS_WATCH
52+
#import "client/mac/handler/exception_handler.h"
53+
#else
54+
#import "client/ios/handler/exception_handler_no_mach.h"
55+
#endif // !TARGET_OS_TV && !TARGET_OS_WATCH
4756

4857
#if !defined(__EXCEPTIONS) || (__clang__ && !__has_feature(cxx_exceptions))
4958
// This file uses C++ try/catch (but shouldn't). Duplicate the macros from
@@ -59,7 +68,7 @@
5968

6069
using google_breakpad::ConfigFile;
6170
using google_breakpad::EnsureDirectoryPathExists;
62-
using google_breakpad::SimpleStringDictionary;
71+
using google_breakpad::LongStringDictionary;
6372

6473
//=============================================================================
6574
// We want any memory allocations which are used by breakpad during the
@@ -190,7 +199,7 @@ bool HandleMinidump(const char *dump_dir,
190199
// MachineExceptions.h, we have to explicitly name the handler.
191200
google_breakpad::ExceptionHandler *handler_; // The actual handler (STRONG)
192201

193-
SimpleStringDictionary *config_params_; // Create parameters (STRONG)
202+
LongStringDictionary *config_params_; // Create parameters (STRONG)
194203

195204
ConfigFile config_file_;
196205

@@ -306,7 +315,7 @@ static BOOL IsDebuggerActive() {
306315
// since they were allocated by ProtectedMemoryAllocator objects.
307316
//
308317
if (config_params_) {
309-
config_params_->~SimpleStringDictionary();
318+
config_params_->~LongStringDictionary();
310319
}
311320

312321
if (handler_)
@@ -374,10 +383,10 @@ static BOOL IsDebuggerActive() {
374383
}
375384

376385
config_params_ =
377-
new (gKeyValueAllocator->Allocate(sizeof(SimpleStringDictionary)) )
378-
SimpleStringDictionary();
386+
new (gKeyValueAllocator->Allocate(sizeof(LongStringDictionary)))
387+
LongStringDictionary();
379388

380-
SimpleStringDictionary &dictionary = *config_params_;
389+
LongStringDictionary &dictionary = *config_params_;
381390

382391
dictionary.SetKeyValue(BREAKPAD_SERVER_TYPE, [serverType UTF8String]);
383392
dictionary.SetKeyValue(BREAKPAD_PRODUCT_DISPLAY, [display UTF8String]);
@@ -420,8 +429,8 @@ static BOOL IsDebuggerActive() {
420429
if (!config_params_ || !key)
421430
return nil;
422431

423-
const char *value = config_params_->GetValueForKey([key UTF8String]);
424-
return value ? [NSString stringWithUTF8String:value] : nil;
432+
const std::string value = config_params_->GetValueForKey([key UTF8String]);
433+
return value.empty() ? nil : [NSString stringWithUTF8String:value.c_str()];
425434
}
426435

427436
//=============================================================================
@@ -495,8 +504,8 @@ static BOOL IsDebuggerActive() {
495504
NSDictionary *server_parameters) {
496505
NSMutableDictionary *config = [NSMutableDictionary dictionary];
497506

498-
SimpleStringDictionary::Iterator it(*config_params_);
499-
while (const SimpleStringDictionary::Entry *next = it.Next()) {
507+
LongStringDictionary::Iterator it(*config_params_);
508+
while (const LongStringDictionary::Entry *next = it.Next()) {
500509
[config setValue:[NSString stringWithUTF8String:next->value]
501510
forKey:[NSString stringWithUTF8String:next->key]];
502511
}
@@ -525,7 +534,7 @@ static BOOL IsDebuggerActive() {
525534
if (!success)
526535
return nil;
527536

528-
SimpleStringDictionary params = *config_params_;
537+
LongStringDictionary params = *config_params_;
529538
for (NSString *key in server_parameters) {
530539
params.SetKeyValue([key UTF8String],
531540
[[server_parameters objectForKey:key] UTF8String]);
@@ -560,7 +569,7 @@ static BOOL IsDebuggerActive() {
560569
void Breakpad::HandleUncaughtException(NSException *exception) {
561570
// Generate the minidump.
562571
google_breakpad::IosExceptionMinidumpGenerator generator(exception);
563-
const char *minidump_path =
572+
const std::string minidump_path =
564573
config_params_->GetValueForKey(BREAKPAD_DUMP_DIRECTORY);
565574
std::string minidump_id;
566575
std::string minidump_filename = generator.UniqueNameInDirectory(minidump_path,
@@ -573,7 +582,7 @@ static BOOL IsDebuggerActive() {
573582
// 2- If the application crash while trying to handle this exception, a usual
574583
// report will be generated. This report must not contain these special
575584
// keys.
576-
SimpleStringDictionary params = *config_params_;
585+
LongStringDictionary params = *config_params_;
577586
params.SetKeyValue(BREAKPAD_SERVER_PARAMETER_PREFIX "type", "exception");
578587
params.SetKeyValue(BREAKPAD_SERVER_PARAMETER_PREFIX "exceptionName",
579588
[[exception name] UTF8String]);
@@ -582,9 +591,9 @@ static BOOL IsDebuggerActive() {
582591

583592
// And finally write the config file.
584593
ConfigFile config_file;
585-
config_file.WriteFile(minidump_path,
594+
config_file.WriteFile(minidump_path.c_str(),
586595
&params,
587-
minidump_path,
596+
minidump_path.c_str(),
588597
minidump_id.c_str());
589598
}
590599

@@ -612,9 +621,9 @@ BreakpadRef BreakpadCreate(NSDictionary *parameters) {
612621

613622
gKeyValueAllocator =
614623
new (gMasterAllocator->Allocate(sizeof(ProtectedMemoryAllocator)))
615-
ProtectedMemoryAllocator(sizeof(SimpleStringDictionary));
624+
ProtectedMemoryAllocator(sizeof(LongStringDictionary));
616625

617-
// Create a mutex for use in accessing the SimpleStringDictionary
626+
// Create a mutex for use in accessing the LongStringDictionary
618627
int mutexResult = pthread_mutex_init(&gDictionaryMutex, NULL);
619628
if (mutexResult == 0) {
620629

vendor/google-breakpad/src/client/ios/Breakpad.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
1EEEB6101720821900F7E689 /* simple_string_dictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EEEB60D1720821900F7E689 /* simple_string_dictionary.h */; };
5858
AA747D9F0F9514B9006C5449 /* Breakpad_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* Breakpad_Prefix.pch */; };
5959
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; };
60+
CF6D547D1F9E6FFE00E95174 /* long_string_dictionary.cc in Sources */ = {isa = PBXBuildFile; fileRef = CF6D547C1F9E6FFE00E95174 /* long_string_dictionary.cc */; };
61+
CF706DC11F7C6EFB002C54C7 /* long_string_dictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = CF706DC01F7C6EFB002C54C7 /* long_string_dictionary.h */; };
6062
/* End PBXBuildFile section */
6163

6264
/* Begin PBXFileReference section */
@@ -111,6 +113,8 @@
111113
1EEEB60D1720821900F7E689 /* simple_string_dictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simple_string_dictionary.h; sourceTree = "<group>"; };
112114
AA747D9E0F9514B9006C5449 /* Breakpad_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Breakpad_Prefix.pch; sourceTree = SOURCE_ROOT; };
113115
AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
116+
CF6D547C1F9E6FFE00E95174 /* long_string_dictionary.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = long_string_dictionary.cc; sourceTree = "<group>"; };
117+
CF706DC01F7C6EFB002C54C7 /* long_string_dictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = long_string_dictionary.h; sourceTree = "<group>"; };
114118
D2AAC07E0554694100DB518D /* libBreakpad.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libBreakpad.a; sourceTree = BUILT_PRODUCTS_DIR; };
115119
/* End PBXFileReference section */
116120

@@ -264,6 +268,8 @@
264268
16C7CC47147D4A4300776EAD /* common */ = {
265269
isa = PBXGroup;
266270
children = (
271+
CF706DC01F7C6EFB002C54C7 /* long_string_dictionary.h */,
272+
CF6D547C1F9E6FFE00E95174 /* long_string_dictionary.cc */,
267273
1EEEB60C1720821900F7E689 /* simple_string_dictionary.cc */,
268274
1EEEB60D1720821900F7E689 /* simple_string_dictionary.h */,
269275
16C7CC4A147D4A4300776EAD /* convert_UTF.c */,
@@ -339,6 +345,7 @@
339345
16C7CEA8147D4A4300776EAD /* string_conversion.h in Headers */,
340346
16BFA67014E195E9009704F8 /* ios_exception_minidump_generator.h in Headers */,
341347
16C92FAD150DF8330053D7BA /* BreakpadController.h in Headers */,
348+
CF706DC11F7C6EFB002C54C7 /* long_string_dictionary.h in Headers */,
342349
1EEEB6101720821900F7E689 /* simple_string_dictionary.h in Headers */,
343350
14569323182CE2C10029C465 /* mach_vm_compat.h in Headers */,
344351
);
@@ -416,6 +423,7 @@
416423
16C7CDFC147D4A4300776EAD /* minidump_generator.cc in Sources */,
417424
16C7CDFE147D4A4300776EAD /* protected_memory_allocator.cc in Sources */,
418425
16C7CE09147D4A4300776EAD /* uploader.mm in Sources */,
426+
CF6D547D1F9E6FFE00E95174 /* long_string_dictionary.cc in Sources */,
419427
16C7CE19147D4A4300776EAD /* minidump_file_writer.cc in Sources */,
420428
16C7CE40147D4A4300776EAD /* convert_UTF.c in Sources */,
421429
16C7CE79147D4A4300776EAD /* GTMLogger.m in Sources */,

vendor/google-breakpad/src/client/ios/BreakpadController.mm

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,12 @@ - (void)reportWillBeSent;
9393
@implementation BreakpadController
9494

9595
+ (BreakpadController*)sharedInstance {
96-
@synchronized(self) {
97-
static BreakpadController* sharedInstance_ =
98-
[[BreakpadController alloc] initSingleton];
99-
return sharedInstance_;
100-
}
96+
static dispatch_once_t onceToken;
97+
static BreakpadController* sharedInstance ;
98+
dispatch_once(&onceToken, ^{
99+
sharedInstance = [[BreakpadController alloc] initSingleton];
100+
});
101+
return sharedInstance;
101102
}
102103

103104
- (id)init {
@@ -179,10 +180,9 @@ - (void)setUploadingEnabled:(BOOL)enabled {
179180
enableUploads_ = YES;
180181
[self sendStoredCrashReports];
181182
} else {
183+
// disable the enableUpload_ flag.
184+
// sendDelay checks this flag and disables the upload of logs by sendStoredCrashReports
182185
enableUploads_ = NO;
183-
[NSObject cancelPreviousPerformRequestsWithTarget:self
184-
selector:@selector(sendStoredCrashReports)
185-
object:nil];
186186
}
187187
});
188188
}
@@ -317,38 +317,35 @@ - (void)reportWillBeSent {
317317
[userDefaults synchronize];
318318
}
319319

320+
// This method must be called from the breakpad queue.
320321
- (void)sendStoredCrashReports {
321-
dispatch_async(queue_, ^{
322-
if (BreakpadGetCrashReportCount(breakpadRef_) == 0)
323-
return;
322+
if (BreakpadGetCrashReportCount(breakpadRef_) == 0)
323+
return;
324324

325-
int timeToWait = [self sendDelay];
325+
int timeToWait = [self sendDelay];
326326

327-
// Unable to ever send report.
328-
if (timeToWait == -1)
329-
return;
327+
// Unable to ever send report.
328+
if (timeToWait == -1)
329+
return;
330330

331-
// A report can be sent now.
332-
if (timeToWait == 0) {
333-
[self reportWillBeSent];
334-
BreakpadUploadNextReportWithParameters(breakpadRef_,
335-
uploadTimeParameters_);
331+
// A report can be sent now.
332+
if (timeToWait == 0) {
333+
[self reportWillBeSent];
334+
BreakpadUploadNextReportWithParameters(breakpadRef_,
335+
uploadTimeParameters_);
336336

337-
// If more reports must be sent, make sure this method is called again.
338-
if (BreakpadGetCrashReportCount(breakpadRef_) > 0)
339-
timeToWait = uploadIntervalInSeconds_;
340-
}
337+
// If more reports must be sent, make sure this method is called again.
338+
if (BreakpadGetCrashReportCount(breakpadRef_) > 0)
339+
timeToWait = uploadIntervalInSeconds_;
340+
}
341341

342-
// A report must be sent later.
343-
if (timeToWait > 0) {
344-
// performSelector: doesn't work on queue_
345-
dispatch_async(dispatch_get_main_queue(), ^{
346-
[self performSelector:@selector(sendStoredCrashReports)
347-
withObject:nil
348-
afterDelay:timeToWait];
349-
});
350-
}
351-
});
342+
// A report must be sent later.
343+
if (timeToWait > 0) {
344+
dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeToWait * NSEC_PER_SEC));
345+
dispatch_after(delay, queue_, ^{
346+
[self sendStoredCrashReports];
347+
});
348+
}
352349
}
353350

354351
@end

vendor/google-breakpad/src/client/linux/crash_generation/crash_generation_server.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ CrashGenerationServer::ClientEvent(short revents)
255255
}
256256

257257
if (crashing_pid == -1 || signal_fd == -1) {
258-
if (signal_fd)
258+
if (signal_fd != -1)
259259
close(signal_fd);
260260
return true;
261261
}

0 commit comments

Comments
 (0)