From 09b056975dacd1f0f815ad820b6dc9913b0118a3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 23 Jun 2020 18:55:43 -0400 Subject: fix pointer style to match the style guide We do this in a lot of places, but we're inconsistent. Normalize the code to the Google C++ style guide. Change-Id: Ic2aceab661ce8f6b993dda21b1cdf5d2198dcbbf Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2262932 Reviewed-by: Sterling Augustine Reviewed-by: Mark Mentovai --- src/client/ios/Breakpad.h | 46 ++-- src/client/ios/Breakpad.mm | 300 ++++++++++----------- src/client/ios/exception_handler_no_mach.cc | 6 +- src/client/ios/exception_handler_no_mach.h | 42 +-- .../ios/handler/ios_exception_minidump_generator.h | 14 +- .../handler/ios_exception_minidump_generator.mm | 20 +- .../crash_generation/crash_generation_server.cc | 6 +- .../linux/dump_writer_common/ucontext_reader.cc | 10 +- .../linux/dump_writer_common/ucontext_reader.h | 6 +- src/client/linux/handler/exception_handler.cc | 6 +- src/client/linux/handler/exception_handler.h | 4 +- .../linux/handler/exception_handler_unittest.cc | 10 +- src/client/linux/log/log.cc | 4 +- .../minidump_writer/directory_reader_unittest.cc | 2 +- src/client/linux/minidump_writer/line_reader.h | 2 +- .../linux/minidump_writer/line_reader_unittest.cc | 14 +- src/client/linux/minidump_writer/linux_dumper.cc | 10 +- src/client/linux/minidump_writer/linux_dumper.h | 4 +- .../linux_dumper_unittest_helper.cc | 8 +- .../linux_ptrace_dumper_unittest.cc | 2 +- .../linux/minidump_writer/minidump_writer.cc | 8 +- .../minidump_writer/minidump_writer_unittest.cc | 12 +- .../minidump_writer_unittest_utils.cc | 2 +- .../proc_cpuinfo_reader_unittest.cc | 6 +- .../linux/sender/google_crash_report_sender.cc | 2 +- src/client/mac/Framework/Breakpad.h | 22 +- src/client/mac/Framework/Breakpad.mm | 204 +++++++------- src/client/mac/Framework/OnDemandServer.h | 12 +- src/client/mac/Framework/OnDemandServer.mm | 12 +- src/client/mac/crash_generation/ConfigFile.h | 22 +- src/client/mac/crash_generation/ConfigFile.mm | 28 +- src/client/mac/crash_generation/Inspector.h | 14 +- src/client/mac/crash_generation/Inspector.mm | 30 +-- .../crash_generation/crash_generation_server.cc | 16 +- .../mac/crash_generation/crash_generation_server.h | 32 +-- src/client/mac/handler/breakpad_nlist_64.cc | 77 +++--- src/client/mac/handler/breakpad_nlist_64.h | 12 +- src/client/mac/handler/dynamic_images.cc | 44 +-- src/client/mac/handler/dynamic_images.h | 26 +- src/client/mac/handler/exception_handler.cc | 6 +- src/client/mac/handler/exception_handler.h | 62 ++--- src/client/mac/handler/minidump_generator.cc | 184 ++++++------- src/client/mac/handler/minidump_generator.h | 70 ++--- .../mac/handler/testcases/DynamicImagesTests.cc | 6 +- .../mac/handler/testcases/breakpad_nlist_test.cc | 12 +- .../mac/handler/testcases/breakpad_nlist_test.h | 2 +- src/client/mac/testapp/main.m | 2 +- .../mac/tests/crash_generation_server_test.cc | 8 +- src/client/mac/tests/exception_handler_test.cc | 14 +- src/client/mac/tests/minidump_generator_test.cc | 2 +- src/client/minidump_file_writer-inl.h | 4 +- src/client/minidump_file_writer.cc | 30 +-- src/client/minidump_file_writer.h | 42 +-- src/client/minidump_file_writer_unittest.cc | 17 +- src/client/solaris/handler/exception_handler.cc | 22 +- src/client/solaris/handler/exception_handler.h | 32 +-- .../solaris/handler/exception_handler_test.cc | 14 +- src/client/solaris/handler/minidump_generator.cc | 176 ++++++------ src/client/solaris/handler/minidump_generator.h | 8 +- src/client/solaris/handler/minidump_test.cc | 2 +- src/client/solaris/handler/solaris_lwp.cc | 72 ++--- src/client/solaris/handler/solaris_lwp.h | 16 +- src/client/windows/handler/exception_handler.cc | 6 +- src/client/windows/handler/exception_handler.h | 8 +- src/client/windows/sender/crash_report_sender.cc | 14 +- src/client/windows/sender/crash_report_sender.h | 18 +- src/client/windows/unittests/dump_analysis.cc | 4 +- .../unittests/exception_handler_death_test.cc | 18 +- .../unittests/exception_handler_nesting_test.cc | 6 +- .../windows/unittests/exception_handler_test.cc | 20 +- 70 files changed, 996 insertions(+), 998 deletions(-) (limited to 'src/client') diff --git a/src/client/ios/Breakpad.h b/src/client/ios/Breakpad.h index fa790f77..6c9b8bd6 100644 --- a/src/client/ios/Breakpad.h +++ b/src/client/ios/Breakpad.h @@ -37,7 +37,7 @@ // // These files can then be uploaded to a server. -typedef void *BreakpadRef; +typedef void* BreakpadRef; #ifdef __cplusplus extern "C" { @@ -60,15 +60,15 @@ extern "C" { typedef bool (*BreakpadFilterCallback)(int exception_type, int exception_code, mach_port_t crashing_thread, - void *context); + void* context); // Optional user-defined function that will be called after a network upload // of a crash report. // |report_id| will be the id returned by the server, or "ERR" if an error // occurred. // |error| will contain the error, or nil if no error occured. -typedef void (*BreakpadUploadCompletionCallback)(NSString *report_id, - NSError *error); +typedef void (*BreakpadUploadCompletionCallback)(NSString* report_id, + NSError* error); // Create a new BreakpadRef object and install it as an exception // handler. The |parameters| will typically be the contents of your @@ -163,7 +163,7 @@ typedef void (*BreakpadUploadCompletionCallback)(NSString *report_id, // internal values. // Returns a new BreakpadRef object on success, NULL otherwise. -BreakpadRef BreakpadCreate(NSDictionary *parameters); +BreakpadRef BreakpadCreate(NSDictionary* parameters); // Uninstall and release the data associated with |ref|. void BreakpadRelease(BreakpadRef ref); @@ -187,20 +187,20 @@ void BreakpadRelease(BreakpadRef ref); // TODO (nealsid): separate server parameter dictionary from the // dictionary used to configure Breakpad, and document limits for each // independently. -void BreakpadSetKeyValue(BreakpadRef ref, NSString *key, NSString *value); -NSString *BreakpadKeyValue(BreakpadRef ref, NSString *key); -void BreakpadRemoveKeyValue(BreakpadRef ref, NSString *key); +void BreakpadSetKeyValue(BreakpadRef ref, NSString* key, NSString* value); +NSString* BreakpadKeyValue(BreakpadRef ref, NSString* key); +void BreakpadRemoveKeyValue(BreakpadRef ref, NSString* key); // You can use this method to specify parameters that will be uploaded // to the crash server. They will be automatically encoded as // necessary. Note that as mentioned above there are limits on both // the number of keys and their length. -void BreakpadAddUploadParameter(BreakpadRef ref, NSString *key, - NSString *value); +void BreakpadAddUploadParameter(BreakpadRef ref, NSString* key, + NSString* value); // This method will remove a previously-added parameter from the // upload parameter set. -void BreakpadRemoveUploadParameter(BreakpadRef ref, NSString *key); +void BreakpadRemoveUploadParameter(BreakpadRef ref, NSString* key); // Method to handle uploading data to the server @@ -208,10 +208,10 @@ void BreakpadRemoveUploadParameter(BreakpadRef ref, NSString *key); int BreakpadGetCrashReportCount(BreakpadRef ref); // Returns the next upload configuration. The report file is deleted. -NSDictionary *BreakpadGetNextReportConfiguration(BreakpadRef ref); +NSDictionary* BreakpadGetNextReportConfiguration(BreakpadRef ref); // Returns the date of the most recent crash report. -NSDate *BreakpadGetDateOfMostRecentCrashReport(BreakpadRef ref); +NSDate* BreakpadGetDateOfMostRecentCrashReport(BreakpadRef ref); // Upload next report to the server. void BreakpadUploadNextReport(BreakpadRef ref); @@ -220,7 +220,7 @@ void BreakpadUploadNextReport(BreakpadRef ref); // |server_parameters| is additional server parameters to send. void BreakpadUploadNextReportWithParameters( BreakpadRef ref, - NSDictionary *server_parameters, + NSDictionary* server_parameters, BreakpadUploadCompletionCallback callback); // Upload a report to the server. @@ -228,8 +228,8 @@ void BreakpadUploadNextReportWithParameters( // |configuration| is the configuration of the breakpad report to send. void BreakpadUploadReportWithParametersAndConfiguration( BreakpadRef ref, - NSDictionary *server_parameters, - NSDictionary *configuration, + NSDictionary* server_parameters, + NSDictionary* configuration, BreakpadUploadCompletionCallback callback); // Handles the network response of a breakpad upload. This function is needed if @@ -239,21 +239,21 @@ void BreakpadUploadReportWithParametersAndConfiguration( // BreakpadUploadReportWithParametersAndConfiguration. // |data| and |error| contain the network response. void BreakpadHandleNetworkResponse(BreakpadRef ref, - NSDictionary *configuration, - NSData *data, - NSError *error); + NSDictionary* configuration, + NSData* data, + NSError* error); // Upload a file to the server. |data| is the content of the file to sent. // |server_parameters| is additional server parameters to send. -void BreakpadUploadData(BreakpadRef ref, NSData *data, NSString *name, - NSDictionary *server_parameters); +void BreakpadUploadData(BreakpadRef ref, NSData* data, NSString* name, + NSDictionary* server_parameters); // Generate a breakpad minidump and configuration file in the dump directory. // The report will be available for uploading. The paths of the created files // are returned in the dictionary. |server_parameters| is additional server // parameters to add in the config file. -NSDictionary *BreakpadGenerateReport(BreakpadRef ref, - NSDictionary *server_parameters); +NSDictionary* BreakpadGenerateReport(BreakpadRef ref, + NSDictionary* server_parameters); #ifdef __cplusplus } diff --git a/src/client/ios/Breakpad.mm b/src/client/ios/Breakpad.mm index 2b61bbe3..11c51746 100644 --- a/src/client/ios/Breakpad.mm +++ b/src/client/ios/Breakpad.mm @@ -84,9 +84,9 @@ using google_breakpad::LongStringDictionary; // allocation of C++ objects. Note that we don't use operator delete() // but instead call the objects destructor directly: object->~ClassName(); // -ProtectedMemoryAllocator *gMasterAllocator = NULL; -ProtectedMemoryAllocator *gKeyValueAllocator = NULL; -ProtectedMemoryAllocator *gBreakpadAllocator = NULL; +ProtectedMemoryAllocator* gMasterAllocator = NULL; +ProtectedMemoryAllocator* gKeyValueAllocator = NULL; +ProtectedMemoryAllocator* gBreakpadAllocator = NULL; // Mutex for thread-safe access to the key/value dictionary used by breakpad. // It's a global instead of an instance variable of Breakpad @@ -101,8 +101,8 @@ pthread_mutex_t gDictionaryMutex; // Its destructor will first re-protect the memory then release the lock. class ProtectedMemoryLocker { public: - ProtectedMemoryLocker(pthread_mutex_t *mutex, - ProtectedMemoryAllocator *allocator) + ProtectedMemoryLocker(pthread_mutex_t* mutex, + ProtectedMemoryAllocator* allocator) : mutex_(mutex), allocator_(allocator) { // Lock the mutex @@ -127,17 +127,17 @@ class ProtectedMemoryLocker { ProtectedMemoryLocker(const ProtectedMemoryLocker&); ProtectedMemoryLocker& operator=(const ProtectedMemoryLocker&); - pthread_mutex_t *mutex_; - ProtectedMemoryAllocator *allocator_; + pthread_mutex_t* mutex_; + ProtectedMemoryAllocator* allocator_; }; //============================================================================= class Breakpad { public: // factory method - static Breakpad *Create(NSDictionary *parameters) { + static Breakpad* Create(NSDictionary* parameters) { // Allocate from our special allocation pool - Breakpad *breakpad = + Breakpad* breakpad = new (gBreakpadAllocator->Allocate(sizeof(Breakpad))) Breakpad(); @@ -155,62 +155,62 @@ class Breakpad { ~Breakpad(); - void SetKeyValue(NSString *key, NSString *value); - NSString *KeyValue(NSString *key); - void RemoveKeyValue(NSString *key); - NSArray *CrashReportsToUpload(); - NSString *NextCrashReportToUpload(); - NSDictionary *NextCrashReportConfiguration(); - NSDictionary *FixedUpCrashReportConfiguration(NSDictionary *configuration); - NSDate *DateOfMostRecentCrashReport(); - void UploadNextReport(NSDictionary *server_parameters); - void UploadReportWithConfiguration(NSDictionary *configuration, - NSDictionary *server_parameters, + void SetKeyValue(NSString* key, NSString* value); + NSString* KeyValue(NSString* key); + void RemoveKeyValue(NSString* key); + NSArray* CrashReportsToUpload(); + NSString* NextCrashReportToUpload(); + NSDictionary* NextCrashReportConfiguration(); + NSDictionary* FixedUpCrashReportConfiguration(NSDictionary* configuration); + NSDate* DateOfMostRecentCrashReport(); + void UploadNextReport(NSDictionary* server_parameters); + void UploadReportWithConfiguration(NSDictionary* configuration, + NSDictionary* server_parameters, BreakpadUploadCompletionCallback callback); - void UploadData(NSData *data, NSString *name, - NSDictionary *server_parameters); - void HandleNetworkResponse(NSDictionary *configuration, - NSData *data, - NSError *error); - NSDictionary *GenerateReport(NSDictionary *server_parameters); + void UploadData(NSData* data, NSString* name, + NSDictionary* server_parameters); + void HandleNetworkResponse(NSDictionary* configuration, + NSData* data, + NSError* error); + NSDictionary* GenerateReport(NSDictionary* server_parameters); private: Breakpad() : handler_(NULL), config_params_(NULL) {} - bool Initialize(NSDictionary *parameters); + bool Initialize(NSDictionary* parameters); - bool ExtractParameters(NSDictionary *parameters); + bool ExtractParameters(NSDictionary* parameters); // Dispatches to HandleMinidump() - static bool HandleMinidumpCallback(const char *dump_dir, - const char *minidump_id, - void *context, bool succeeded); + static bool HandleMinidumpCallback(const char* dump_dir, + const char* minidump_id, + void* context, bool succeeded); - bool HandleMinidump(const char *dump_dir, - const char *minidump_id); + bool HandleMinidump(const char* dump_dir, + const char* minidump_id); // NSException handler - static void UncaughtExceptionHandler(NSException *exception); + static void UncaughtExceptionHandler(NSException* exception); // Handle an uncaught NSException. - void HandleUncaughtException(NSException *exception); + void HandleUncaughtException(NSException* exception); // Since ExceptionHandler (w/o namespace) is defined as typedef in OSX's // MachineExceptions.h, we have to explicitly name the handler. - google_breakpad::ExceptionHandler *handler_; // The actual handler (STRONG) + google_breakpad::ExceptionHandler* handler_; // The actual handler (STRONG) - LongStringDictionary *config_params_; // Create parameters (STRONG) + LongStringDictionary* config_params_; // Create parameters (STRONG) ConfigFile config_file_; // A static reference to the current Breakpad instance. Used for handling // NSException. - static Breakpad *current_breakpad_; + static Breakpad* current_breakpad_; }; -Breakpad *Breakpad::current_breakpad_ = NULL; +Breakpad* Breakpad::current_breakpad_ = NULL; #pragma mark - #pragma mark Helper functions @@ -221,14 +221,14 @@ Breakpad *Breakpad::current_breakpad_ = NULL; //============================================================================= static BOOL IsDebuggerActive() { BOOL result = NO; - NSUserDefaults *stdDefaults = [NSUserDefaults standardUserDefaults]; + NSUserDefaults* stdDefaults = [NSUserDefaults standardUserDefaults]; // We check both defaults and the environment variable here BOOL ignoreDebugger = [stdDefaults boolForKey:@IGNORE_DEBUGGER]; if (!ignoreDebugger) { - char *ignoreDebuggerStr = getenv(IGNORE_DEBUGGER); + char* ignoreDebuggerStr = getenv(IGNORE_DEBUGGER); ignoreDebugger = (ignoreDebuggerStr ? strtol(ignoreDebuggerStr, NULL, 10) : 0) != 0; } @@ -240,7 +240,7 @@ static BOOL IsDebuggerActive() { size_t actualSize; if (sysctl(mib, mibSize, NULL, &actualSize, NULL, 0) == 0) { - struct kinfo_proc *info = (struct kinfo_proc *)malloc(actualSize); + struct kinfo_proc* info = (struct kinfo_proc*)malloc(actualSize); if (info) { // This comes from looking at the Darwin xnu Kernel @@ -256,10 +256,10 @@ static BOOL IsDebuggerActive() { } //============================================================================= -bool Breakpad::HandleMinidumpCallback(const char *dump_dir, - const char *minidump_id, - void *context, bool succeeded) { - Breakpad *breakpad = (Breakpad *)context; +bool Breakpad::HandleMinidumpCallback(const char* dump_dir, + const char* minidump_id, + void* context, bool succeeded) { + Breakpad* breakpad = (Breakpad*)context; // If our context is damaged or something, just return false to indicate that // the handler should continue without us. @@ -270,7 +270,7 @@ bool Breakpad::HandleMinidumpCallback(const char *dump_dir, } //============================================================================= -void Breakpad::UncaughtExceptionHandler(NSException *exception) { +void Breakpad::UncaughtExceptionHandler(NSException* exception) { NSSetUncaughtExceptionHandler(NULL); if (current_breakpad_) { current_breakpad_->HandleUncaughtException(exception); @@ -282,7 +282,7 @@ void Breakpad::UncaughtExceptionHandler(NSException *exception) { #pragma mark - //============================================================================= -bool Breakpad::Initialize(NSDictionary *parameters) { +bool Breakpad::Initialize(NSDictionary* parameters) { // Initialize current_breakpad_ = this; config_params_ = NULL; @@ -325,21 +325,21 @@ Breakpad::~Breakpad() { } //============================================================================= -bool Breakpad::ExtractParameters(NSDictionary *parameters) { - NSString *serverType = [parameters objectForKey:@BREAKPAD_SERVER_TYPE]; - NSString *display = [parameters objectForKey:@BREAKPAD_PRODUCT_DISPLAY]; - NSString *product = [parameters objectForKey:@BREAKPAD_PRODUCT]; - NSString *version = [parameters objectForKey:@BREAKPAD_VERSION]; - NSString *urlStr = [parameters objectForKey:@BREAKPAD_URL]; - NSString *vendor = +bool Breakpad::ExtractParameters(NSDictionary* parameters) { + NSString* serverType = [parameters objectForKey:@BREAKPAD_SERVER_TYPE]; + NSString* display = [parameters objectForKey:@BREAKPAD_PRODUCT_DISPLAY]; + NSString* product = [parameters objectForKey:@BREAKPAD_PRODUCT]; + NSString* version = [parameters objectForKey:@BREAKPAD_VERSION]; + NSString* urlStr = [parameters objectForKey:@BREAKPAD_URL]; + NSString* vendor = [parameters objectForKey:@BREAKPAD_VENDOR]; // We check both parameters and the environment variable here. - char *envVarDumpSubdirectory = getenv(BREAKPAD_DUMP_DIRECTORY); - NSString *dumpSubdirectory = envVarDumpSubdirectory ? + char* envVarDumpSubdirectory = getenv(BREAKPAD_DUMP_DIRECTORY); + NSString* dumpSubdirectory = envVarDumpSubdirectory ? [NSString stringWithUTF8String:envVarDumpSubdirectory] : [parameters objectForKey:@BREAKPAD_DUMP_DIRECTORY]; - NSDictionary *serverParameters = + NSDictionary* serverParameters = [parameters objectForKey:@BREAKPAD_SERVER_PARAMETER_DICT]; if (!product) @@ -360,7 +360,7 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { } if (!dumpSubdirectory) { - NSString *cachePath = + NSString* cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) @@ -388,7 +388,7 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { new (gKeyValueAllocator->Allocate(sizeof(LongStringDictionary))) LongStringDictionary(); - LongStringDictionary &dictionary = *config_params_; + LongStringDictionary& dictionary = *config_params_; dictionary.SetKeyValue(BREAKPAD_SERVER_TYPE, [serverType UTF8String]); dictionary.SetKeyValue(BREAKPAD_PRODUCT_DISPLAY, [display UTF8String]); @@ -407,8 +407,8 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { if (serverParameters) { // For each key-value pair, call BreakpadAddUploadParameter() - NSEnumerator *keyEnumerator = [serverParameters keyEnumerator]; - NSString *aParameter; + NSEnumerator* keyEnumerator = [serverParameters keyEnumerator]; + NSString* aParameter; while ((aParameter = [keyEnumerator nextObject])) { BreakpadAddUploadParameter(this, aParameter, [serverParameters objectForKey:aParameter]); @@ -418,7 +418,7 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { } //============================================================================= -void Breakpad::SetKeyValue(NSString *key, NSString *value) { +void Breakpad::SetKeyValue(NSString* key, NSString* value) { // We allow nil values. This is the same as removing the keyvalue. if (!config_params_ || !key) return; @@ -427,7 +427,7 @@ void Breakpad::SetKeyValue(NSString *key, NSString *value) { } //============================================================================= -NSString *Breakpad::KeyValue(NSString *key) { +NSString* Breakpad::KeyValue(NSString* key) { if (!config_params_ || !key) return nil; @@ -436,44 +436,44 @@ NSString *Breakpad::KeyValue(NSString *key) { } //============================================================================= -void Breakpad::RemoveKeyValue(NSString *key) { +void Breakpad::RemoveKeyValue(NSString* key) { if (!config_params_ || !key) return; config_params_->RemoveKey([key UTF8String]); } //============================================================================= -NSArray *Breakpad::CrashReportsToUpload() { - NSString *directory = KeyValue(@BREAKPAD_DUMP_DIRECTORY); +NSArray* Breakpad::CrashReportsToUpload() { + NSString* directory = KeyValue(@BREAKPAD_DUMP_DIRECTORY); if (!directory) return nil; - NSArray *dirContents = [[NSFileManager defaultManager] + NSArray* dirContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:directory error:nil]; - NSArray *configs = [dirContents filteredArrayUsingPredicate:[NSPredicate + NSArray* configs = [dirContents filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self BEGINSWITH 'Config-'"]]; return configs; } //============================================================================= -NSString *Breakpad::NextCrashReportToUpload() { - NSString *directory = KeyValue(@BREAKPAD_DUMP_DIRECTORY); +NSString* Breakpad::NextCrashReportToUpload() { + NSString* directory = KeyValue(@BREAKPAD_DUMP_DIRECTORY); if (!directory) return nil; - NSString *config = [CrashReportsToUpload() lastObject]; + NSString* config = [CrashReportsToUpload() lastObject]; if (!config) return nil; return [NSString stringWithFormat:@"%@/%@", directory, config]; } //============================================================================= -NSDictionary *Breakpad::NextCrashReportConfiguration() { - NSDictionary *configuration = [Uploader readConfigurationDataFromFile:NextCrashReportToUpload()]; +NSDictionary* Breakpad::NextCrashReportConfiguration() { + NSDictionary* configuration = [Uploader readConfigurationDataFromFile:NextCrashReportToUpload()]; return FixedUpCrashReportConfiguration(configuration); } //============================================================================= -NSDictionary *Breakpad::FixedUpCrashReportConfiguration(NSDictionary *configuration) { - NSMutableDictionary *fixedConfiguration = [[configuration mutableCopy] autorelease]; +NSDictionary* Breakpad::FixedUpCrashReportConfiguration(NSDictionary* configuration) { + NSMutableDictionary* fixedConfiguration = [[configuration mutableCopy] autorelease]; // kReporterMinidumpDirectoryKey can become stale because the app's data container path includes // an UUID that is not guaranteed to stay the same over time. [fixedConfiguration setObject:KeyValue(@BREAKPAD_DUMP_DIRECTORY) @@ -482,19 +482,19 @@ NSDictionary *Breakpad::FixedUpCrashReportConfiguration(NSDictionary *configurat } //============================================================================= -NSDate *Breakpad::DateOfMostRecentCrashReport() { - NSString *directory = KeyValue(@BREAKPAD_DUMP_DIRECTORY); +NSDate* Breakpad::DateOfMostRecentCrashReport() { + NSString* directory = KeyValue(@BREAKPAD_DUMP_DIRECTORY); if (!directory) { return nil; } - NSFileManager *fileManager = [NSFileManager defaultManager]; - NSArray *dirContents = [fileManager contentsOfDirectoryAtPath:directory error:nil]; - NSArray *dumps = [dirContents filteredArrayUsingPredicate:[NSPredicate + NSFileManager* fileManager = [NSFileManager defaultManager]; + NSArray* dirContents = [fileManager contentsOfDirectoryAtPath:directory error:nil]; + NSArray* dumps = [dirContents filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self ENDSWITH '.dmp'"]]; - NSDate *mostRecentCrashReportDate = nil; - for (NSString *dump in dumps) { - NSString *filePath = [directory stringByAppendingPathComponent:dump]; - NSDate *crashReportDate = + NSDate* mostRecentCrashReportDate = nil; + for (NSString* dump in dumps) { + NSString* filePath = [directory stringByAppendingPathComponent:dump]; + NSDate* crashReportDate = [[fileManager attributesOfItemAtPath:filePath error:nil] fileCreationDate]; if (!mostRecentCrashReportDate) { mostRecentCrashReportDate = crashReportDate; @@ -506,29 +506,29 @@ NSDate *Breakpad::DateOfMostRecentCrashReport() { } //============================================================================= -void Breakpad::HandleNetworkResponse(NSDictionary *configuration, - NSData *data, - NSError *error) { - Uploader *uploader = [[[Uploader alloc] +void Breakpad::HandleNetworkResponse(NSDictionary* configuration, + NSData* data, + NSError* error) { + Uploader* uploader = [[[Uploader alloc] initWithConfig:configuration] autorelease]; [uploader handleNetworkResponse:data withError:error]; } //============================================================================= void Breakpad::UploadReportWithConfiguration( - NSDictionary *configuration, - NSDictionary *server_parameters, + NSDictionary* configuration, + NSDictionary* server_parameters, BreakpadUploadCompletionCallback callback) { - Uploader *uploader = [[[Uploader alloc] + Uploader* uploader = [[[Uploader alloc] initWithConfig:configuration] autorelease]; if (!uploader) return; - for (NSString *key in server_parameters) { + for (NSString* key in server_parameters) { [uploader addServerParameter:[server_parameters objectForKey:key] forKey:key]; } if (callback) { - [uploader setUploadCompletionBlock:^(NSString *report_id, NSError *error) { + [uploader setUploadCompletionBlock:^(NSString* report_id, NSError* error) { dispatch_async(dispatch_get_main_queue(), ^{ callback(report_id, error); }); @@ -538,8 +538,8 @@ void Breakpad::UploadReportWithConfiguration( } //============================================================================= -void Breakpad::UploadNextReport(NSDictionary *server_parameters) { - NSDictionary *configuration = NextCrashReportConfiguration(); +void Breakpad::UploadNextReport(NSDictionary* server_parameters) { + NSDictionary* configuration = NextCrashReportConfiguration(); if (configuration) { return UploadReportWithConfiguration(configuration, server_parameters, nullptr); @@ -547,19 +547,19 @@ void Breakpad::UploadNextReport(NSDictionary *server_parameters) { } //============================================================================= -void Breakpad::UploadData(NSData *data, NSString *name, - NSDictionary *server_parameters) { - NSMutableDictionary *config = [NSMutableDictionary dictionary]; +void Breakpad::UploadData(NSData* data, NSString* name, + NSDictionary* server_parameters) { + NSMutableDictionary* config = [NSMutableDictionary dictionary]; LongStringDictionary::Iterator it(*config_params_); - while (const LongStringDictionary::Entry *next = it.Next()) { + while (const LongStringDictionary::Entry* next = it.Next()) { [config setValue:[NSString stringWithUTF8String:next->value] forKey:[NSString stringWithUTF8String:next->key]]; } - Uploader *uploader = + Uploader* uploader = [[[Uploader alloc] initWithConfig:config] autorelease]; - for (NSString *key in server_parameters) { + for (NSString* key in server_parameters) { [uploader addServerParameter:[server_parameters objectForKey:key] forKey:key]; } @@ -567,11 +567,11 @@ void Breakpad::UploadData(NSData *data, NSString *name, } //============================================================================= -NSDictionary *Breakpad::GenerateReport(NSDictionary *server_parameters) { - NSString *dumpDirAsNSString = KeyValue(@BREAKPAD_DUMP_DIRECTORY); +NSDictionary* Breakpad::GenerateReport(NSDictionary* server_parameters) { + NSString* dumpDirAsNSString = KeyValue(@BREAKPAD_DUMP_DIRECTORY); if (!dumpDirAsNSString) return nil; - const char *dumpDir = [dumpDirAsNSString UTF8String]; + const char* dumpDir = [dumpDirAsNSString UTF8String]; google_breakpad::MinidumpGenerator generator(mach_task_self(), MACH_PORT_NULL); @@ -582,7 +582,7 @@ NSDictionary *Breakpad::GenerateReport(NSDictionary *server_parameters) { return nil; LongStringDictionary params = *config_params_; - for (NSString *key in server_parameters) { + for (NSString* key in server_parameters) { params.SetKeyValue([key UTF8String], [[server_parameters objectForKey:key] UTF8String]); } @@ -590,8 +590,8 @@ NSDictionary *Breakpad::GenerateReport(NSDictionary *server_parameters) { config_file.WriteFile(dumpDir, ¶ms, dumpDir, dumpId.c_str()); // Handle results. - NSMutableDictionary *result = [NSMutableDictionary dictionary]; - NSString *dumpFullPath = [NSString stringWithUTF8String:dumpFilename.c_str()]; + NSMutableDictionary* result = [NSMutableDictionary dictionary]; + NSString* dumpFullPath = [NSString stringWithUTF8String:dumpFilename.c_str()]; [result setValue:dumpFullPath forKey:@BREAKPAD_OUTPUT_DUMP_FILE]; [result setValue:[NSString stringWithUTF8String:config_file.GetFilePath()] @@ -600,8 +600,8 @@ NSDictionary *Breakpad::GenerateReport(NSDictionary *server_parameters) { } //============================================================================= -bool Breakpad::HandleMinidump(const char *dump_dir, - const char *minidump_id) { +bool Breakpad::HandleMinidump(const char* dump_dir, + const char* minidump_id) { config_file_.WriteFile(dump_dir, config_params_, dump_dir, @@ -613,7 +613,7 @@ bool Breakpad::HandleMinidump(const char *dump_dir, } //============================================================================= -void Breakpad::HandleUncaughtException(NSException *exception) { +void Breakpad::HandleUncaughtException(NSException* exception) { // Generate the minidump. google_breakpad::IosExceptionMinidumpGenerator generator(exception); const std::string minidump_path = @@ -650,7 +650,7 @@ void Breakpad::HandleUncaughtException(NSException *exception) { #pragma mark Public API //============================================================================= -BreakpadRef BreakpadCreate(NSDictionary *parameters) { +BreakpadRef BreakpadCreate(NSDictionary* parameters) { try { // This is confusing. Our two main allocators for breakpad memory are: // - gKeyValueAllocator for the key/value memory @@ -690,8 +690,8 @@ BreakpadRef BreakpadCreate(NSDictionary *parameters) { ProtectedMemoryAllocator(breakpad_pool_size); // Stack-based autorelease pool for Breakpad::Create() obj-c code. - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - Breakpad *breakpad = Breakpad::Create(parameters); + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + Breakpad* breakpad = Breakpad::Create(parameters); if (breakpad) { // Make read-only to protect against memory smashers @@ -731,7 +731,7 @@ BreakpadRef BreakpadCreate(NSDictionary *parameters) { //============================================================================= void BreakpadRelease(BreakpadRef ref) { try { - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (gMasterAllocator) { gMasterAllocator->Unprotect(); @@ -764,10 +764,10 @@ void BreakpadRelease(BreakpadRef ref) { } //============================================================================= -void BreakpadSetKeyValue(BreakpadRef ref, NSString *key, NSString *value) { +void BreakpadSetKeyValue(BreakpadRef ref, NSString* key, NSString* value) { try { // Not called at exception time - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad && key && gKeyValueAllocator) { ProtectedMemoryLocker locker(&gDictionaryMutex, gKeyValueAllocator); @@ -780,20 +780,20 @@ void BreakpadSetKeyValue(BreakpadRef ref, NSString *key, NSString *value) { } void BreakpadAddUploadParameter(BreakpadRef ref, - NSString *key, - NSString *value) { + NSString* key, + NSString* value) { // The only difference, internally, between an upload parameter and // a key value one that is set with BreakpadSetKeyValue is that we // prepend the keyname with a special prefix. This informs the // crash sender that the parameter should be sent along with the // POST of the crash dump upload. try { - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad && key && gKeyValueAllocator) { ProtectedMemoryLocker locker(&gDictionaryMutex, gKeyValueAllocator); - NSString *prefixedKey = [@BREAKPAD_SERVER_PARAMETER_PREFIX + NSString* prefixedKey = [@BREAKPAD_SERVER_PARAMETER_PREFIX stringByAppendingString:key]; breakpad->SetKeyValue(prefixedKey, value); } @@ -803,15 +803,15 @@ void BreakpadAddUploadParameter(BreakpadRef ref, } void BreakpadRemoveUploadParameter(BreakpadRef ref, - NSString *key) { + NSString* key) { try { // Not called at exception time - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad && key && gKeyValueAllocator) { ProtectedMemoryLocker locker(&gDictionaryMutex, gKeyValueAllocator); - NSString *prefixedKey = [NSString stringWithFormat:@"%@%@", + NSString* prefixedKey = [NSString stringWithFormat:@"%@%@", @BREAKPAD_SERVER_PARAMETER_PREFIX, key]; breakpad->RemoveKeyValue(prefixedKey); } @@ -820,12 +820,12 @@ void BreakpadRemoveUploadParameter(BreakpadRef ref, } } //============================================================================= -NSString *BreakpadKeyValue(BreakpadRef ref, NSString *key) { - NSString *value = nil; +NSString* BreakpadKeyValue(BreakpadRef ref, NSString* key) { + NSString* value = nil; try { // Not called at exception time - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (!breakpad || !key || !gKeyValueAllocator) return nil; @@ -841,10 +841,10 @@ NSString *BreakpadKeyValue(BreakpadRef ref, NSString *key) { } //============================================================================= -void BreakpadRemoveKeyValue(BreakpadRef ref, NSString *key) { +void BreakpadRemoveKeyValue(BreakpadRef ref, NSString* key) { try { // Not called at exception time - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad && key && gKeyValueAllocator) { ProtectedMemoryLocker locker(&gDictionaryMutex, gKeyValueAllocator); @@ -860,7 +860,7 @@ void BreakpadRemoveKeyValue(BreakpadRef ref, NSString *key) { int BreakpadGetCrashReportCount(BreakpadRef ref) { try { // Not called at exception time - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad) { return static_cast([breakpad->CrashReportsToUpload() count]); @@ -877,9 +877,9 @@ void BreakpadUploadNextReport(BreakpadRef ref) { } //============================================================================= -NSDictionary *BreakpadGetNextReportConfiguration(BreakpadRef ref) { +NSDictionary* BreakpadGetNextReportConfiguration(BreakpadRef ref) { try { - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad) return breakpad->NextCrashReportConfiguration(); } catch(...) { // don't let exceptions leave this C API @@ -889,9 +889,9 @@ NSDictionary *BreakpadGetNextReportConfiguration(BreakpadRef ref) { } //============================================================================= -NSDate *BreakpadGetDateOfMostRecentCrashReport(BreakpadRef ref) { +NSDate* BreakpadGetDateOfMostRecentCrashReport(BreakpadRef ref) { try { - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad) { return breakpad->DateOfMostRecentCrashReport(); } @@ -904,11 +904,11 @@ NSDate *BreakpadGetDateOfMostRecentCrashReport(BreakpadRef ref) { //============================================================================= void BreakpadUploadReportWithParametersAndConfiguration( BreakpadRef ref, - NSDictionary *server_parameters, - NSDictionary *configuration, + NSDictionary* server_parameters, + NSDictionary* configuration, BreakpadUploadCompletionCallback callback) { try { - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (!breakpad || !configuration) return; breakpad->UploadReportWithConfiguration(configuration, server_parameters, @@ -922,13 +922,13 @@ void BreakpadUploadReportWithParametersAndConfiguration( //============================================================================= void BreakpadUploadNextReportWithParameters( BreakpadRef ref, - NSDictionary *server_parameters, + NSDictionary* server_parameters, BreakpadUploadCompletionCallback callback) { try { - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (!breakpad) return; - NSDictionary *configuration = breakpad->NextCrashReportConfiguration(); + NSDictionary* configuration = breakpad->NextCrashReportConfiguration(); if (!configuration) return; return BreakpadUploadReportWithParametersAndConfiguration( @@ -939,12 +939,12 @@ void BreakpadUploadNextReportWithParameters( } void BreakpadHandleNetworkResponse(BreakpadRef ref, - NSDictionary *configuration, - NSData *data, - NSError *error) { + NSDictionary* configuration, + NSData* data, + NSError* error) { try { // Not called at exception time - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad && configuration) breakpad->HandleNetworkResponse(configuration,data, error); @@ -954,11 +954,11 @@ void BreakpadHandleNetworkResponse(BreakpadRef ref, } //============================================================================= -void BreakpadUploadData(BreakpadRef ref, NSData *data, NSString *name, - NSDictionary *server_parameters) { +void BreakpadUploadData(BreakpadRef ref, NSData* data, NSString* name, + NSDictionary* server_parameters) { try { // Not called at exception time - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad) { breakpad->UploadData(data, name, server_parameters); @@ -969,11 +969,11 @@ void BreakpadUploadData(BreakpadRef ref, NSData *data, NSString *name, } //============================================================================= -NSDictionary *BreakpadGenerateReport(BreakpadRef ref, - NSDictionary *server_parameters) { +NSDictionary* BreakpadGenerateReport(BreakpadRef ref, + NSDictionary* server_parameters) { try { // Not called at exception time - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad) { return breakpad->GenerateReport(server_parameters); diff --git a/src/client/ios/exception_handler_no_mach.cc b/src/client/ios/exception_handler_no_mach.cc index 7fcf2d83..cb26449d 100644 --- a/src/client/ios/exception_handler_no_mach.cc +++ b/src/client/ios/exception_handler_no_mach.cc @@ -47,7 +47,7 @@ // for more details. #if USE_PROTECTED_ALLOCATIONS #include "client/mac/handler/protected_memory_allocator.h" - extern ProtectedMemoryAllocator *gBreakpadAllocator; + extern ProtectedMemoryAllocator* gBreakpadAllocator; #endif namespace google_breakpad { @@ -72,10 +72,10 @@ static union { char protected_buffer[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); #endif // defined PAGE_MAX_SIZE #endif // USE_PROTECTED_ALLOCATIONS - google_breakpad::ExceptionHandler *handler; + google_breakpad::ExceptionHandler* handler; } gProtectedData; -ExceptionHandler::ExceptionHandler(const string &dump_path, +ExceptionHandler::ExceptionHandler(const string& dump_path, FilterCallback filter, MinidumpCallback callback, void* callback_context, diff --git a/src/client/ios/exception_handler_no_mach.h b/src/client/ios/exception_handler_no_mach.h index 6d99565b..ec598dcf 100644 --- a/src/client/ios/exception_handler_no_mach.h +++ b/src/client/ios/exception_handler_no_mach.h @@ -53,7 +53,7 @@ class ExceptionHandler { // attempting to write a minidump. If a FilterCallback returns false, Breakpad // will immediately report the exception as unhandled without writing a // minidump, allowing another handler the opportunity to handle it. - typedef bool (*FilterCallback)(void *context); + typedef bool (*FilterCallback)(void* context); // A callback function to run after the minidump has been written. // |minidump_id| is a unique id for the dump, so the minidump @@ -63,18 +63,18 @@ class ExceptionHandler { // Return true if the exception was fully handled and breakpad should exit. // Return false to allow any other exception handlers to process the // exception. - typedef bool (*MinidumpCallback)(const char *dump_dir, - const char *minidump_id, - void *context, bool succeeded); + typedef bool (*MinidumpCallback)(const char* dump_dir, + const char* minidump_id, + void* context, bool succeeded); // A callback function which will be called directly if an exception occurs. // This bypasses the minidump file writing and simply gives the client // the exception information. - typedef bool (*DirectCallback)( void *context, - int exception_type, - int exception_code, - int exception_subcode, - mach_port_t thread_name); + typedef bool (*DirectCallback)(void* context, + int exception_type, + int exception_code, + int exception_subcode, + mach_port_t thread_name); // Creates a new ExceptionHandler instance to handle writing minidumps. // Minidump files will be written to dump_path, and the optional callback @@ -84,22 +84,22 @@ class ExceptionHandler { // be written when WriteMinidump is called. // If port_name is non-NULL, attempt to perform out-of-process dump generation // If port_name is NULL, in-process dump generation will be used. - ExceptionHandler(const string &dump_path, + ExceptionHandler(const string& dump_path, FilterCallback filter, MinidumpCallback callback, - void *callback_context, bool install_handler, - const char *port_name); + void* callback_context, bool install_handler, + const char* port_name); // A special constructor if we want to bypass minidump writing and // simply get a callback with the exception information. ExceptionHandler(DirectCallback callback, - void *callback_context, + void* callback_context, bool install_handler); ~ExceptionHandler(); // Get and set the minidump path. string dump_path() const { return dump_path_; } - void set_dump_path(const string &dump_path) { + void set_dump_path(const string& dump_path) { dump_path_ = dump_path; dump_path_c_ = dump_path_.c_str(); UpdateNextID(); // Necessary to put dump_path_ in next_minidump_path_. @@ -126,7 +126,7 @@ class ExceptionHandler { bool WriteMinidumpWithException(int exception_type, int exception_code, int exception_subcode, - breakpad_ucontext_t *task_context, + breakpad_ucontext_t* task_context, mach_port_t thread_name, bool exit_after_write, bool report_current_thread); @@ -135,8 +135,8 @@ class ExceptionHandler { static void SignalHandler(int sig, siginfo_t* info, void* uc); // disallow copy ctor and operator= - explicit ExceptionHandler(const ExceptionHandler &); - void operator=(const ExceptionHandler &); + explicit ExceptionHandler(const ExceptionHandler&); + void operator=(const ExceptionHandler&); // Generates a new ID and stores it in next_minidump_id_, and stores the // path of the next minidump to be written in next_minidump_path_. @@ -152,15 +152,15 @@ class ExceptionHandler { string next_minidump_path_; // Pointers to the UTF-8 versions of above - const char *dump_path_c_; - const char *next_minidump_id_c_; - const char *next_minidump_path_c_; + const char* dump_path_c_; + const char* next_minidump_id_c_; + const char* next_minidump_path_c_; // The callback function and pointer to be passed back after the minidump // has been written FilterCallback filter_; MinidumpCallback callback_; - void *callback_context_; + void* callback_context_; // The callback function to be passed back when we don't want a minidump // file to be written diff --git a/src/client/ios/handler/ios_exception_minidump_generator.h b/src/client/ios/handler/ios_exception_minidump_generator.h index 21133e63..e48444a7 100644 --- a/src/client/ios/handler/ios_exception_minidump_generator.h +++ b/src/client/ios/handler/ios_exception_minidump_generator.h @@ -41,12 +41,12 @@ namespace google_breakpad { class IosExceptionMinidumpGenerator : public MinidumpGenerator { public: - explicit IosExceptionMinidumpGenerator(NSException *exception); + explicit IosExceptionMinidumpGenerator(NSException* exception); virtual ~IosExceptionMinidumpGenerator(); protected: - virtual bool WriteExceptionStream(MDRawDirectory *exception_stream); - virtual bool WriteThreadStream(mach_port_t thread_id, MDRawThread *thread); + virtual bool WriteExceptionStream(MDRawDirectory* exception_stream); + virtual bool WriteThreadStream(mach_port_t thread_id, MDRawThread* thread); private: @@ -57,16 +57,16 @@ class IosExceptionMinidumpGenerator : public MinidumpGenerator { uintptr_t GetLRFromException(); // Write a virtual thread context for the crashing site. - bool WriteCrashingContext(MDLocationDescriptor *register_location); + bool WriteCrashingContext(MDLocationDescriptor* register_location); // Per-CPU implementations of the above method. #ifdef HAS_ARM_SUPPORT - bool WriteCrashingContextARM(MDLocationDescriptor *register_location); + bool WriteCrashingContextARM(MDLocationDescriptor* register_location); #endif #ifdef HAS_ARM64_SUPPORT - bool WriteCrashingContextARM64(MDLocationDescriptor *register_location); + bool WriteCrashingContextARM64(MDLocationDescriptor* register_location); #endif - NSArray *return_addresses_; + NSArray* return_addresses_; }; } // namespace google_breakpad diff --git a/src/client/ios/handler/ios_exception_minidump_generator.mm b/src/client/ios/handler/ios_exception_minidump_generator.mm index f57bdf21..2a5d76d7 100644 --- a/src/client/ios/handler/ios_exception_minidump_generator.mm +++ b/src/client/ios/handler/ios_exception_minidump_generator.mm @@ -52,7 +52,7 @@ const uintptr_t kExpectedFinalSp = 0; // Append the given value to the sp position of the stack represented // by memory. -void AppendToMemory(uint8_t *memory, uintptr_t sp, uintptr_t data) { +void AppendToMemory(uint8_t* memory, uintptr_t sp, uintptr_t data) { memcpy(memory + sp, &data, sizeof(data)); } #endif @@ -62,7 +62,7 @@ void AppendToMemory(uint8_t *memory, uintptr_t sp, uintptr_t data) { namespace google_breakpad { IosExceptionMinidumpGenerator::IosExceptionMinidumpGenerator( - NSException *exception) + NSException* exception) : MinidumpGenerator(mach_task_self(), 0) { return_addresses_ = [[exception callStackReturnAddresses] retain]; SetExceptionInformation(kExceptionType, @@ -76,7 +76,7 @@ IosExceptionMinidumpGenerator::~IosExceptionMinidumpGenerator() { } bool IosExceptionMinidumpGenerator::WriteCrashingContext( - MDLocationDescriptor *register_location) { + MDLocationDescriptor* register_location) { #ifdef HAS_ARM_SUPPORT return WriteCrashingContextARM(register_location); #elif defined(HAS_ARM64_SUPPORT) @@ -89,12 +89,12 @@ bool IosExceptionMinidumpGenerator::WriteCrashingContext( #ifdef HAS_ARM_SUPPORT bool IosExceptionMinidumpGenerator::WriteCrashingContextARM( - MDLocationDescriptor *register_location) { + MDLocationDescriptor* register_location) { TypedMDRVA context(&writer_); if (!context.Allocate()) return false; *register_location = context.location(); - MDRawContextARM *context_ptr = context.get(); + MDRawContextARM* context_ptr = context.get(); memset(context_ptr, 0, sizeof(MDRawContextARM)); context_ptr->context_flags = MD_CONTEXT_ARM_FULL; context_ptr->iregs[MD_CONTEXT_ARM_REG_IOS_FP] = kExpectedFinalFp; // FP @@ -107,12 +107,12 @@ bool IosExceptionMinidumpGenerator::WriteCrashingContextARM( #ifdef HAS_ARM64_SUPPORT bool IosExceptionMinidumpGenerator::WriteCrashingContextARM64( - MDLocationDescriptor *register_location) { + MDLocationDescriptor* register_location) { TypedMDRVA context(&writer_); if (!context.Allocate()) return false; *register_location = context.location(); - MDRawContextARM64_Old *context_ptr = context.get(); + MDRawContextARM64_Old* context_ptr = context.get(); memset(context_ptr, 0, sizeof(*context_ptr)); context_ptr->context_flags = MD_CONTEXT_ARM64_FULL_OLD; context_ptr->iregs[MD_CONTEXT_ARM64_REG_FP] = kExpectedFinalFp; // FP @@ -132,7 +132,7 @@ uintptr_t IosExceptionMinidumpGenerator::GetLRFromException() { } bool IosExceptionMinidumpGenerator::WriteExceptionStream( - MDRawDirectory *exception_stream) { + MDRawDirectory* exception_stream) { #if defined(HAS_ARM_SUPPORT) || defined(HAS_ARM64_SUPPORT) TypedMDRVA exception(&writer_); @@ -141,7 +141,7 @@ bool IosExceptionMinidumpGenerator::WriteExceptionStream( exception_stream->stream_type = MD_EXCEPTION_STREAM; exception_stream->location = exception.location(); - MDRawExceptionStream *exception_ptr = exception.get(); + MDRawExceptionStream* exception_ptr = exception.get(); exception_ptr->thread_id = pthread_mach_thread_np(pthread_self()); // This naming is confusing, but it is the proper translation from @@ -160,7 +160,7 @@ bool IosExceptionMinidumpGenerator::WriteExceptionStream( } bool IosExceptionMinidumpGenerator::WriteThreadStream(mach_port_t thread_id, - MDRawThread *thread) { + MDRawThread* thread) { #if defined(HAS_ARM_SUPPORT) || defined(HAS_ARM64_SUPPORT) if (pthread_mach_thread_np(pthread_self()) != thread_id) return MinidumpGenerator::WriteThreadStream(thread_id, thread); diff --git a/src/client/linux/crash_generation/crash_generation_server.cc b/src/client/linux/crash_generation/crash_generation_server.cc index 26c50a5c..8332f59d 100644 --- a/src/client/linux/crash_generation/crash_generation_server.cc +++ b/src/client/linux/crash_generation/crash_generation_server.cc @@ -229,7 +229,7 @@ CrashGenerationServer::ClientEvent(short revents) // Walk the control payload and extract the file descriptor and validated pid. pid_t crashing_pid = -1; int signal_fd = -1; - for (struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); hdr; + for (struct cmsghdr* hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { if (hdr->cmsg_level != SOL_SOCKET) continue; @@ -248,7 +248,7 @@ CrashGenerationServer::ClientEvent(short revents) signal_fd = reinterpret_cast(CMSG_DATA(hdr))[0]; } } else if (hdr->cmsg_type == SCM_CREDENTIALS) { - const struct ucred *cred = + const struct ucred* cred = reinterpret_cast(CMSG_DATA(hdr)); crashing_pid = cred->pid; } @@ -324,7 +324,7 @@ CrashGenerationServer::MakeMinidumpFilename(string& outFilename) // static void* -CrashGenerationServer::ThreadMain(void *arg) +CrashGenerationServer::ThreadMain(void* arg) { reinterpret_cast(arg)->Run(); return NULL; diff --git a/src/client/linux/dump_writer_common/ucontext_reader.cc b/src/client/linux/dump_writer_common/ucontext_reader.cc index ee515c41..6eec1be2 100644 --- a/src/client/linux/dump_writer_common/ucontext_reader.cc +++ b/src/client/linux/dump_writer_common/ucontext_reader.cc @@ -48,7 +48,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { return uc->uc_mcontext.gregs[REG_EIP]; } -void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc, +void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc, const fpstate_t* fp) { const greg_t* regs = uc->uc_mcontext.gregs; @@ -96,7 +96,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { return uc->uc_mcontext.gregs[REG_RIP]; } -void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc, +void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc, const fpstate_t* fpregs) { const greg_t* regs = uc->uc_mcontext.gregs; @@ -153,7 +153,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { return uc->uc_mcontext.arm_pc; } -void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) { +void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc) { out->context_flags = MD_CONTEXT_ARM_FULL; out->iregs[0] = uc->uc_mcontext.arm_r0; @@ -192,7 +192,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { return uc->uc_mcontext.pc; } -void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc, +void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc, const struct fpsimd_context* fpregs) { out->context_flags = MD_CONTEXT_ARM64_FULL_OLD; @@ -218,7 +218,7 @@ uintptr_t UContextReader::GetInstructionPointer(const ucontext_t* uc) { return uc->uc_mcontext.pc; } -void UContextReader::FillCPUContext(RawContextCPU *out, const ucontext_t *uc) { +void UContextReader::FillCPUContext(RawContextCPU* out, const ucontext_t* uc) { #if _MIPS_SIM == _ABI64 out->context_flags = MD_CONTEXT_MIPS64_FULL; #elif _MIPS_SIM == _ABIO32 diff --git a/src/client/linux/dump_writer_common/ucontext_reader.h b/src/client/linux/dump_writer_common/ucontext_reader.h index 8e74a8a5..7d410088 100644 --- a/src/client/linux/dump_writer_common/ucontext_reader.h +++ b/src/client/linux/dump_writer_common/ucontext_reader.h @@ -50,13 +50,13 @@ struct UContextReader { // out: the minidump structure // info: the collection of register structures. #if defined(__i386__) || defined(__x86_64) - static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc, + static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc, const fpstate_t* fp); #elif defined(__aarch64__) - static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc, + static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc, const struct fpsimd_context* fpregs); #else - static void FillCPUContext(RawContextCPU *out, const ucontext_t *uc); + static void FillCPUContext(RawContextCPU* out, const ucontext_t* uc); #endif }; diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc index c65feaa1..ca353c40 100644 --- a/src/client/linux/handler/exception_handler.cc +++ b/src/client/linux/handler/exception_handler.cc @@ -419,8 +419,8 @@ struct ThreadArgument { // This is the entry function for the cloned process. We are in a compromised // context here: see the top of the file. // static -int ExceptionHandler::ThreadEntry(void *arg) { - const ThreadArgument *thread_arg = reinterpret_cast(arg); +int ExceptionHandler::ThreadEntry(void* arg) { + const ThreadArgument* thread_arg = reinterpret_cast(arg); // Close the write end of the pipe. This allows us to fail if the parent dies // while waiting for the continue signal. @@ -495,7 +495,7 @@ bool ExceptionHandler::SimulateSignalDelivery(int sig) { } // This function may run in a compromised context: see the top of the file. -bool ExceptionHandler::GenerateDump(CrashContext *context) { +bool ExceptionHandler::GenerateDump(CrashContext* context) { if (IsOutOfProcess()) return crash_generation_client_->RequestDump(context, sizeof(*context)); diff --git a/src/client/linux/handler/exception_handler.h b/src/client/linux/handler/exception_handler.h index f44483ff..f80843ea 100644 --- a/src/client/linux/handler/exception_handler.h +++ b/src/client/linux/handler/exception_handler.h @@ -82,7 +82,7 @@ class ExceptionHandler { // attempting to write a minidump. If a FilterCallback returns false, // Breakpad will immediately report the exception as unhandled without // writing a minidump, allowing another handler the opportunity to handle it. - typedef bool (*FilterCallback)(void *context); + typedef bool (*FilterCallback)(void* context); // A callback function to run after the minidump has been written. // |descriptor| contains the file descriptor or file path containing the @@ -234,7 +234,7 @@ class ExceptionHandler { static void RestoreHandlersLocked(); void PreresolveSymbols(); - bool GenerateDump(CrashContext *context); + bool GenerateDump(CrashContext* context); void SendContinueSignalToChild(); void WaitForContinueSignal(); diff --git a/src/client/linux/handler/exception_handler_unittest.cc b/src/client/linux/handler/exception_handler_unittest.cc index 8d8809fa..35dcbfd4 100644 --- a/src/client/linux/handler/exception_handler_unittest.cc +++ b/src/client/linux/handler/exception_handler_unittest.cc @@ -201,7 +201,7 @@ static bool DoneCallback(const MinidumpDescriptor& descriptor, // optimize them out. In the case of ExceptionHandlerTest::ExternalDumper, // GCC-4.9 optimized out the entire set up of ExceptionHandler, causing // test failure. -volatile int *p_null; // external linkage, so GCC can't tell that it +volatile int* p_null; // external linkage, so GCC can't tell that it // remains NULL. Volatile just for a good measure. static void DoNullPointerDereference() { *p_null = 1; @@ -994,7 +994,7 @@ CrashHandler(const void* crash_context, size_t crash_context_size, msg.msg_control = cmsg; msg.msg_controllen = sizeof(cmsg); - struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); + struct cmsghdr* hdr = CMSG_FIRSTHDR(&msg); hdr->cmsg_level = SOL_SOCKET; hdr->cmsg_type = SCM_RIGHTS; hdr->cmsg_len = CMSG_LEN(sizeof(int)); @@ -1003,7 +1003,7 @@ CrashHandler(const void* crash_context, size_t crash_context_size, hdr->cmsg_level = SOL_SOCKET; hdr->cmsg_type = SCM_CREDENTIALS; hdr->cmsg_len = CMSG_LEN(sizeof(struct ucred)); - struct ucred *cred = reinterpret_cast(CMSG_DATA(hdr)); + struct ucred* cred = reinterpret_cast(CMSG_DATA(hdr)); cred->uid = getuid(); cred->gid = getgid(); cred->pid = getpid(); @@ -1056,7 +1056,7 @@ TEST(ExceptionHandlerTest, ExternalDumper) { pid_t crashing_pid = -1; int signal_fd = -1; - for (struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); hdr; + for (struct cmsghdr* hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { if (hdr->cmsg_level != SOL_SOCKET) continue; @@ -1066,7 +1066,7 @@ TEST(ExceptionHandlerTest, ExternalDumper) { ASSERT_EQ(sizeof(int), len); signal_fd = *(reinterpret_cast(CMSG_DATA(hdr))); } else if (hdr->cmsg_type == SCM_CREDENTIALS) { - const struct ucred *cred = + const struct ucred* cred = reinterpret_cast(CMSG_DATA(hdr)); crashing_pid = cred->pid; } diff --git a/src/client/linux/log/log.cc b/src/client/linux/log/log.cc index fc23aa6d..31879409 100644 --- a/src/client/linux/log/log.cc +++ b/src/client/linux/log/log.cc @@ -44,8 +44,8 @@ namespace { // __android_log_buf_write() is not exported in the NDK and is being used by // dynamic runtime linking. Its declaration is taken from Android's // system/core/include/log/log.h. -using AndroidLogBufferWriteFunc = int (*)(int bufID, int prio, const char *tag, - const char *text); +using AndroidLogBufferWriteFunc = int (*)(int bufID, int prio, const char* tag, + const char* text); const int kAndroidCrashLogId = 4; // From LOG_ID_CRASH in log.h. const char kAndroidLogTag[] = "google-breakpad"; diff --git a/src/client/linux/minidump_writer/directory_reader_unittest.cc b/src/client/linux/minidump_writer/directory_reader_unittest.cc index 326f9e36..7292a636 100644 --- a/src/client/linux/minidump_writer/directory_reader_unittest.cc +++ b/src/client/linux/minidump_writer/directory_reader_unittest.cc @@ -47,7 +47,7 @@ typedef testing::Test DirectoryReaderTest; TEST(DirectoryReaderTest, CompareResults) { std::set dent_set; - DIR *const dir = opendir("/proc/self"); + DIR* const dir = opendir("/proc/self"); ASSERT_TRUE(dir != NULL); struct dirent* dent; diff --git a/src/client/linux/minidump_writer/line_reader.h b/src/client/linux/minidump_writer/line_reader.h index 779cfeb6..9fc4b7cc 100644 --- a/src/client/linux/minidump_writer/line_reader.h +++ b/src/client/linux/minidump_writer/line_reader.h @@ -61,7 +61,7 @@ class LineReader { // // One must call |PopLine| after this function, otherwise you'll continue to // get the same line over and over. - bool GetNextLine(const char **line, unsigned *len) { + bool GetNextLine(const char** line, unsigned* len) { for (;;) { if (buf_used_ == 0 && hit_eof_) return false; diff --git a/src/client/linux/minidump_writer/line_reader_unittest.cc b/src/client/linux/minidump_writer/line_reader_unittest.cc index 29686f04..e1ac445a 100644 --- a/src/client/linux/minidump_writer/line_reader_unittest.cc +++ b/src/client/linux/minidump_writer/line_reader_unittest.cc @@ -59,7 +59,7 @@ TEST(LineReaderTest, EmptyFile) { ASSERT_TRUE(file.IsOk()); LineReader reader(file.GetFd()); - const char *line; + const char* line; unsigned len; ASSERT_FALSE(reader.GetNextLine(&line, &len)); } @@ -69,7 +69,7 @@ TEST(LineReaderTest, OneLineTerminated) { ASSERT_TRUE(file.IsOk()); LineReader reader(file.GetFd()); - const char *line; + const char* line; unsigned int len; ASSERT_TRUE(reader.GetNextLine(&line, &len)); ASSERT_EQ((unsigned int)1, len); @@ -85,7 +85,7 @@ TEST(LineReaderTest, OneLine) { ASSERT_TRUE(file.IsOk()); LineReader reader(file.GetFd()); - const char *line; + const char* line; unsigned len; ASSERT_TRUE(reader.GetNextLine(&line, &len)); ASSERT_EQ((unsigned)1, len); @@ -101,7 +101,7 @@ TEST(LineReaderTest, TwoLinesTerminated) { ASSERT_TRUE(file.IsOk()); LineReader reader(file.GetFd()); - const char *line; + const char* line; unsigned len; ASSERT_TRUE(reader.GetNextLine(&line, &len)); ASSERT_EQ((unsigned)1, len); @@ -123,7 +123,7 @@ TEST(LineReaderTest, TwoLines) { ASSERT_TRUE(file.IsOk()); LineReader reader(file.GetFd()); - const char *line; + const char* line; unsigned len; ASSERT_TRUE(reader.GetNextLine(&line, &len)); ASSERT_EQ((unsigned)1, len); @@ -147,7 +147,7 @@ TEST(LineReaderTest, MaxLength) { ASSERT_TRUE(file.IsOk()); LineReader reader(file.GetFd()); - const char *line; + const char* line; unsigned len; ASSERT_TRUE(reader.GetNextLine(&line, &len)); ASSERT_EQ(sizeof(l), len); @@ -163,7 +163,7 @@ TEST(LineReaderTest, TooLong) { ASSERT_TRUE(file.IsOk()); LineReader reader(file.GetFd()); - const char *line; + const char* line; unsigned len; ASSERT_FALSE(reader.GetNextLine(&line, &len)); } diff --git a/src/client/linux/minidump_writer/linux_dumper.cc b/src/client/linux/minidump_writer/linux_dumper.cc index 1112035b..7fd6532a 100644 --- a/src/client/linux/minidump_writer/linux_dumper.cc +++ b/src/client/linux/minidump_writer/linux_dumper.cc @@ -135,7 +135,7 @@ const size_t kHpageMask = (~(kHpageSize - 1)); // next is backed by some file. // curr and next are contiguous. // offset(next) == sizeof(curr) -void TryRecoverMappings(MappingInfo *curr, MappingInfo *next) { +void TryRecoverMappings(MappingInfo* curr, MappingInfo* next) { // Merged segments are marked with size = 0. if (curr->size == 0 || next->size == 0) return; @@ -167,8 +167,8 @@ void TryRecoverMappings(MappingInfo *curr, MappingInfo *next) { // next and prev are backed by the same file. // prev, curr and next are contiguous. // offset(next) == offset(prev) + sizeof(prev) + sizeof(curr) -void TryRecoverMappings(MappingInfo *prev, MappingInfo *curr, - MappingInfo *next) { +void TryRecoverMappings(MappingInfo* prev, MappingInfo* curr, + MappingInfo* next) { // Merged segments are marked with size = 0. if (prev->size == 0 || curr->size == 0 || next->size == 0) return; @@ -551,11 +551,11 @@ bool LinuxDumper::EnumerateMappings() { // See http://www.trilithium.com/johan/2005/08/linux-gate/ for more // information. const void* linux_gate_loc = - reinterpret_cast(auxv_[AT_SYSINFO_EHDR]); + reinterpret_cast(auxv_[AT_SYSINFO_EHDR]); // Although the initial executable is usually the first mapping, it's not // guaranteed (see http://crosbug.com/25355); therefore, try to use the // actual entry point to find the mapping. - const void* entry_point_loc = reinterpret_cast(auxv_[AT_ENTRY]); + const void* entry_point_loc = reinterpret_cast(auxv_[AT_ENTRY]); const int fd = sys_open(maps_path, O_RDONLY, 0); if (fd < 0) diff --git a/src/client/linux/minidump_writer/linux_dumper.h b/src/client/linux/minidump_writer/linux_dumper.h index f4a75d90..7bee160f 100644 --- a/src/client/linux/minidump_writer/linux_dumper.h +++ b/src/client/linux/minidump_writer/linux_dumper.h @@ -110,8 +110,8 @@ class LinuxDumper { } // These are only valid after a call to |Init|. - const wasteful_vector &threads() { return threads_; } - const wasteful_vector &mappings() { return mappings_; } + const wasteful_vector& threads() { return threads_; } + const wasteful_vector& mappings() { return mappings_; } const MappingInfo* FindMapping(const void* address) const; // Find the mapping which the given memory address falls in. Unlike // FindMapping, this method uses the unadjusted mapping address diff --git a/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc index 3ad48e50..331f4bb3 100644 --- a/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc +++ b/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc @@ -55,8 +55,8 @@ #error This test has not been ported to this platform. #endif -void *thread_function(void *data) { - int pipefd = *static_cast(data); +void* thread_function(void* data) { + int pipefd = *static_cast(data); volatile pid_t* thread_id = new pid_t; *thread_id = syscall(__NR_gettid); // Signal parent that a thread has started. @@ -65,13 +65,13 @@ void *thread_function(void *data) { perror("ERROR: parent notification failed"); return NULL; } - register volatile pid_t *thread_id_ptr asm(TID_PTR_REGISTER) = thread_id; + register volatile pid_t* thread_id_ptr asm(TID_PTR_REGISTER) = thread_id; while (true) asm volatile ("" : : "r" (thread_id_ptr)); return NULL; } -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { if (argc < 3) { fprintf(stderr, "usage: linux_dumper_unittest_helper <# of threads>\n"); diff --git a/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc b/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc index ea6b9a12..da71e15d 100644 --- a/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc +++ b/src/client/linux/minidump_writer/linux_ptrace_dumper_unittest.cc @@ -337,7 +337,7 @@ TEST_F(LinuxPtraceDumperChildTest, MappingsIncludeLinuxGate) { ASSERT_TRUE(dumper.Init()); void* linux_gate_loc = - reinterpret_cast(dumper.auxv()[AT_SYSINFO_EHDR]); + reinterpret_cast(dumper.auxv()[AT_SYSINFO_EHDR]); ASSERT_TRUE(linux_gate_loc); bool found_linux_gate = false; diff --git a/src/client/linux/minidump_writer/minidump_writer.cc b/src/client/linux/minidump_writer/minidump_writer.cc index f8cdf2a1..32634ef0 100644 --- a/src/client/linux/minidump_writer/minidump_writer.cc +++ b/src/client/linux/minidump_writer/minidump_writer.cc @@ -740,14 +740,14 @@ class MinidumpWriter { } bool WriteDSODebugStream(MDRawDirectory* dirent) { - ElfW(Phdr)* phdr = reinterpret_cast(dumper_->auxv()[AT_PHDR]); + ElfW(Phdr)* phdr = reinterpret_cast(dumper_->auxv()[AT_PHDR]); char* base; int phnum = dumper_->auxv()[AT_PHNUM]; if (!phnum || !phdr) return false; // Assume the program base is at the beginning of the same page as the PHDR - base = reinterpret_cast(reinterpret_cast(phdr) & ~0xfff); + base = reinterpret_cast(reinterpret_cast(phdr) & ~0xfff); // Search for the program PT_DYNAMIC segment ElfW(Addr) dyn_addr = 0; @@ -768,7 +768,7 @@ class MinidumpWriter { if (!dyn_addr) return false; - ElfW(Dyn) *dynamic = reinterpret_cast(dyn_addr + base); + ElfW(Dyn)* dynamic = reinterpret_cast(dyn_addr + base); // The dynamic linker makes information available that helps gdb find all // DSOs loaded into the program. If this information is indeed available, @@ -1222,7 +1222,7 @@ class MinidumpWriter { Buffers* next; size_t len; uint8_t data[kBufSize]; - } *buffers = reinterpret_cast(Alloc(sizeof(Buffers))); + }* buffers = reinterpret_cast(Alloc(sizeof(Buffers))); buffers->next = NULL; buffers->len = 0; diff --git a/src/client/linux/minidump_writer/minidump_writer_unittest.cc b/src/client/linux/minidump_writer/minidump_writer_unittest.cc index 3017a49a..ac93a343 100644 --- a/src/client/linux/minidump_writer/minidump_writer_unittest.cc +++ b/src/client/linux/minidump_writer/minidump_writer_unittest.cc @@ -299,10 +299,10 @@ TEST(MinidumpWriterTest, MinidumpStacksSkippedIfRequested) { Minidump minidump(templ); ASSERT_TRUE(minidump.Read()); - MinidumpThreadList *threads = minidump.GetThreadList(); + MinidumpThreadList* threads = minidump.GetThreadList(); int threads_with_stacks = 0; for (unsigned int i = 0; i < threads->thread_count(); ++i) { - MinidumpThread *thread = threads->GetThreadAtIndex(i); + MinidumpThread* thread = threads->GetThreadAtIndex(i); if (thread->GetMemory()) { ++threads_with_stacks; } @@ -353,13 +353,13 @@ TEST(MinidumpWriterTest, StacksAreSanitizedIfRequested) { #else 0x0defaced; #endif - MinidumpThreadList *threads = minidump.GetThreadList(); + MinidumpThreadList* threads = minidump.GetThreadList(); for (unsigned int i = 0; i < threads->thread_count(); ++i) { - MinidumpThread *thread = threads->GetThreadAtIndex(i); - MinidumpMemoryRegion *mem = thread->GetMemory(); + MinidumpThread* thread = threads->GetThreadAtIndex(i); + MinidumpMemoryRegion* mem = thread->GetMemory(); ASSERT_TRUE(mem != nullptr); uint32_t sz = mem->GetSize(); - const uint8_t *data = mem->GetMemory(); + const uint8_t* data = mem->GetMemory(); ASSERT_TRUE(memmem(data, sz, &defaced, sizeof(defaced)) != nullptr); } close(fds[1]); diff --git a/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc b/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc index 9f46fa65..8e2319e7 100644 --- a/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc +++ b/src/client/linux/minidump_writer/minidump_writer_unittest_utils.cc @@ -41,7 +41,7 @@ namespace google_breakpad { string GetHelperBinary() { string helper_path; - char *bindir = getenv("bindir"); + char* bindir = getenv("bindir"); if (bindir) { helper_path = string(bindir) + "/"; } else { diff --git a/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc b/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc index 6037c7e6..d9b1203e 100644 --- a/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc +++ b/src/client/linux/minidump_writer/proc_cpuinfo_reader_unittest.cc @@ -65,7 +65,7 @@ TEST(ProcCpuInfoReaderTest, EmptyFile) { ASSERT_TRUE(file.IsOk()); ProcCpuInfoReader reader(file.GetFd()); - const char *field; + const char* field; ASSERT_FALSE(reader.GetNextField(&field)); } @@ -74,7 +74,7 @@ TEST(ProcCpuInfoReaderTest, OneLineTerminated) { ASSERT_TRUE(file.IsOk()); ProcCpuInfoReader reader(file.GetFd()); - const char *field; + const char* field; ASSERT_TRUE(reader.GetNextField(&field)); ASSERT_STREQ("foo", field); ASSERT_STREQ("bar", reader.GetValue()); @@ -87,7 +87,7 @@ TEST(ProcCpuInfoReaderTest, OneLine) { ASSERT_TRUE(file.IsOk()); ProcCpuInfoReader reader(file.GetFd()); - const char *field; + const char* field; size_t value_len; ASSERT_TRUE(reader.GetNextField(&field)); ASSERT_STREQ("foo", field); diff --git a/src/client/linux/sender/google_crash_report_sender.cc b/src/client/linux/sender/google_crash_report_sender.cc index f83a0e89..6bf337a8 100644 --- a/src/client/linux/sender/google_crash_report_sender.cc +++ b/src/client/linux/sender/google_crash_report_sender.cc @@ -84,7 +84,7 @@ bool CheckForRequiredFlagsOrDie() { return true; } -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { google::InitGoogleLogging(argv[0]); google::ParseCommandLineFlags(&argc, &argv, true); if (!CheckForRequiredFlagsOrDie()) { diff --git a/src/client/mac/Framework/Breakpad.h b/src/client/mac/Framework/Breakpad.h index dc7e45d1..9e191ce2 100644 --- a/src/client/mac/Framework/Breakpad.h +++ b/src/client/mac/Framework/Breakpad.h @@ -45,7 +45,7 @@ // OnDemandServer and restored in Inspector. #define BREAKPAD_BOOTSTRAP_PARENT_PORT "com.Breakpad.BootstrapParent" -typedef void *BreakpadRef; +typedef void* BreakpadRef; #ifdef __cplusplus extern "C" { @@ -65,7 +65,7 @@ extern "C" { typedef bool (*BreakpadFilterCallback)(int exception_type, int exception_code, mach_port_t crashing_thread, - void *context); + void* context); // Create a new BreakpadRef object and install it as an exception // handler. The |parameters| will typically be the contents of your @@ -226,7 +226,7 @@ typedef bool (*BreakpadFilterCallback)(int exception_type, // Only used in crash_report_sender. // Returns a new BreakpadRef object on success, NULL otherwise. -BreakpadRef BreakpadCreate(NSDictionary *parameters); +BreakpadRef BreakpadCreate(NSDictionary* parameters); // Uninstall and release the data associated with |ref|. void BreakpadRelease(BreakpadRef ref); @@ -238,7 +238,7 @@ void BreakpadRelease(BreakpadRef ref); // Context is a pointer to arbitrary data to make the callback with. void BreakpadSetFilterCallback(BreakpadRef ref, BreakpadFilterCallback callback, - void *context); + void* context); // User defined key and value string storage. Generally this is used // to configure Breakpad's internal operation, such as whether the @@ -259,23 +259,23 @@ void BreakpadSetFilterCallback(BreakpadRef ref, // TODO (nealsid): separate server parameter dictionary from the // dictionary used to configure Breakpad, and document limits for each // independently. -void BreakpadSetKeyValue(BreakpadRef ref, NSString *key, NSString *value); -NSString *BreakpadKeyValue(BreakpadRef ref, NSString *key); -void BreakpadRemoveKeyValue(BreakpadRef ref, NSString *key); +void BreakpadSetKeyValue(BreakpadRef ref, NSString* key, NSString* value); +NSString* BreakpadKeyValue(BreakpadRef ref, NSString* key); +void BreakpadRemoveKeyValue(BreakpadRef ref, NSString* key); // You can use this method to specify parameters that will be uploaded // to the crash server. They will be automatically encoded as // necessary. Note that as mentioned above there are limits on both // the number of keys and their length. -void BreakpadAddUploadParameter(BreakpadRef ref, NSString *key, - NSString *value); +void BreakpadAddUploadParameter(BreakpadRef ref, NSString* key, + NSString* value); // This method will remove a previously-added parameter from the // upload parameter set. -void BreakpadRemoveUploadParameter(BreakpadRef ref, NSString *key); +void BreakpadRemoveUploadParameter(BreakpadRef ref, NSString* key); // Add a log file for Breakpad to read and send upon crash dump -void BreakpadAddLogFile(BreakpadRef ref, NSString *logPathname); +void BreakpadAddLogFile(BreakpadRef ref, NSString* logPathname); // Generate a minidump and send void BreakpadGenerateAndSendReport(BreakpadRef ref); diff --git a/src/client/mac/Framework/Breakpad.mm b/src/client/mac/Framework/Breakpad.mm index b2140549..1a46b597 100644 --- a/src/client/mac/Framework/Breakpad.mm +++ b/src/client/mac/Framework/Breakpad.mm @@ -81,9 +81,9 @@ using google_breakpad::SimpleStringDictionary; // allocation of C++ objects. Note that we don't use operator delete() // but instead call the objects destructor directly: object->~ClassName(); // -ProtectedMemoryAllocator *gMasterAllocator = NULL; -ProtectedMemoryAllocator *gKeyValueAllocator = NULL; -ProtectedMemoryAllocator *gBreakpadAllocator = NULL; +ProtectedMemoryAllocator* gMasterAllocator = NULL; +ProtectedMemoryAllocator* gKeyValueAllocator = NULL; +ProtectedMemoryAllocator* gBreakpadAllocator = NULL; // Mutex for thread-safe access to the key/value dictionary used by breakpad. // It's a global instead of an instance variable of Breakpad @@ -98,8 +98,8 @@ pthread_mutex_t gDictionaryMutex; // Its destructor will first re-protect the memory then release the lock. class ProtectedMemoryLocker { public: - ProtectedMemoryLocker(pthread_mutex_t *mutex, - ProtectedMemoryAllocator *allocator) + ProtectedMemoryLocker(pthread_mutex_t* mutex, + ProtectedMemoryAllocator* allocator) : mutex_(mutex), allocator_(allocator) { // Lock the mutex @@ -124,17 +124,17 @@ class ProtectedMemoryLocker { ProtectedMemoryLocker(const ProtectedMemoryLocker&); ProtectedMemoryLocker& operator=(const ProtectedMemoryLocker&); - pthread_mutex_t *mutex_; - ProtectedMemoryAllocator *allocator_; + pthread_mutex_t* mutex_; + ProtectedMemoryAllocator* allocator_; }; //============================================================================= class Breakpad { public: // factory method - static Breakpad *Create(NSDictionary *parameters) { + static Breakpad* Create(NSDictionary* parameters) { // Allocate from our special allocation pool - Breakpad *breakpad = + Breakpad* breakpad = new (gBreakpadAllocator->Allocate(sizeof(Breakpad))) Breakpad(); @@ -152,13 +152,13 @@ class Breakpad { ~Breakpad(); - void SetKeyValue(NSString *key, NSString *value); - NSString *KeyValue(NSString *key); - void RemoveKeyValue(NSString *key); + void SetKeyValue(NSString* key, NSString* value); + NSString* KeyValue(NSString* key); + void RemoveKeyValue(NSString* key); void GenerateAndSendReport(); - void SetFilterCallback(BreakpadFilterCallback callback, void *context) { + void SetFilterCallback(BreakpadFilterCallback callback, void* context) { filter_callback_ = callback; filter_callback_context_ = context; } @@ -173,14 +173,14 @@ class Breakpad { inspector_path_[0] = 0; } - bool Initialize(NSDictionary *parameters); - bool InitializeInProcess(NSDictionary *parameters); - bool InitializeOutOfProcess(NSDictionary *parameters); + bool Initialize(NSDictionary* parameters); + bool InitializeInProcess(NSDictionary* parameters); + bool InitializeOutOfProcess(NSDictionary* parameters); - bool ExtractParameters(NSDictionary *parameters); + bool ExtractParameters(NSDictionary* parameters); // Dispatches to HandleException() - static bool ExceptionHandlerDirectCallback(void *context, + static bool ExceptionHandlerDirectCallback(void* context, int exception_type, int exception_code, int exception_subcode, @@ -194,28 +194,28 @@ class Breakpad { // Dispatches to HandleMinidump(). // This gets called instead of ExceptionHandlerDirectCallback when running // with the BREAKPAD_IN_PROCESS option. - static bool HandleMinidumpCallback(const char *dump_dir, - const char *minidump_id, - void *context, + static bool HandleMinidumpCallback(const char* dump_dir, + const char* minidump_id, + void* context, bool succeeded); // This is only used when BREAKPAD_IN_PROCESS is YES. - bool HandleMinidump(const char *dump_dir, const char *minidump_id); + bool HandleMinidump(const char* dump_dir, const char* minidump_id); // Since ExceptionHandler (w/o namespace) is defined as typedef in OSX's // MachineExceptions.h, we have to explicitly name the handler. - google_breakpad::ExceptionHandler *handler_; // The actual handler (STRONG) + google_breakpad::ExceptionHandler* handler_; // The actual handler (STRONG) char inspector_path_[PATH_MAX]; // Path to inspector tool - SimpleStringDictionary *config_params_; // Create parameters (STRONG) + SimpleStringDictionary* config_params_; // Create parameters (STRONG) OnDemandServer inspector_; bool send_and_exit_; // Exit after sending, if true BreakpadFilterCallback filter_callback_; - void *filter_callback_context_; + void* filter_callback_context_; }; #pragma mark - @@ -227,14 +227,14 @@ class Breakpad { //============================================================================= static BOOL IsDebuggerActive() { BOOL result = NO; - NSUserDefaults *stdDefaults = [NSUserDefaults standardUserDefaults]; + NSUserDefaults* stdDefaults = [NSUserDefaults standardUserDefaults]; // We check both defaults and the environment variable here BOOL ignoreDebugger = [stdDefaults boolForKey:@IGNORE_DEBUGGER]; if (!ignoreDebugger) { - char *ignoreDebuggerStr = getenv(IGNORE_DEBUGGER); + char* ignoreDebuggerStr = getenv(IGNORE_DEBUGGER); ignoreDebugger = (ignoreDebuggerStr ? strtol(ignoreDebuggerStr, NULL, 10) : 0) != 0; } @@ -245,7 +245,7 @@ static BOOL IsDebuggerActive() { size_t actualSize; if (sysctl(mib, mibSize, NULL, &actualSize, NULL, 0) == 0) { - struct kinfo_proc *info = (struct kinfo_proc *)malloc(actualSize); + struct kinfo_proc* info = (struct kinfo_proc*)malloc(actualSize); if (info) { // This comes from looking at the Darwin xnu Kernel @@ -261,12 +261,12 @@ static BOOL IsDebuggerActive() { } //============================================================================= -bool Breakpad::ExceptionHandlerDirectCallback(void *context, - int exception_type, - int exception_code, - int exception_subcode, - mach_port_t crashing_thread) { - Breakpad *breakpad = (Breakpad *)context; +bool Breakpad::ExceptionHandlerDirectCallback(void* context, + int exception_type, + int exception_code, + int exception_subcode, + mach_port_t crashing_thread) { + Breakpad* breakpad = (Breakpad*)context; // If our context is damaged or something, just return false to indicate that // the handler should continue without us. @@ -280,11 +280,11 @@ bool Breakpad::ExceptionHandlerDirectCallback(void *context, } //============================================================================= -bool Breakpad::HandleMinidumpCallback(const char *dump_dir, - const char *minidump_id, - void *context, +bool Breakpad::HandleMinidumpCallback(const char* dump_dir, + const char* minidump_id, + void* context, bool succeeded) { - Breakpad *breakpad = (Breakpad *)context; + Breakpad* breakpad = (Breakpad*)context; // If our context is damaged or something, just return false to indicate that // the handler should continue without us. @@ -307,9 +307,9 @@ bool Breakpad::HandleMinidumpCallback(const char *dump_dir, // simple non-static C name // extern "C" { -NSString * GetResourcePath(); -NSString * GetResourcePath() { - NSString *resourcePath = nil; +NSString* GetResourcePath(); +NSString* GetResourcePath() { + NSString* resourcePath = nil; // If there are multiple breakpads installed then calling bundleWithIdentifier // will not work properly, so only use that as a backup plan. @@ -320,17 +320,17 @@ NSString * GetResourcePath() { // Get the pathname to the code which contains this function Dl_info info; if (dladdr((const void*)GetResourcePath, &info) != 0) { - NSFileManager *filemgr = [NSFileManager defaultManager]; - NSString *filePath = + NSFileManager* filemgr = [NSFileManager defaultManager]; + NSString* filePath = [filemgr stringWithFileSystemRepresentation:info.dli_fname length:strlen(info.dli_fname)]; - NSString *bundlePath = [filePath stringByDeletingLastPathComponent]; + NSString* bundlePath = [filePath stringByDeletingLastPathComponent]; // The "Resources" directory should be in the same directory as the // executable code, since that's how the Breakpad framework is built. resourcePath = [bundlePath stringByAppendingPathComponent:@"Resources/"]; } else { // fallback plan - NSBundle *bundle = + NSBundle* bundle = [NSBundle bundleWithIdentifier:@"com.Google.BreakpadFramework"]; resourcePath = [bundle resourcePath]; } @@ -340,7 +340,7 @@ NSString * GetResourcePath() { } // extern "C" //============================================================================= -bool Breakpad::Initialize(NSDictionary *parameters) { +bool Breakpad::Initialize(NSDictionary* parameters) { // Initialize config_params_ = NULL; handler_ = NULL; @@ -375,7 +375,7 @@ bool Breakpad::InitializeInProcess(NSDictionary* parameters) { //============================================================================= bool Breakpad::InitializeOutOfProcess(NSDictionary* parameters) { // Get path to Inspector executable. - NSString *inspectorPathString = KeyValue(@BREAKPAD_INSPECTOR_LOCATION); + NSString* inspectorPathString = KeyValue(@BREAKPAD_INSPECTOR_LOCATION); // Standardize path (resolve symlinkes, etc.) and escape spaces inspectorPathString = [inspectorPathString stringByStandardizingPath]; @@ -434,34 +434,34 @@ Breakpad::~Breakpad() { } //============================================================================= -bool Breakpad::ExtractParameters(NSDictionary *parameters) { - NSUserDefaults *stdDefaults = [NSUserDefaults standardUserDefaults]; - NSString *skipConfirm = [stdDefaults stringForKey:@BREAKPAD_SKIP_CONFIRM]; - NSString *sendAndExit = [stdDefaults stringForKey:@BREAKPAD_SEND_AND_EXIT]; - - NSString *serverType = [parameters objectForKey:@BREAKPAD_SERVER_TYPE]; - NSString *display = [parameters objectForKey:@BREAKPAD_PRODUCT_DISPLAY]; - NSString *product = [parameters objectForKey:@BREAKPAD_PRODUCT]; - NSString *version = [parameters objectForKey:@BREAKPAD_VERSION]; - NSString *urlStr = [parameters objectForKey:@BREAKPAD_URL]; - NSString *interval = [parameters objectForKey:@BREAKPAD_REPORT_INTERVAL]; - NSString *inspectorPathString = +bool Breakpad::ExtractParameters(NSDictionary* parameters) { + NSUserDefaults* stdDefaults = [NSUserDefaults standardUserDefaults]; + NSString* skipConfirm = [stdDefaults stringForKey:@BREAKPAD_SKIP_CONFIRM]; + NSString* sendAndExit = [stdDefaults stringForKey:@BREAKPAD_SEND_AND_EXIT]; + + NSString* serverType = [parameters objectForKey:@BREAKPAD_SERVER_TYPE]; + NSString* display = [parameters objectForKey:@BREAKPAD_PRODUCT_DISPLAY]; + NSString* product = [parameters objectForKey:@BREAKPAD_PRODUCT]; + NSString* version = [parameters objectForKey:@BREAKPAD_VERSION]; + NSString* urlStr = [parameters objectForKey:@BREAKPAD_URL]; + NSString* interval = [parameters objectForKey:@BREAKPAD_REPORT_INTERVAL]; + NSString* inspectorPathString = [parameters objectForKey:@BREAKPAD_INSPECTOR_LOCATION]; - NSString *reporterPathString = + NSString* reporterPathString = [parameters objectForKey:@BREAKPAD_REPORTER_EXE_LOCATION]; - NSString *timeout = [parameters objectForKey:@BREAKPAD_CONFIRM_TIMEOUT]; - NSArray *logFilePaths = [parameters objectForKey:@BREAKPAD_LOGFILES]; - NSString *logFileTailSize = + NSString* timeout = [parameters objectForKey:@BREAKPAD_CONFIRM_TIMEOUT]; + NSArray* logFilePaths = [parameters objectForKey:@BREAKPAD_LOGFILES]; + NSString* logFileTailSize = [parameters objectForKey:@BREAKPAD_LOGFILE_UPLOAD_SIZE]; - NSString *requestUserText = + NSString* requestUserText = [parameters objectForKey:@BREAKPAD_REQUEST_COMMENTS]; - NSString *requestEmail = [parameters objectForKey:@BREAKPAD_REQUEST_EMAIL]; - NSString *vendor = + NSString* requestEmail = [parameters objectForKey:@BREAKPAD_REQUEST_EMAIL]; + NSString* vendor = [parameters objectForKey:@BREAKPAD_VENDOR]; - NSString *dumpSubdirectory = + NSString* dumpSubdirectory = [parameters objectForKey:@BREAKPAD_DUMP_DIRECTORY]; - NSDictionary *serverParameters = + NSDictionary* serverParameters = [parameters objectForKey:@BREAKPAD_SERVER_PARAMETER_DICT]; // These may have been set above as user prefs, which take priority. @@ -536,7 +536,7 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { } // Find the helper applications if not specified in user config. - NSString *resourcePath = nil; + NSString* resourcePath = nil; if (!inspectorPathString || !reporterPathString) { resourcePath = GetResourcePath(); if (!resourcePath) { @@ -591,7 +591,7 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { new (gKeyValueAllocator->Allocate(sizeof(SimpleStringDictionary)) ) SimpleStringDictionary(); - SimpleStringDictionary &dictionary = *config_params_; + SimpleStringDictionary& dictionary = *config_params_; dictionary.SetKeyValue(BREAKPAD_SERVER_TYPE, [serverType UTF8String]); dictionary.SetKeyValue(BREAKPAD_PRODUCT_DISPLAY, [display UTF8String]); @@ -633,8 +633,8 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { if (serverParameters) { // For each key-value pair, call BreakpadAddUploadParameter() - NSEnumerator *keyEnumerator = [serverParameters keyEnumerator]; - NSString *aParameter; + NSEnumerator* keyEnumerator = [serverParameters keyEnumerator]; + NSString* aParameter; while ((aParameter = [keyEnumerator nextObject])) { BreakpadAddUploadParameter(this, aParameter, [serverParameters objectForKey:aParameter]); @@ -644,7 +644,7 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) { } //============================================================================= -void Breakpad::SetKeyValue(NSString *key, NSString *value) { +void Breakpad::SetKeyValue(NSString* key, NSString* value) { // We allow nil values. This is the same as removing the keyvalue. if (!config_params_ || !key) return; @@ -653,16 +653,16 @@ void Breakpad::SetKeyValue(NSString *key, NSString *value) { } //============================================================================= -NSString *Breakpad::KeyValue(NSString *key) { +NSString* Breakpad::KeyValue(NSString* key) { if (!config_params_ || !key) return nil; - const char *value = config_params_->GetValueForKey([key UTF8String]); + const char* value = config_params_->GetValueForKey([key UTF8String]); return value ? [NSString stringWithUTF8String:value] : nil; } //============================================================================= -void Breakpad::RemoveKeyValue(NSString *key) { +void Breakpad::RemoveKeyValue(NSString* key) { if (!config_params_ || !key) return; config_params_->RemoveKey([key UTF8String]); @@ -722,7 +722,7 @@ bool Breakpad::HandleException(int exception_type, if (result == KERN_SUCCESS) { // Now, send a series of key-value pairs to the Inspector. - const SimpleStringDictionary::Entry *entry = NULL; + const SimpleStringDictionary::Entry* entry = NULL; SimpleStringDictionary::Iterator iter(*config_params_); while ( (entry = iter.Next()) ) { @@ -759,7 +759,7 @@ bool Breakpad::HandleException(int exception_type, } //============================================================================= -bool Breakpad::HandleMinidump(const char *dump_dir, const char *minidump_id) { +bool Breakpad::HandleMinidump(const char* dump_dir, const char* minidump_id) { google_breakpad::ConfigFile config_file; config_file.WriteFile(dump_dir, config_params_, dump_dir, minidump_id); google_breakpad::LaunchReporter( @@ -775,7 +775,7 @@ bool Breakpad::HandleMinidump(const char *dump_dir, const char *minidump_id) { #pragma mark Public API //============================================================================= -BreakpadRef BreakpadCreate(NSDictionary *parameters) { +BreakpadRef BreakpadCreate(NSDictionary* parameters) { try { // This is confusing. Our two main allocators for breakpad memory are: // - gKeyValueAllocator for the key/value memory @@ -815,8 +815,8 @@ BreakpadRef BreakpadCreate(NSDictionary *parameters) { ProtectedMemoryAllocator(breakpad_pool_size); // Stack-based autorelease pool for Breakpad::Create() obj-c code. - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - Breakpad *breakpad = Breakpad::Create(parameters); + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + Breakpad* breakpad = Breakpad::Create(parameters); if (breakpad) { // Make read-only to protect against memory smashers @@ -856,7 +856,7 @@ BreakpadRef BreakpadCreate(NSDictionary *parameters) { //============================================================================= void BreakpadRelease(BreakpadRef ref) { try { - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (gMasterAllocator) { gMasterAllocator->Unprotect(); @@ -889,10 +889,10 @@ void BreakpadRelease(BreakpadRef ref) { } //============================================================================= -void BreakpadSetKeyValue(BreakpadRef ref, NSString *key, NSString *value) { +void BreakpadSetKeyValue(BreakpadRef ref, NSString* key, NSString* value) { try { // Not called at exception time - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad && key && gKeyValueAllocator) { ProtectedMemoryLocker locker(&gDictionaryMutex, gKeyValueAllocator); @@ -905,20 +905,20 @@ void BreakpadSetKeyValue(BreakpadRef ref, NSString *key, NSString *value) { } void BreakpadAddUploadParameter(BreakpadRef ref, - NSString *key, - NSString *value) { + NSString* key, + NSString* value) { // The only difference, internally, between an upload parameter and // a key value one that is set with BreakpadSetKeyValue is that we // prepend the keyname with a special prefix. This informs the // crash sender that the parameter should be sent along with the // POST of the crash dump upload. try { - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad && key && gKeyValueAllocator) { ProtectedMemoryLocker locker(&gDictionaryMutex, gKeyValueAllocator); - NSString *prefixedKey = [@BREAKPAD_SERVER_PARAMETER_PREFIX + NSString* prefixedKey = [@BREAKPAD_SERVER_PARAMETER_PREFIX stringByAppendingString:key]; breakpad->SetKeyValue(prefixedKey, value); } @@ -928,15 +928,15 @@ void BreakpadAddUploadParameter(BreakpadRef ref, } void BreakpadRemoveUploadParameter(BreakpadRef ref, - NSString *key) { + NSString* key) { try { // Not called at exception time - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad && key && gKeyValueAllocator) { ProtectedMemoryLocker locker(&gDictionaryMutex, gKeyValueAllocator); - NSString *prefixedKey = [NSString stringWithFormat:@"%@%@", + NSString* prefixedKey = [NSString stringWithFormat:@"%@%@", @BREAKPAD_SERVER_PARAMETER_PREFIX, key]; breakpad->RemoveKeyValue(prefixedKey); } @@ -945,12 +945,12 @@ void BreakpadRemoveUploadParameter(BreakpadRef ref, } } //============================================================================= -NSString *BreakpadKeyValue(BreakpadRef ref, NSString *key) { - NSString *value = nil; +NSString* BreakpadKeyValue(BreakpadRef ref, NSString* key) { + NSString* value = nil; try { // Not called at exception time - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (!breakpad || !key || !gKeyValueAllocator) return nil; @@ -966,10 +966,10 @@ NSString *BreakpadKeyValue(BreakpadRef ref, NSString *key) { } //============================================================================= -void BreakpadRemoveKeyValue(BreakpadRef ref, NSString *key) { +void BreakpadRemoveKeyValue(BreakpadRef ref, NSString* key) { try { // Not called at exception time - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad && key && gKeyValueAllocator) { ProtectedMemoryLocker locker(&gDictionaryMutex, gKeyValueAllocator); @@ -984,7 +984,7 @@ void BreakpadRemoveKeyValue(BreakpadRef ref, NSString *key) { //============================================================================= void BreakpadGenerateAndSendReport(BreakpadRef ref) { try { - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad && gKeyValueAllocator) { ProtectedMemoryLocker locker(&gDictionaryMutex, gKeyValueAllocator); @@ -1001,10 +1001,10 @@ void BreakpadGenerateAndSendReport(BreakpadRef ref) { //============================================================================= void BreakpadSetFilterCallback(BreakpadRef ref, BreakpadFilterCallback callback, - void *context) { + void* context) { try { - Breakpad *breakpad = (Breakpad *)ref; + Breakpad* breakpad = (Breakpad*)ref; if (breakpad && gBreakpadAllocator) { // share the dictionary mutex here (we really don't need a mutex) @@ -1018,14 +1018,14 @@ void BreakpadSetFilterCallback(BreakpadRef ref, } //============================================================================ -void BreakpadAddLogFile(BreakpadRef ref, NSString *logPathname) { +void BreakpadAddLogFile(BreakpadRef ref, NSString* logPathname) { int logFileCounter = 0; - NSString *logFileKey = [NSString stringWithFormat:@"%@%d", + NSString* logFileKey = [NSString stringWithFormat:@"%@%d", @BREAKPAD_LOGFILE_KEY_PREFIX, logFileCounter]; - NSString *existingLogFilename = nil; + NSString* existingLogFilename = nil; existingLogFilename = BreakpadKeyValue(ref, logFileKey); // Find the first log file key that we can use by testing for existence while (existingLogFilename) { diff --git a/src/client/mac/Framework/OnDemandServer.h b/src/client/mac/Framework/OnDemandServer.h index d4db5d3a..be0d2b79 100644 --- a/src/client/mac/Framework/OnDemandServer.h +++ b/src/client/mac/Framework/OnDemandServer.h @@ -41,7 +41,7 @@ // Example Usage : // // kern_return_t result; -// OnDemandServer *server = OnDemandServer::Create("/tmp/myserver", +// OnDemandServer* server = OnDemandServer::Create("/tmp/myserver", // "com.MyCompany.MyServiceName", // true, // &result); @@ -88,8 +88,8 @@ class OnDemandServer { } // Creates the bootstrap server and service - kern_return_t Initialize(const char *server_command, - const char *service_name, + kern_return_t Initialize(const char* server_command, + const char* service_name, bool unregister_on_cleanup); // Returns an OnDemandServer object if successful, or NULL if there's @@ -110,10 +110,10 @@ class OnDemandServer { // out_result : if non-NULL, returns the result // this value will be KERN_SUCCESS if Create() returns non-NULL // - static OnDemandServer *Create(const char *server_command, - const char *service_name, + static OnDemandServer* Create(const char *server_command, + const char* service_name, bool unregister_on_cleanup, - kern_return_t *out_result); + kern_return_t* out_result); // Cleans up and if LaunchOnDemand() has not yet been called then // the bootstrap service will be unregistered. diff --git a/src/client/mac/Framework/OnDemandServer.mm b/src/client/mac/Framework/OnDemandServer.mm index a2ffa434..b6b59ca5 100644 --- a/src/client/mac/Framework/OnDemandServer.mm +++ b/src/client/mac/Framework/OnDemandServer.mm @@ -49,11 +49,11 @@ #endif //============================================================================== -OnDemandServer *OnDemandServer::Create(const char *server_command, - const char *service_name, +OnDemandServer* OnDemandServer::Create(const char* server_command, + const char* service_name, bool unregister_on_cleanup, - kern_return_t *out_result) { - OnDemandServer *server = new OnDemandServer(); + kern_return_t* out_result) { + OnDemandServer* server = new OnDemandServer(); if (!server) return NULL; @@ -74,8 +74,8 @@ OnDemandServer *OnDemandServer::Create(const char *server_command, } //============================================================================== -kern_return_t OnDemandServer::Initialize(const char *server_command, - const char *service_name, +kern_return_t OnDemandServer::Initialize(const char* server_command, + const char* service_name, bool unregister_on_cleanup) { unregister_on_cleanup_ = unregister_on_cleanup; diff --git a/src/client/mac/crash_generation/ConfigFile.h b/src/client/mac/crash_generation/ConfigFile.h index f2da7c24..11bc2e43 100644 --- a/src/client/mac/crash_generation/ConfigFile.h +++ b/src/client/mac/crash_generation/ConfigFile.h @@ -35,7 +35,7 @@ namespace google_breakpad { -BOOL EnsureDirectoryPathExists(NSString *dirPath); +BOOL EnsureDirectoryPathExists(NSString* dirPath); //============================================================================= class ConfigFile { @@ -50,11 +50,11 @@ class ConfigFile { } void WriteFile(const char* directory, - const SimpleStringDictionary *configurationParameters, - const char *dump_dir, - const char *minidump_id); + const SimpleStringDictionary* configurationParameters, + const char* dump_dir, + const char* minidump_id); - const char *GetFilePath() { return config_file_path_; } + const char* GetFilePath() { return config_file_path_; } void Unlink() { if (config_file_ != -1) @@ -64,16 +64,16 @@ class ConfigFile { } private: - BOOL WriteData(const void *data, size_t length); + BOOL WriteData(const void* data, size_t length); - BOOL AppendConfigData(const char *key, - const void *data, + BOOL AppendConfigData(const char* key, + const void* data, size_t length); - BOOL AppendConfigString(const char *key, - const char *value); + BOOL AppendConfigString(const char* key, + const char* value); - BOOL AppendCrashTimeParameters(const char *processStartTimeString); + BOOL AppendCrashTimeParameters(const char* processStartTimeString); int config_file_; // descriptor for config file char config_file_path_[PATH_MAX]; // Path to configuration file diff --git a/src/client/mac/crash_generation/ConfigFile.mm b/src/client/mac/crash_generation/ConfigFile.mm index acab7de8..57d07590 100644 --- a/src/client/mac/crash_generation/ConfigFile.mm +++ b/src/client/mac/crash_generation/ConfigFile.mm @@ -42,10 +42,10 @@ namespace google_breakpad { //============================================================================= -BOOL EnsureDirectoryPathExists(NSString *dirPath) { - NSFileManager *mgr = [NSFileManager defaultManager]; +BOOL EnsureDirectoryPathExists(NSString* dirPath) { + NSFileManager* mgr = [NSFileManager defaultManager]; - NSDictionary *attrs = + NSDictionary* attrs = [NSDictionary dictionaryWithObject:[NSNumber numberWithUnsignedLong:0750] forKey:NSFilePosixPermissions]; @@ -56,15 +56,15 @@ BOOL EnsureDirectoryPathExists(NSString *dirPath) { } //============================================================================= -BOOL ConfigFile::WriteData(const void *data, size_t length) { +BOOL ConfigFile::WriteData(const void* data, size_t length) { size_t result = write(config_file_, data, length); return result == length; } //============================================================================= -BOOL ConfigFile::AppendConfigData(const char *key, - const void *data, size_t length) { +BOOL ConfigFile::AppendConfigData(const char* key, + const void* data, size_t length) { assert(config_file_ != -1); if (!key) { @@ -88,13 +88,13 @@ BOOL ConfigFile::AppendConfigData(const char *key, } //============================================================================= -BOOL ConfigFile::AppendConfigString(const char *key, - const char *value) { +BOOL ConfigFile::AppendConfigString(const char* key, + const char* value) { return AppendConfigData(key, value, strlen(value)); } //============================================================================= -BOOL ConfigFile::AppendCrashTimeParameters(const char *processStartTimeString) { +BOOL ConfigFile::AppendCrashTimeParameters(const char* processStartTimeString) { // Set process uptime parameter struct timeval tv; gettimeofday(&tv, NULL); @@ -118,9 +118,9 @@ BOOL ConfigFile::AppendCrashTimeParameters(const char *processStartTimeString) { //============================================================================= void ConfigFile::WriteFile(const char* directory, - const SimpleStringDictionary *configurationParameters, - const char *dump_dir, - const char *minidump_id) { + const SimpleStringDictionary* configurationParameters, + const char* dump_dir, + const char* minidump_id) { assert(config_file_ == -1); @@ -146,9 +146,9 @@ void ConfigFile::WriteFile(const char* directory, // Write out the configuration parameters BOOL result = YES; - const SimpleStringDictionary &dictionary = *configurationParameters; + const SimpleStringDictionary& dictionary = *configurationParameters; - const SimpleStringDictionary::Entry *entry = NULL; + const SimpleStringDictionary::Entry* entry = NULL; SimpleStringDictionary::Iterator iter(dictionary); while ((entry = iter.Next())) { diff --git a/src/client/mac/crash_generation/Inspector.h b/src/client/mac/crash_generation/Inspector.h index 7f923ed6..c9671136 100644 --- a/src/client/mac/crash_generation/Inspector.h +++ b/src/client/mac/crash_generation/Inspector.h @@ -63,7 +63,7 @@ struct KeyValueMessageData { public: KeyValueMessageData() {} explicit KeyValueMessageData( - const google_breakpad::SimpleStringDictionary::Entry &inEntry) { + const google_breakpad::SimpleStringDictionary::Entry& inEntry) { strlcpy(key, inEntry.key, sizeof(key) ); strlcpy(value, inEntry.value, sizeof(value) ); } @@ -80,7 +80,7 @@ namespace google_breakpad { //============================================================================= class MinidumpLocation { public: - MinidumpLocation(NSString *minidumpDir) { + MinidumpLocation(NSString* minidumpDir) { // Ensure that the path exists. Fallback to /tmp if unable to locate path. assert(minidumpDir); if (!EnsureDirectoryPathExists(minidumpDir)) { @@ -100,8 +100,8 @@ class MinidumpLocation { strlcpy(minidump_id_, next_minidump_id.c_str(), sizeof(minidump_id_)); } - const char *GetPath() { return minidump_dir_path_; } - const char *GetID() { return minidump_id_; } + const char* GetPath() { return minidump_dir_path_; } + const char* GetID() { return minidump_id_; } private: char minidump_dir_path_[PATH_MAX]; // Path to minidump directory @@ -116,7 +116,7 @@ class Inspector { // given a bootstrap service name, receives mach messages // from a crashed process, then inspects it, creates a minidump file // and asks the user if he wants to upload it to a server. - void Inspect(const char *receive_port_name); + void Inspect(const char* receive_port_name); private: // The Inspector is invoked with its bootstrap port set to the bootstrap @@ -131,8 +131,8 @@ class Inspector { // ServiceCheckOut. kern_return_t ResetBootstrapPort(); - kern_return_t ServiceCheckIn(const char *receive_port_name); - kern_return_t ServiceCheckOut(const char *receive_port_name); + kern_return_t ServiceCheckIn(const char* receive_port_name); + kern_return_t ServiceCheckOut(const char* receive_port_name); kern_return_t ReadMessages(); diff --git a/src/client/mac/crash_generation/Inspector.mm b/src/client/mac/crash_generation/Inspector.mm index dc6f4808..d5fc29e0 100644 --- a/src/client/mac/crash_generation/Inspector.mm +++ b/src/client/mac/crash_generation/Inspector.mm @@ -52,7 +52,7 @@ namespace google_breakpad { //============================================================================= -void Inspector::Inspect(const char *receive_port_name) { +void Inspector::Inspect(const char* receive_port_name) { kern_return_t result = ResetBootstrapPort(); if (result != KERN_SUCCESS) { return; @@ -143,7 +143,7 @@ kern_return_t Inspector::ResetBootstrapPort() { } //============================================================================= -kern_return_t Inspector::ServiceCheckIn(const char *receive_port_name) { +kern_return_t Inspector::ServiceCheckIn(const char* receive_port_name) { // We need to get the mach port representing this service, so we can // get information from the crashed process. kern_return_t kr = bootstrap_check_in(bootstrap_subset_port_, @@ -160,7 +160,7 @@ kern_return_t Inspector::ServiceCheckIn(const char *receive_port_name) { } //============================================================================= -kern_return_t Inspector::ServiceCheckOut(const char *receive_port_name) { +kern_return_t Inspector::ServiceCheckOut(const char* receive_port_name) { // We're done receiving mach messages from the crashed process, // so clean up a bit. kern_return_t kr; @@ -198,7 +198,7 @@ kern_return_t Inspector::ReadMessages() { kern_return_t result = receive_port.WaitForMessage(&message, 1000); if (result == KERN_SUCCESS) { - InspectorInfo &info = (InspectorInfo &)*message.GetData(); + InspectorInfo& info = (InspectorInfo&)*message.GetData(); exception_type_ = info.exception_type; exception_code_ = info.exception_code; exception_subcode_ = info.exception_subcode; @@ -237,7 +237,7 @@ kern_return_t Inspector::ReadMessages() { result = receive_port.WaitForMessage(¶meter_message, 1000); if(result == KERN_SUCCESS) { - KeyValueMessageData &key_value_data = + KeyValueMessageData& key_value_data = (KeyValueMessageData&)*parameter_message.GetData(); // If we get a blank key, make sure we don't increment the // parameter count; in some cases (notably on-demand generation @@ -267,27 +267,27 @@ bool Inspector::InspectTask() { // keep the task quiet while we're looking at it task_suspend(remote_task_); - NSString *minidumpDir; + NSString* minidumpDir; - const char *minidumpDirectory = + const char* minidumpDirectory = config_params_.GetValueForKey(BREAKPAD_DUMP_DIRECTORY); // If the client app has not specified a minidump directory, // use a default of Library// if (!minidumpDirectory || 0 == strlen(minidumpDirectory)) { - NSArray *libraryDirectories = + NSArray* libraryDirectories = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); - NSString *applicationSupportDirectory = + NSString* applicationSupportDirectory = [libraryDirectories objectAtIndex:0]; - NSString *library_subdirectory = [NSString + NSString* library_subdirectory = [NSString stringWithUTF8String:kDefaultLibrarySubdirectory]; - NSString *breakpad_product = [NSString + NSString* breakpad_product = [NSString stringWithUTF8String:config_params_.GetValueForKey(BREAKPAD_PRODUCT)]; - NSArray *path_components = [NSArray + NSArray* path_components = [NSArray arrayWithObjects:applicationSupportDirectory, library_subdirectory, breakpad_product, @@ -306,11 +306,11 @@ bool Inspector::InspectTask() { // assumes system encoding and in RTL locales will prepend an LTR override // character for paths beginning with '/' which fileSystemRepresentation does // not remove. Filed as rdar://6889706 . - NSString *path_ns = [NSString + NSString* path_ns = [NSString stringWithUTF8String:minidumpLocation.GetPath()]; - NSString *pathid_ns = [NSString + NSString* pathid_ns = [NSString stringWithUTF8String:minidumpLocation.GetID()]; - NSString *minidumpPath = [path_ns stringByAppendingPathComponent:pathid_ns]; + NSString* minidumpPath = [path_ns stringByAppendingPathComponent:pathid_ns]; minidumpPath = [minidumpPath stringByAppendingPathExtension:@"dmp"]; diff --git a/src/client/mac/crash_generation/crash_generation_server.cc b/src/client/mac/crash_generation/crash_generation_server.cc index 451e8d9c..ae44e8bf 100644 --- a/src/client/mac/crash_generation/crash_generation_server.cc +++ b/src/client/mac/crash_generation/crash_generation_server.cc @@ -38,15 +38,15 @@ namespace google_breakpad { CrashGenerationServer::CrashGenerationServer( - const char *mach_port_name, + const char* mach_port_name, FilterCallback filter, - void *filter_context, + void* filter_context, OnClientDumpRequestCallback dump_callback, - void *dump_context, + void* dump_context, OnClientExitingCallback exit_callback, - void *exit_context, + void* exit_context, bool generate_dumps, - const std::string &dump_path) + const std::string& dump_path) : filter_(filter), filter_context_(filter_context), dump_callback_(dump_callback), @@ -90,8 +90,8 @@ bool CrashGenerationServer::Stop() { } // static -void *CrashGenerationServer::WaitForMessages(void *server) { - CrashGenerationServer *self = +void* CrashGenerationServer::WaitForMessages(void* server) { + CrashGenerationServer* self = reinterpret_cast(server); while (self->WaitForOneMessage()) {} return NULL; @@ -104,7 +104,7 @@ bool CrashGenerationServer::WaitForOneMessage() { if (result == KERN_SUCCESS) { switch (message.GetMessageID()) { case kDumpRequestMessage: { - ExceptionInfo &info = (ExceptionInfo &)*message.GetData(); + ExceptionInfo& info = (ExceptionInfo&)*message.GetData(); mach_port_t remote_task = message.GetTranslatedPort(0); mach_port_t crashing_thread = message.GetTranslatedPort(1); diff --git a/src/client/mac/crash_generation/crash_generation_server.h b/src/client/mac/crash_generation/crash_generation_server.h index 85bd5b5e..82fef146 100644 --- a/src/client/mac/crash_generation/crash_generation_server.h +++ b/src/client/mac/crash_generation/crash_generation_server.h @@ -59,14 +59,14 @@ class CrashGenerationServer { // WARNING: callbacks may be invoked on a different thread // than that which creates the CrashGenerationServer. They must // be thread safe. - typedef void (*OnClientDumpRequestCallback)(void *context, - const ClientInfo &client_info, - const std::string &file_path); + typedef void (*OnClientDumpRequestCallback)(void* context, + const ClientInfo& client_info, + const std::string& file_path); - typedef void (*OnClientExitingCallback)(void *context, - const ClientInfo &client_info); + typedef void (*OnClientExitingCallback)(void* context, + const ClientInfo& client_info); // If a FilterCallback returns false, the dump will not be written. - typedef bool (*FilterCallback)(void *context); + typedef bool (*FilterCallback)(void* context); // Create an instance with the given parameters. // @@ -83,15 +83,15 @@ class CrashGenerationServer { // passed for this parameter. // dump_path: Path for generating dumps; required only if true is // passed for generateDumps parameter; NULL can be passed otherwise. - CrashGenerationServer(const char *mach_port_name, + CrashGenerationServer(const char* mach_port_name, FilterCallback filter, - void *filter_context, + void* filter_context, OnClientDumpRequestCallback dump_callback, - void *dump_context, + void* dump_context, OnClientExitingCallback exit_callback, - void *exit_context, + void* exit_context, bool generate_dumps, - const std::string &dump_path); + const std::string& dump_path); ~CrashGenerationServer(); @@ -105,24 +105,24 @@ class CrashGenerationServer { private: // Return a unique filename at which a minidump can be written. - bool MakeMinidumpFilename(std::string &outFilename); + bool MakeMinidumpFilename(std::string& outFilename); // Loop reading client messages and responding to them until // a quit message is received. - static void *WaitForMessages(void *server); + static void* WaitForMessages(void* server); // Wait for a single client message and respond to it. Returns false // if a quit message was received or if an error occurred. bool WaitForOneMessage(); FilterCallback filter_; - void *filter_context_; + void* filter_context_; OnClientDumpRequestCallback dump_callback_; - void *dump_context_; + void* dump_context_; OnClientExitingCallback exit_callback_; - void *exit_context_; + void* exit_context_; bool generate_dumps_; diff --git a/src/client/mac/handler/breakpad_nlist_64.cc b/src/client/mac/handler/breakpad_nlist_64.cc index 3492b823..b4f04c91 100644 --- a/src/client/mac/handler/breakpad_nlist_64.cc +++ b/src/client/mac/handler/breakpad_nlist_64.cc @@ -131,7 +131,7 @@ struct MachBits { template int -__breakpad_fdnlist(int fd, nlist_type *list, const char **symbolNames, +__breakpad_fdnlist(int fd, nlist_type* list, const char** symbolNames, cpu_type_t cpu_type); /* @@ -139,9 +139,9 @@ __breakpad_fdnlist(int fd, nlist_type *list, const char **symbolNames, */ template -int breakpad_nlist_common(const char *name, - nlist_type *list, - const char **symbolNames, +int breakpad_nlist_common(const char* name, + nlist_type* list, + const char** symbolNames, cpu_type_t cpu_type) { int fd = open(name, O_RDONLY, 0); if (fd < 0) @@ -151,16 +151,16 @@ int breakpad_nlist_common(const char *name, return n; } -int breakpad_nlist(const char *name, - struct nlist *list, - const char **symbolNames, +int breakpad_nlist(const char* name, + struct nlist* list, + const char** symbolNames, cpu_type_t cpu_type) { return breakpad_nlist_common(name, list, symbolNames, cpu_type); } -int breakpad_nlist(const char *name, - struct nlist_64 *list, - const char **symbolNames, +int breakpad_nlist(const char* name, + struct nlist_64* list, + const char** symbolNames, cpu_type_t cpu_type) { return breakpad_nlist_common(name, list, symbolNames, cpu_type); } @@ -168,7 +168,7 @@ int breakpad_nlist(const char *name, /* Note: __fdnlist() is called from kvm_nlist in libkvm's kvm.c */ template -int __breakpad_fdnlist(int fd, nlist_type *list, const char **symbolNames, +int __breakpad_fdnlist(int fd, nlist_type* list, const char** symbolNames, cpu_type_t cpu_type) { typedef typename MachBits::mach_header_type mach_header_type; typedef typename MachBits::word_type word_type; @@ -189,9 +189,9 @@ int __breakpad_fdnlist(int fd, nlist_type *list, const char **symbolNames, } struct exec buf; - if (read(fd, (char *)&buf, sizeof(buf)) != sizeof(buf) || - (N_BADMAG(buf) && *((uint32_t *)&buf) != magic && - CFSwapInt32BigToHost(*((uint32_t *)&buf)) != FAT_MAGIC && + if (read(fd, (char*)&buf, sizeof(buf)) != sizeof(buf) || + (N_BADMAG(buf) && *((uint32_t*)&buf) != magic && + CFSwapInt32BigToHost(*((uint32_t*)&buf)) != FAT_MAGIC && /* The following is the big-endian ppc64 check */ (*((uint32_t*)&buf)) != FAT_MAGIC)) { return -1; @@ -199,15 +199,15 @@ int __breakpad_fdnlist(int fd, nlist_type *list, const char **symbolNames, /* Deal with fat file if necessary */ unsigned arch_offset = 0; - if (CFSwapInt32BigToHost(*((uint32_t *)&buf)) == FAT_MAGIC || + if (CFSwapInt32BigToHost(*((uint32_t*)&buf)) == FAT_MAGIC || /* The following is the big-endian ppc64 check */ - *((unsigned int *)&buf) == FAT_MAGIC) { + *((unsigned int*)&buf) == FAT_MAGIC) { /* Read in the fat header */ struct fat_header fh; if (lseek(fd, 0, SEEK_SET) == -1) { return -1; } - if (read(fd, (char *)&fh, sizeof(fh)) != sizeof(fh)) { + if (read(fd, (char*)&fh, sizeof(fh)) != sizeof(fh)) { return -1; } @@ -215,12 +215,12 @@ int __breakpad_fdnlist(int fd, nlist_type *list, const char **symbolNames, fh.nfat_arch = CFSwapInt32BigToHost(fh.nfat_arch); /* Read in the fat archs */ - struct fat_arch *fat_archs = - (struct fat_arch *)malloc(fh.nfat_arch * sizeof(struct fat_arch)); + struct fat_arch* fat_archs = + (struct fat_arch*)malloc(fh.nfat_arch * sizeof(struct fat_arch)); if (fat_archs == NULL) { return -1; } - if (read(fd, (char *)fat_archs, + if (read(fd, (char*)fat_archs, sizeof(struct fat_arch) * fh.nfat_arch) != (ssize_t)(sizeof(struct fat_arch) * fh.nfat_arch)) { free(fat_archs); @@ -244,7 +244,7 @@ int __breakpad_fdnlist(int fd, nlist_type *list, const char **symbolNames, CFSwapInt32BigToHost(fat_archs[i].align); } - struct fat_arch *fap = NULL; + struct fat_arch* fap = NULL; for (unsigned i = 0; i < fh.nfat_arch; i++) { if (fat_archs[i].cputype == cpu_type) { fap = &fat_archs[i]; @@ -263,7 +263,7 @@ int __breakpad_fdnlist(int fd, nlist_type *list, const char **symbolNames, if (lseek(fd, arch_offset, SEEK_SET) == -1) { return -1; } - if (read(fd, (char *)&buf, sizeof(buf)) != sizeof(buf)) { + if (read(fd, (char*)&buf, sizeof(buf)) != sizeof(buf)) { return -1; } } @@ -271,48 +271,45 @@ int __breakpad_fdnlist(int fd, nlist_type *list, const char **symbolNames, off_t sa; /* symbol address */ off_t ss; /* start of strings */ register_t n; - if (*((unsigned int *)&buf) == magic) { + if (*((unsigned int*)&buf) == magic) { if (lseek(fd, arch_offset, SEEK_SET) == -1) { return -1; } mach_header_type mh; - if (read(fd, (char *)&mh, sizeof(mh)) != sizeof(mh)) { + if (read(fd, (char*)&mh, sizeof(mh)) != sizeof(mh)) { return -1; } - struct load_command *load_commands = - (struct load_command *)malloc(mh.sizeofcmds); + struct load_command* load_commands = + (struct load_command*)malloc(mh.sizeofcmds); if (load_commands == NULL) { return -1; } - if (read(fd, (char *)load_commands, mh.sizeofcmds) != + if (read(fd, (char*)load_commands, mh.sizeofcmds) != (ssize_t)mh.sizeofcmds) { free(load_commands); return -1; } - struct symtab_command *stp = NULL; - struct load_command *lcp = load_commands; + struct symtab_command* stp = NULL; + struct load_command* lcp = load_commands; // iterate through all load commands, looking for // LC_SYMTAB load command for (uint32_t i = 0; i < mh.ncmds; i++) { if (lcp->cmdsize % sizeof(word_type) != 0 || lcp->cmdsize <= 0 || - (char *)lcp + lcp->cmdsize > - (char *)load_commands + mh.sizeofcmds) { + (char*)lcp + lcp->cmdsize > (char*)load_commands + mh.sizeofcmds) { free(load_commands); return -1; } if (lcp->cmd == LC_SYMTAB) { - if (lcp->cmdsize != - sizeof(struct symtab_command)) { + if (lcp->cmdsize != sizeof(struct symtab_command)) { free(load_commands); return -1; } - stp = (struct symtab_command *)lcp; + stp = (struct symtab_command*)lcp; break; } - lcp = (struct load_command *) - ((char *)lcp + lcp->cmdsize); + lcp = (struct load_command*)((char*)lcp + lcp->cmdsize); } if (stp == NULL) { free(load_commands); @@ -347,7 +344,7 @@ int __breakpad_fdnlist(int fd, nlist_type *list, const char **symbolNames, if (n < m) m = n; - if (read(fd, (char *)space, m) != m) + if (read(fd, (char*)space, m) != m) break; n -= m; off_t savpos = lseek(fd, 0, SEEK_CUR); @@ -368,13 +365,13 @@ int __breakpad_fdnlist(int fd, nlist_type *list, const char **symbolNames, if (read(fd, nambuf, maxlen+1) == -1) { return -1; } - const char *s2 = nambuf; - for (nlist_type *p = list; + const char* s2 = nambuf; + for (nlist_type* p = list; symbolNames[p-list] && symbolNames[p-list][0]; p++) { // get the symbol name the user has passed in that // corresponds to the nlist entry that we're looking at - const char *s1 = symbolNames[p - list]; + const char* s1 = symbolNames[p - list]; while (*s1) { if (*s1++ != *s2++) goto cont; diff --git a/src/client/mac/handler/breakpad_nlist_64.h b/src/client/mac/handler/breakpad_nlist_64.h index e8e2e083..a1a3e83c 100644 --- a/src/client/mac/handler/breakpad_nlist_64.h +++ b/src/client/mac/handler/breakpad_nlist_64.h @@ -36,13 +36,13 @@ #include -int breakpad_nlist(const char *name, - struct nlist *list, - const char **symbolNames, +int breakpad_nlist(const char* name, + struct nlist* list, + const char** symbolNames, cpu_type_t cpu_type); -int breakpad_nlist(const char *name, - struct nlist_64 *list, - const char **symbolNames, +int breakpad_nlist(const char* name, + struct nlist_64* list, + const char** symbolNames, cpu_type_t cpu_type); #endif /* CLIENT_MAC_HANDLER_BREAKPAD_NLIST_H__ */ diff --git a/src/client/mac/handler/dynamic_images.cc b/src/client/mac/handler/dynamic_images.cc index cdba6df4..b78c2087 100644 --- a/src/client/mac/handler/dynamic_images.cc +++ b/src/client/mac/handler/dynamic_images.cc @@ -66,7 +66,7 @@ struct task_dyld_info { mach_vm_size_t all_image_info_size; }; typedef struct task_dyld_info task_dyld_info_data_t; -typedef struct task_dyld_info *task_dyld_info_t; +typedef struct task_dyld_info* task_dyld_info_t; #define TASK_DYLD_INFO_COUNT (sizeof(task_dyld_info_data_t) / sizeof(natural_t)) #endif @@ -88,7 +88,7 @@ using std::vector; // static mach_vm_size_t GetMemoryRegionSize(task_port_t target_task, const uint64_t address, - mach_vm_size_t *size_to_end) { + mach_vm_size_t* size_to_end) { mach_vm_address_t region_base = (mach_vm_address_t)address; mach_vm_size_t region_size; natural_t nesting_level = 0; @@ -182,7 +182,7 @@ static string ReadTaskString(task_port_t target_task, kern_return_t ReadTaskMemory(task_port_t target_task, const uint64_t address, size_t length, - vector &bytes) { + vector& bytes) { int systemPageSize = getpagesize(); // use the negative of the page size for the mask to find the page address @@ -250,16 +250,16 @@ bool FindTextSection(DynamicImage& image) { return false; } - const struct load_command *cmd = - reinterpret_cast(header + 1); + const struct load_command* cmd = + reinterpret_cast(header + 1); bool found_text_section = false; bool found_dylib_id_command = false; for (unsigned int i = 0; cmd && (i < header->ncmds); ++i) { if (!found_text_section) { if (cmd->cmd == MachBits::segment_load_command) { - const mach_segment_command_type *seg = - reinterpret_cast(cmd); + const mach_segment_command_type* seg = + reinterpret_cast(cmd); if (!strcmp(seg->segname, "__TEXT")) { image.vmaddr_ = static_cast(seg->vmaddr); @@ -277,8 +277,8 @@ bool FindTextSection(DynamicImage& image) { if (!found_dylib_id_command) { if (cmd->cmd == LC_ID_DYLIB) { - const struct dylib_command *dc = - reinterpret_cast(cmd); + const struct dylib_command* dc = + reinterpret_cast(cmd); image.version_ = dc->dylib.current_version; found_dylib_id_command = true; @@ -289,8 +289,8 @@ bool FindTextSection(DynamicImage& image) { return true; } - cmd = reinterpret_cast - (reinterpret_cast(cmd) + cmd->cmdsize); + cmd = reinterpret_cast + (reinterpret_cast(cmd) + cmd->cmdsize); } return false; @@ -349,8 +349,8 @@ static uint64_t LookupSymbol(const char* symbol_name, typedef typename MachBits::nlist_type nlist_type; nlist_type symbol_info[8] = {}; - const char *symbolNames[2] = { symbol_name, "\0" }; - nlist_type &list = symbol_info[0]; + const char* symbolNames[2] = { symbol_name, "\0" }; + nlist_type& list = symbol_info[0]; int invalidEntriesCount = breakpad_nlist(filename, &list, symbolNames, @@ -396,8 +396,8 @@ uint64_t DynamicImages::GetDyldAllImageInfosPointer() { return (uint64_t)task_dyld_info.all_image_info_addr; } else { - const char *imageSymbolName = "_dyld_all_image_infos"; - const char *dyldPath = "/usr/lib/dyld"; + const char* imageSymbolName = "_dyld_all_image_infos"; + const char* dyldPath = "/usr/lib/dyld"; if (Is64Bit()) return LookupSymbol(imageSymbolName, dyldPath, cpu_type_); @@ -428,7 +428,7 @@ void ReadImageInfo(DynamicImages& images, dyld_all_info_bytes) != KERN_SUCCESS) return; - dyld_all_image_infos *dyldInfo = + dyld_all_image_infos* dyldInfo = reinterpret_cast(&dyld_all_info_bytes[0]); // number of loaded images @@ -443,12 +443,12 @@ void ReadImageInfo(DynamicImages& images, dyld_info_array_bytes) != KERN_SUCCESS) return; - dyld_image_info *infoArray = + dyld_image_info* infoArray = reinterpret_cast(&dyld_info_array_bytes[0]); images.image_list_.reserve(count); for (int i = 0; i < count; ++i) { - dyld_image_info &info = infoArray[i]; + dyld_image_info& info = infoArray[i]; // First read just the mach_header from the image in the task. vector mach_header_bytes; @@ -458,7 +458,7 @@ void ReadImageInfo(DynamicImages& images, mach_header_bytes) != KERN_SUCCESS) continue; // bail on this dynamic image - mach_header_type *header = + mach_header_type* header = reinterpret_cast(&mach_header_bytes[0]); // Now determine the total amount necessary to read the header @@ -482,7 +482,7 @@ void ReadImageInfo(DynamicImages& images, } // Create an object representing this image and add it to our list. - DynamicImage *new_image; + DynamicImage* new_image; new_image = new DynamicImage(&mach_header_bytes[0], header_size, info.load_address_, @@ -522,7 +522,7 @@ void DynamicImages::ReadImageInfoForTask() { } //============================================================================== -DynamicImage *DynamicImages::GetExecutableImage() { +DynamicImage* DynamicImages::GetExecutableImage() { int executable_index = GetExecutableImageIndex(); if (executable_index >= 0) { @@ -538,7 +538,7 @@ int DynamicImages::GetExecutableImageIndex() { int image_count = GetImageCount(); for (int i = 0; i < image_count; ++i) { - DynamicImage *image = GetImage(i); + DynamicImage* image = GetImage(i); if (image->GetFileType() == MH_EXECUTE) { return i; } diff --git a/src/client/mac/handler/dynamic_images.h b/src/client/mac/handler/dynamic_images.h index 65147900..e81ea7f3 100644 --- a/src/client/mac/handler/dynamic_images.h +++ b/src/client/mac/handler/dynamic_images.h @@ -108,7 +108,7 @@ uint32_t GetFileTypeFromHeader(DynamicImage& image); // Represents a single dynamically loaded mach-o image class DynamicImage { public: - DynamicImage(uint8_t *header, // data is copied + DynamicImage(uint8_t* header, // data is copied size_t header_size, // includes load commands uint64_t load_address, string file_path, @@ -163,7 +163,7 @@ class DynamicImage { uint32_t GetVersion() {return version_;} // For sorting - bool operator<(const DynamicImage &inInfo) { + bool operator<(const DynamicImage& inInfo) { return GetLoadAddress() < inInfo.GetLoadAddress(); } @@ -171,8 +171,8 @@ class DynamicImage { bool IsValid() {return GetVMSize() != 0;} private: - DynamicImage(const DynamicImage &); - DynamicImage &operator=(const DynamicImage &); + DynamicImage(const DynamicImage&); + DynamicImage& operator=(const DynamicImage&); friend class DynamicImages; template @@ -205,26 +205,26 @@ class DynamicImage { // class DynamicImageRef { public: - explicit DynamicImageRef(DynamicImage *inP) : p(inP) {} + explicit DynamicImageRef(DynamicImage* inP) : p(inP) {} // The copy constructor is required by STL - DynamicImageRef(const DynamicImageRef &inRef) : p(inRef.p) {} + DynamicImageRef(const DynamicImageRef& inRef) : p(inRef.p) {} - bool operator<(const DynamicImageRef &inRef) const { + bool operator<(const DynamicImageRef& inRef) const { return (*const_cast(this)->p) < (*const_cast(inRef).p); } - bool operator==(const DynamicImageRef &inInfo) const { + bool operator==(const DynamicImageRef& inInfo) const { return (*const_cast(this)->p).GetLoadAddress() == (*const_cast(inInfo)).GetLoadAddress(); } // Be just like DynamicImage* - DynamicImage *operator->() {return p;} + DynamicImage* operator->() {return p;} operator DynamicImage*() {return p;} private: - DynamicImage *p; + DynamicImage* p; }; // Helper function to deal with 32-bit/64-bit Mach-O differences. @@ -250,7 +250,7 @@ class DynamicImages { int GetImageCount() const {return static_cast(image_list_.size());} // Returns an individual image. - DynamicImage *GetImage(int i) { + DynamicImage* GetImage(int i) { if (i < (int)image_list_.size()) { return image_list_[i]; } @@ -258,7 +258,7 @@ class DynamicImages { } // Returns the image corresponding to the main executable. - DynamicImage *GetExecutableImage(); + DynamicImage* GetExecutableImage(); int GetExecutableImageIndex(); // Returns the task which we're looking at. @@ -312,7 +312,7 @@ class DynamicImages { kern_return_t ReadTaskMemory(task_port_t target_task, const uint64_t address, size_t length, - vector &bytes); + vector& bytes); } // namespace google_breakpad diff --git a/src/client/mac/handler/exception_handler.cc b/src/client/mac/handler/exception_handler.cc index 2a19d46a..287fe1be 100644 --- a/src/client/mac/handler/exception_handler.cc +++ b/src/client/mac/handler/exception_handler.cc @@ -220,7 +220,7 @@ kern_return_t catch_exception_raise(mach_port_t port, mach_port_t failed_thread, } #endif -ExceptionHandler::ExceptionHandler(const string &dump_path, +ExceptionHandler::ExceptionHandler(const string& dump_path, FilterCallback filter, MinidumpCallback callback, void* callback_context, @@ -304,7 +304,7 @@ bool ExceptionHandler::WriteMinidump(bool write_exception_stream) { } // static -bool ExceptionHandler::WriteMinidump(const string &dump_path, +bool ExceptionHandler::WriteMinidump(const string& dump_path, bool write_exception_stream, MinidumpCallback callback, void* callback_context) { @@ -316,7 +316,7 @@ bool ExceptionHandler::WriteMinidump(const string &dump_path, // static bool ExceptionHandler::WriteMinidumpForChild(mach_port_t child, mach_port_t child_blamed_thread, - const string &dump_path, + const string& dump_path, MinidumpCallback callback, void* callback_context) { ScopedTaskSuspend suspend(child); diff --git a/src/client/mac/handler/exception_handler.h b/src/client/mac/handler/exception_handler.h index f1d9ae92..fe7491fd 100644 --- a/src/client/mac/handler/exception_handler.h +++ b/src/client/mac/handler/exception_handler.h @@ -75,7 +75,7 @@ class ExceptionHandler { // attempting to write a minidump. If a FilterCallback returns false, Breakpad // will immediately report the exception as unhandled without writing a // minidump, allowing another handler the opportunity to handle it. - typedef bool (*FilterCallback)(void *context); + typedef bool (*FilterCallback)(void* context); // A callback function to run after the minidump has been written. // |minidump_id| is a unique id for the dump, so the minidump @@ -85,18 +85,18 @@ class ExceptionHandler { // Return true if the exception was fully handled and breakpad should exit. // Return false to allow any other exception handlers to process the // exception. - typedef bool (*MinidumpCallback)(const char *dump_dir, - const char *minidump_id, - void *context, bool succeeded); + typedef bool (*MinidumpCallback)(const char* dump_dir, + const char* minidump_id, + void* context, bool succeeded); // A callback function which will be called directly if an exception occurs. // This bypasses the minidump file writing and simply gives the client // the exception information. - typedef bool (*DirectCallback)( void *context, - int exception_type, - int exception_code, - int exception_subcode, - mach_port_t thread_name); + typedef bool (*DirectCallback)(void* context, + int exception_type, + int exception_code, + int exception_subcode, + mach_port_t thread_name); // Creates a new ExceptionHandler instance to handle writing minidumps. // Minidump files will be written to dump_path, and the optional callback @@ -106,22 +106,22 @@ class ExceptionHandler { // be written when WriteMinidump is called. // If port_name is non-NULL, attempt to perform out-of-process dump generation // If port_name is NULL, in-process dump generation will be used. - ExceptionHandler(const string &dump_path, + ExceptionHandler(const string& dump_path, FilterCallback filter, MinidumpCallback callback, - void *callback_context, bool install_handler, - const char *port_name); + void* callback_context, bool install_handler, + const char* port_name); // A special constructor if we want to bypass minidump writing and // simply get a callback with the exception information. ExceptionHandler(DirectCallback callback, - void *callback_context, + void* callback_context, bool install_handler); ~ExceptionHandler(); // Get and set the minidump path. string dump_path() const { return dump_path_; } - void set_dump_path(const string &dump_path) { + void set_dump_path(const string& dump_path) { dump_path_ = dump_path; dump_path_c_ = dump_path_.c_str(); UpdateNextID(); // Necessary to put dump_path_ in next_minidump_path_. @@ -137,23 +137,23 @@ class ExceptionHandler { // Convenience form of WriteMinidump which does not require an // ExceptionHandler instance. - static bool WriteMinidump(const string &dump_path, MinidumpCallback callback, - void *callback_context) { + static bool WriteMinidump(const string& dump_path, MinidumpCallback callback, + void* callback_context) { return WriteMinidump(dump_path, false, callback, callback_context); } - static bool WriteMinidump(const string &dump_path, + static bool WriteMinidump(const string& dump_path, bool write_exception_stream, MinidumpCallback callback, - void *callback_context); + void* callback_context); // Write a minidump of child immediately. This can be used to capture // the execution state of a child process independently of a crash. static bool WriteMinidumpForChild(mach_port_t child, - mach_port_t child_blamed_thread, - const std::string &dump_path, - MinidumpCallback callback, - void *callback_context); + mach_port_t child_blamed_thread, + const std::string& dump_path, + MinidumpCallback callback, + void* callback_context); // Returns whether out-of-process dump generation is used or not. bool IsOutOfProcess() const { @@ -189,21 +189,21 @@ class ExceptionHandler { bool WriteMinidumpWithException(int exception_type, int exception_code, int exception_subcode, - breakpad_ucontext_t *task_context, + breakpad_ucontext_t* task_context, mach_port_t thread_name, bool exit_after_write, bool report_current_thread); // When installed, this static function will be call from a newly created // pthread with |this| as the argument - static void *WaitForMessage(void *exception_handler_class); + static void* WaitForMessage(void* exception_handler_class); // Signal handler for SIGABRT. static void SignalHandler(int sig, siginfo_t* info, void* uc); // disallow copy ctor and operator= - explicit ExceptionHandler(const ExceptionHandler &); - void operator=(const ExceptionHandler &); + explicit ExceptionHandler(const ExceptionHandler&); + void operator=(const ExceptionHandler&); // Generates a new ID and stores it in next_minidump_id_, and stores the // path of the next minidump to be written in next_minidump_path_. @@ -224,15 +224,15 @@ class ExceptionHandler { string next_minidump_path_; // Pointers to the UTF-8 versions of above - const char *dump_path_c_; - const char *next_minidump_id_c_; - const char *next_minidump_path_c_; + const char* dump_path_c_; + const char* next_minidump_id_c_; + const char* next_minidump_path_c_; // The callback function and pointer to be passed back after the minidump // has been written FilterCallback filter_; MinidumpCallback callback_; - void *callback_context_; + void* callback_context_; // The callback function to be passed back when we don't want a minidump // file to be written @@ -247,7 +247,7 @@ class ExceptionHandler { // These variables save the previous exception handler's data so that it // can be re-installed when this handler is uninstalled - ExceptionParameters *previous_; + ExceptionParameters* previous_; // True, if we've installed the exception handler bool installed_exception_handler_; diff --git a/src/client/mac/handler/minidump_generator.cc b/src/client/mac/handler/minidump_generator.cc index 50df9002..e0351c4b 100644 --- a/src/client/mac/handler/minidump_generator.cc +++ b/src/client/mac/handler/minidump_generator.cc @@ -191,12 +191,12 @@ void MinidumpGenerator::GatherSystemInformation() { os_build_number_ = IntegerValueAtIndex(product_str, 2); } -void MinidumpGenerator::SetTaskContext(breakpad_ucontext_t *task_context) { +void MinidumpGenerator::SetTaskContext(breakpad_ucontext_t* task_context) { task_context_ = task_context; } -string MinidumpGenerator::UniqueNameInDirectory(const string &dir, - string *unique_name) { +string MinidumpGenerator::UniqueNameInDirectory(const string& dir, + string* unique_name) { CFUUIDRef uuid = CFUUIDCreate(NULL); CFStringRef uuid_cfstr = CFUUIDCreateString(NULL, uuid); CFRelease(uuid); @@ -220,7 +220,7 @@ string MinidumpGenerator::UniqueNameInDirectory(const string &dir, return path; } -bool MinidumpGenerator::Write(const char *path) { +bool MinidumpGenerator::Write(const char* path) { WriteStreamFN writers[] = { &MinidumpGenerator::WriteThreadListStream, &MinidumpGenerator::WriteMemoryListStream, @@ -256,10 +256,10 @@ bool MinidumpGenerator::Write(const char *path) { if (!dir.AllocateArray(writer_count)) return false; - MDRawHeader *header_ptr = header.get(); + MDRawHeader* header_ptr = header.get(); header_ptr->signature = MD_HEADER_SIGNATURE; header_ptr->version = MD_HEADER_VERSION; - time(reinterpret_cast(&(header_ptr->time_date_stamp))); + time(reinterpret_cast(&(header_ptr->time_date_stamp))); header_ptr->stream_count = writer_count; header_ptr->stream_directory_rva = dir.position(); @@ -335,7 +335,7 @@ size_t MinidumpGenerator::CalculateStackSize(mach_vm_address_t start_addr) { bool MinidumpGenerator::WriteStackFromStartAddress( mach_vm_address_t start_addr, - MDMemoryDescriptor *stack_location) { + MDMemoryDescriptor* stack_location) { UntypedMDRVA memory(&writer_); bool result = false; @@ -372,7 +372,7 @@ bool MinidumpGenerator::WriteStackFromStartAddress( result = memory.Copy(&stack_memory[0], size); } else { - result = memory.Copy(reinterpret_cast(start_addr), size); + result = memory.Copy(reinterpret_cast(start_addr), size); } } @@ -383,7 +383,7 @@ bool MinidumpGenerator::WriteStackFromStartAddress( } bool MinidumpGenerator::WriteStack(breakpad_thread_state_data_t state, - MDMemoryDescriptor *stack_location) { + MDMemoryDescriptor* stack_location) { switch (cpu_type_) { #ifdef HAS_ARM_SUPPORT case CPU_TYPE_ARM: @@ -411,7 +411,7 @@ bool MinidumpGenerator::WriteStack(breakpad_thread_state_data_t state, } bool MinidumpGenerator::WriteContext(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location) { + MDLocationDescriptor* register_location) { switch (cpu_type_) { #ifdef HAS_ARM_SUPPORT case CPU_TYPE_ARM: @@ -469,33 +469,33 @@ uint64_t MinidumpGenerator::CurrentPCForStack( #ifdef HAS_ARM_SUPPORT bool MinidumpGenerator::WriteStackARM(breakpad_thread_state_data_t state, - MDMemoryDescriptor *stack_location) { - arm_thread_state_t *machine_state = - reinterpret_cast(state); + MDMemoryDescriptor* stack_location) { + arm_thread_state_t* machine_state = + reinterpret_cast(state); mach_vm_address_t start_addr = REGISTER_FROM_THREADSTATE(machine_state, sp); return WriteStackFromStartAddress(start_addr, stack_location); } uint64_t MinidumpGenerator::CurrentPCForStackARM(breakpad_thread_state_data_t state) { - arm_thread_state_t *machine_state = - reinterpret_cast(state); + arm_thread_state_t* machine_state = + reinterpret_cast(state); return REGISTER_FROM_THREADSTATE(machine_state, pc); } bool MinidumpGenerator::WriteContextARM(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location) + MDLocationDescriptor* register_location) { TypedMDRVA context(&writer_); - arm_thread_state_t *machine_state = - reinterpret_cast(state); + arm_thread_state_t* machine_state = + reinterpret_cast(state); if (!context.Allocate()) return false; *register_location = context.location(); - MDRawContextARM *context_ptr = context.get(); + MDRawContextARM* context_ptr = context.get(); context_ptr->context_flags = MD_CONTEXT_ARM_FULL; #define AddGPR(a) context_ptr->iregs[a] = REGISTER_FROM_THREADSTATE(machine_state, r[a]) @@ -526,34 +526,34 @@ bool MinidumpGenerator::WriteContextARM(breakpad_thread_state_data_t state, #ifdef HAS_ARM64_SUPPORT bool MinidumpGenerator::WriteStackARM64(breakpad_thread_state_data_t state, - MDMemoryDescriptor *stack_location) { - arm_thread_state64_t *machine_state = - reinterpret_cast(state); + MDMemoryDescriptor* stack_location) { + arm_thread_state64_t* machine_state = + reinterpret_cast(state); mach_vm_address_t start_addr = REGISTER_FROM_THREADSTATE(machine_state, sp); return WriteStackFromStartAddress(start_addr, stack_location); } uint64_t MinidumpGenerator::CurrentPCForStackARM64(breakpad_thread_state_data_t state) { - arm_thread_state64_t *machine_state = - reinterpret_cast(state); + arm_thread_state64_t* machine_state = + reinterpret_cast(state); return REGISTER_FROM_THREADSTATE(machine_state, pc); } bool MinidumpGenerator::WriteContextARM64(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location) + MDLocationDescriptor* register_location) { TypedMDRVA context(&writer_); - arm_thread_state64_t *machine_state = - reinterpret_cast(state); + arm_thread_state64_t* machine_state = + reinterpret_cast(state); if (!context.Allocate()) return false; *register_location = context.location(); - MDRawContextARM64_Old *context_ptr = context.get(); + MDRawContextARM64_Old* context_ptr = context.get(); context_ptr->context_flags = MD_CONTEXT_ARM64_FULL_OLD; #define AddGPR(a) \ @@ -602,49 +602,49 @@ MinidumpGenerator::WriteContextARM64(breakpad_thread_state_data_t state, #ifdef HAS_PCC_SUPPORT bool MinidumpGenerator::WriteStackPPC(breakpad_thread_state_data_t state, - MDMemoryDescriptor *stack_location) { - ppc_thread_state_t *machine_state = - reinterpret_cast(state); + MDMemoryDescriptor* stack_location) { + ppc_thread_state_t* machine_state = + reinterpret_cast(state); mach_vm_address_t start_addr = REGISTER_FROM_THREADSTATE(machine_state, r1); return WriteStackFromStartAddress(start_addr, stack_location); } bool MinidumpGenerator::WriteStackPPC64(breakpad_thread_state_data_t state, - MDMemoryDescriptor *stack_location) { - ppc_thread_state64_t *machine_state = - reinterpret_cast(state); + MDMemoryDescriptor* stack_location) { + ppc_thread_state64_t* machine_state = + reinterpret_cast(state); mach_vm_address_t start_addr = REGISTER_FROM_THREADSTATE(machine_state, r1); return WriteStackFromStartAddress(start_addr, stack_location); } uint64_t MinidumpGenerator::CurrentPCForStackPPC(breakpad_thread_state_data_t state) { - ppc_thread_state_t *machine_state = - reinterpret_cast(state); + ppc_thread_state_t* machine_state = + reinterpret_cast(state); return REGISTER_FROM_THREADSTATE(machine_state, srr0); } uint64_t MinidumpGenerator::CurrentPCForStackPPC64(breakpad_thread_state_data_t state) { - ppc_thread_state64_t *machine_state = - reinterpret_cast(state); + ppc_thread_state64_t* machine_state = + reinterpret_cast(state); return REGISTER_FROM_THREADSTATE(machine_state, srr0); } bool MinidumpGenerator::WriteContextPPC(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location) + MDLocationDescriptor* register_location) { TypedMDRVA context(&writer_); - ppc_thread_state_t *machine_state = - reinterpret_cast(state); + ppc_thread_state_t* machine_state = + reinterpret_cast(state); if (!context.Allocate()) return false; *register_location = context.location(); - MDRawContextPPC *context_ptr = context.get(); + MDRawContextPPC* context_ptr = context.get(); context_ptr->context_flags = MD_CONTEXT_PPC_BASE; #define AddReg(a) context_ptr->a = static_cast<__typeof__(context_ptr->a)>( \ @@ -701,16 +701,16 @@ bool MinidumpGenerator::WriteContextPPC(breakpad_thread_state_data_t state, bool MinidumpGenerator::WriteContextPPC64( breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location) { + MDLocationDescriptor* register_location) { TypedMDRVA context(&writer_); - ppc_thread_state64_t *machine_state = - reinterpret_cast(state); + ppc_thread_state64_t* machine_state = + reinterpret_cast(state); if (!context.Allocate()) return false; *register_location = context.location(); - MDRawContextPPC64 *context_ptr = context.get(); + MDRawContextPPC64* context_ptr = context.get(); context_ptr->context_flags = MD_CONTEXT_PPC_BASE; #define AddReg(a) context_ptr->a = static_cast<__typeof__(context_ptr->a)>( \ @@ -768,18 +768,18 @@ bool MinidumpGenerator::WriteContextPPC64( #ifdef HAS_X86_SUPPORT bool MinidumpGenerator::WriteStackX86(breakpad_thread_state_data_t state, - MDMemoryDescriptor *stack_location) { - i386_thread_state_t *machine_state = - reinterpret_cast(state); + MDMemoryDescriptor* stack_location) { + i386_thread_state_t* machine_state = + reinterpret_cast(state); mach_vm_address_t start_addr = REGISTER_FROM_THREADSTATE(machine_state, esp); return WriteStackFromStartAddress(start_addr, stack_location); } bool MinidumpGenerator::WriteStackX86_64(breakpad_thread_state_data_t state, - MDMemoryDescriptor *stack_location) { - x86_thread_state64_t *machine_state = - reinterpret_cast(state); + MDMemoryDescriptor* stack_location) { + x86_thread_state64_t* machine_state = + reinterpret_cast(state); mach_vm_address_t start_addr = static_cast( REGISTER_FROM_THREADSTATE(machine_state, rsp)); @@ -788,32 +788,32 @@ bool MinidumpGenerator::WriteStackX86_64(breakpad_thread_state_data_t state, uint64_t MinidumpGenerator::CurrentPCForStackX86(breakpad_thread_state_data_t state) { - i386_thread_state_t *machine_state = - reinterpret_cast(state); + i386_thread_state_t* machine_state = + reinterpret_cast(state); return REGISTER_FROM_THREADSTATE(machine_state, eip); } uint64_t MinidumpGenerator::CurrentPCForStackX86_64(breakpad_thread_state_data_t state) { - x86_thread_state64_t *machine_state = - reinterpret_cast(state); + x86_thread_state64_t* machine_state = + reinterpret_cast(state); return REGISTER_FROM_THREADSTATE(machine_state, rip); } bool MinidumpGenerator::WriteContextX86(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location) + MDLocationDescriptor* register_location) { TypedMDRVA context(&writer_); - i386_thread_state_t *machine_state = - reinterpret_cast(state); + i386_thread_state_t* machine_state = + reinterpret_cast(state); if (!context.Allocate()) return false; *register_location = context.location(); - MDRawContextX86 *context_ptr = context.get(); + MDRawContextX86* context_ptr = context.get(); #define AddReg(a) context_ptr->a = static_cast<__typeof__(context_ptr->a)>( \ REGISTER_FROM_THREADSTATE(machine_state, a)) @@ -844,16 +844,16 @@ bool MinidumpGenerator::WriteContextX86(breakpad_thread_state_data_t state, bool MinidumpGenerator::WriteContextX86_64( breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location) { + MDLocationDescriptor* register_location) { TypedMDRVA context(&writer_); - x86_thread_state64_t *machine_state = - reinterpret_cast(state); + x86_thread_state64_t* machine_state = + reinterpret_cast(state); if (!context.Allocate()) return false; *register_location = context.location(); - MDRawContextAMD64 *context_ptr = context.get(); + MDRawContextAMD64* context_ptr = context.get(); #define AddReg(a) context_ptr->a = static_cast<__typeof__(context_ptr->a)>( \ REGISTER_FROM_THREADSTATE(machine_state, a)) @@ -892,7 +892,7 @@ bool MinidumpGenerator::WriteContextX86_64( bool MinidumpGenerator::GetThreadState(thread_act_t target_thread, thread_state_t state, - mach_msg_type_number_t *count) { + mach_msg_type_number_t* count) { if (task_context_ && target_thread == mach_thread_self()) { switch (cpu_type_) { #ifdef HAS_ARM_SUPPORT @@ -963,7 +963,7 @@ bool MinidumpGenerator::GetThreadState(thread_act_t target_thread, } bool MinidumpGenerator::WriteThreadStream(mach_port_t thread_id, - MDRawThread *thread) { + MDRawThread* thread) { breakpad_thread_state_data_t state; mach_msg_type_number_t state_count = static_cast(sizeof(state)); @@ -986,7 +986,7 @@ bool MinidumpGenerator::WriteThreadStream(mach_port_t thread_id, } bool MinidumpGenerator::WriteThreadListStream( - MDRawDirectory *thread_list_stream) { + MDRawDirectory* thread_list_stream) { TypedMDRVA list(&writer_); thread_act_port_array_t threads_for_task; mach_msg_type_number_t thread_count; @@ -1027,7 +1027,7 @@ bool MinidumpGenerator::WriteThreadListStream( } bool MinidumpGenerator::WriteMemoryListStream( - MDRawDirectory *memory_list_stream) { + MDRawDirectory* memory_list_stream) { TypedMDRVA list(&writer_); // If the dump has an exception, include some memory around the @@ -1119,7 +1119,7 @@ bool MinidumpGenerator::WriteMemoryListStream( } else { // In-process, just copy from local memory. ip_memory.Copy( - reinterpret_cast(ip_memory_d.start_of_memory_range), + reinterpret_cast(ip_memory_d.start_of_memory_range), ip_memory_d.memory.data_size); } @@ -1133,7 +1133,7 @@ bool MinidumpGenerator::WriteMemoryListStream( } bool -MinidumpGenerator::WriteExceptionStream(MDRawDirectory *exception_stream) { +MinidumpGenerator::WriteExceptionStream(MDRawDirectory* exception_stream) { TypedMDRVA exception(&writer_); if (!exception.Allocate()) @@ -1141,7 +1141,7 @@ MinidumpGenerator::WriteExceptionStream(MDRawDirectory *exception_stream) { exception_stream->stream_type = MD_EXCEPTION_STREAM; exception_stream->location = exception.location(); - MDRawExceptionStream *exception_ptr = exception.get(); + MDRawExceptionStream* exception_ptr = exception.get(); exception_ptr->thread_id = exception_thread_; // This naming is confusing, but it is the proper translation from @@ -1168,7 +1168,7 @@ MinidumpGenerator::WriteExceptionStream(MDRawDirectory *exception_stream) { } bool MinidumpGenerator::WriteSystemInfoStream( - MDRawDirectory *system_info_stream) { + MDRawDirectory* system_info_stream) { TypedMDRVA info(&writer_); if (!info.Allocate()) @@ -1181,7 +1181,7 @@ bool MinidumpGenerator::WriteSystemInfoStream( uint32_t number_of_processors; size_t len = sizeof(number_of_processors); sysctlbyname("hw.ncpu", &number_of_processors, &len, NULL, 0); - MDRawSystemInfo *info_ptr = info.get(); + MDRawSystemInfo* info_ptr = info.get(); switch (cpu_type_) { #ifdef HAS_ARM_SUPPORT @@ -1292,10 +1292,10 @@ bool MinidumpGenerator::WriteSystemInfoStream( } bool MinidumpGenerator::WriteModuleStream(unsigned int index, - MDRawModule *module) { + MDRawModule* module) { if (dynamic_images_) { // we're in a different process than the crashed process - DynamicImage *image = dynamic_images_->GetImage(index); + DynamicImage* image = dynamic_images_->GetImage(index); if (!image) return false; @@ -1337,7 +1337,7 @@ bool MinidumpGenerator::WriteModuleStream(unsigned int index, } } else { // Getting module info in the crashed process - const breakpad_mach_header *header; + const breakpad_mach_header* header; header = (breakpad_mach_header*)_dyld_get_image_header(index); if (!header) return false; @@ -1357,16 +1357,16 @@ bool MinidumpGenerator::WriteModuleStream(unsigned int index, int cpu_type = header->cputype; unsigned long slide = _dyld_get_image_vmaddr_slide(index); const char* name = _dyld_get_image_name(index); - const struct load_command *cmd = - reinterpret_cast(header + 1); + const struct load_command* cmd = + reinterpret_cast(header + 1); memset(module, 0, sizeof(MDRawModule)); for (unsigned int i = 0; cmd && (i < header->ncmds); i++) { if (cmd->cmd == LC_SEGMENT_ARCH) { - const breakpad_mach_segment_command *seg = - reinterpret_cast(cmd); + const breakpad_mach_segment_command* seg = + reinterpret_cast(cmd); if (!strcmp(seg->segname, "__TEXT")) { MDLocationDescriptor string_location; @@ -1389,7 +1389,7 @@ bool MinidumpGenerator::WriteModuleStream(unsigned int index, } } - cmd = reinterpret_cast((char *)cmd + cmd->cmdsize); + cmd = reinterpret_cast((char*)cmd + cmd->cmdsize); } } @@ -1405,7 +1405,7 @@ int MinidumpGenerator::FindExecutableModule() { } } else { int image_count = _dyld_image_count(); - const struct mach_header *header; + const struct mach_header* header; for (int index = 0; index < image_count; ++index) { header = _dyld_get_image_header(index); @@ -1419,12 +1419,12 @@ int MinidumpGenerator::FindExecutableModule() { return 0; } -bool MinidumpGenerator::WriteCVRecord(MDRawModule *module, int cpu_type, - const char *module_path, bool in_memory) { +bool MinidumpGenerator::WriteCVRecord(MDRawModule* module, int cpu_type, + const char* module_path, bool in_memory) { TypedMDRVA cv(&writer_); // Only return the last path component of the full module path - const char *module_name = strrchr(module_path, '/'); + const char* module_name = strrchr(module_path, '/'); // Increment past the slash if (module_name) @@ -1441,7 +1441,7 @@ bool MinidumpGenerator::WriteCVRecord(MDRawModule *module, int cpu_type, return false; module->cv_record = cv.location(); - MDCVInfoPDB70 *cv_ptr = cv.get(); + MDCVInfoPDB70* cv_ptr = cv.get(); cv_ptr->cv_signature = MD_CVINFOPDB70_SIGNATURE; cv_ptr->age = 0; @@ -1450,7 +1450,7 @@ bool MinidumpGenerator::WriteCVRecord(MDRawModule *module, int cpu_type, bool result = false; if (in_memory) { MacFileUtilities::MachoID macho(module_path, - reinterpret_cast(module->base_of_image), + reinterpret_cast(module->base_of_image), static_cast(module->size_of_image)); result = macho.UUIDCommand(cpu_type, CPU_SUBTYPE_MULTIPLE, identifier); if (!result) @@ -1487,7 +1487,7 @@ bool MinidumpGenerator::WriteCVRecord(MDRawModule *module, int cpu_type, } bool MinidumpGenerator::WriteModuleListStream( - MDRawDirectory *module_list_stream) { + MDRawDirectory* module_list_stream) { TypedMDRVA list(&writer_); uint32_t image_count = dynamic_images_ ? @@ -1525,7 +1525,7 @@ bool MinidumpGenerator::WriteModuleListStream( return true; } -bool MinidumpGenerator::WriteMiscInfoStream(MDRawDirectory *misc_info_stream) { +bool MinidumpGenerator::WriteMiscInfoStream(MDRawDirectory* misc_info_stream) { TypedMDRVA info(&writer_); if (!info.Allocate()) @@ -1534,7 +1534,7 @@ bool MinidumpGenerator::WriteMiscInfoStream(MDRawDirectory *misc_info_stream) { misc_info_stream->stream_type = MD_MISC_INFO_STREAM; misc_info_stream->location = info.location(); - MDRawMiscInfo *info_ptr = info.get(); + MDRawMiscInfo* info_ptr = info.get(); info_ptr->size_of_info = static_cast(sizeof(MDRawMiscInfo)); info_ptr->flags1 = MD_MISCINFO_FLAGS1_PROCESS_ID | MD_MISCINFO_FLAGS1_PROCESS_TIMES | @@ -1577,7 +1577,7 @@ bool MinidumpGenerator::WriteMiscInfoStream(MDRawDirectory *misc_info_stream) { } bool MinidumpGenerator::WriteBreakpadInfoStream( - MDRawDirectory *breakpad_info_stream) { + MDRawDirectory* breakpad_info_stream) { TypedMDRVA info(&writer_); if (!info.Allocate()) @@ -1585,7 +1585,7 @@ bool MinidumpGenerator::WriteBreakpadInfoStream( breakpad_info_stream->stream_type = MD_BREAKPAD_INFO_STREAM; breakpad_info_stream->location = info.location(); - MDRawBreakpadInfo *info_ptr = info.get(); + MDRawBreakpadInfo* info_ptr = info.get(); if (exception_thread_ && exception_type_) { info_ptr->validity = MD_BREAKPAD_INFO_VALID_DUMP_THREAD_ID | diff --git a/src/client/mac/handler/minidump_generator.h b/src/client/mac/handler/minidump_generator.h index f3aa9bd3..e3a271b0 100644 --- a/src/client/mac/handler/minidump_generator.h +++ b/src/client/mac/handler/minidump_generator.h @@ -106,12 +106,12 @@ class MinidumpGenerator { // Return /.dmp // Sets |unique_name| (if requested) to the unique name for the minidump - static string UniqueNameInDirectory(const string &dir, string *unique_name); + static string UniqueNameInDirectory(const string& dir, string* unique_name); // Write out the minidump into |path| // All of the components of |path| must exist and be writable // Return true if successful, false otherwise - bool Write(const char *path); + bool Write(const char* path); // Specify some exception information, if applicable void SetExceptionInformation(int type, int code, int subcode, @@ -125,7 +125,7 @@ class MinidumpGenerator { // Specify the task context. If |task_context| is not NULL, it will be used // to retrieve the context of the current thread, instead of using // |thread_get_state|. - void SetTaskContext(breakpad_ucontext_t *task_context); + void SetTaskContext(breakpad_ucontext_t* task_context); // Gather system information. This should be call at least once before using // the MinidumpGenerator class. @@ -133,81 +133,81 @@ class MinidumpGenerator { protected: // Overridable Stream writers - virtual bool WriteExceptionStream(MDRawDirectory *exception_stream); + virtual bool WriteExceptionStream(MDRawDirectory* exception_stream); // Overridable Helper - virtual bool WriteThreadStream(mach_port_t thread_id, MDRawThread *thread); + virtual bool WriteThreadStream(mach_port_t thread_id, MDRawThread* thread); private: - typedef bool (MinidumpGenerator::*WriteStreamFN)(MDRawDirectory *); + typedef bool (MinidumpGenerator::*WriteStreamFN)(MDRawDirectory*); // Stream writers - bool WriteThreadListStream(MDRawDirectory *thread_list_stream); - bool WriteMemoryListStream(MDRawDirectory *memory_list_stream); - bool WriteSystemInfoStream(MDRawDirectory *system_info_stream); - bool WriteModuleListStream(MDRawDirectory *module_list_stream); - bool WriteMiscInfoStream(MDRawDirectory *misc_info_stream); - bool WriteBreakpadInfoStream(MDRawDirectory *breakpad_info_stream); + bool WriteThreadListStream(MDRawDirectory* thread_list_stream); + bool WriteMemoryListStream(MDRawDirectory* memory_list_stream); + bool WriteSystemInfoStream(MDRawDirectory* system_info_stream); + bool WriteModuleListStream(MDRawDirectory* module_list_stream); + bool WriteMiscInfoStream(MDRawDirectory* misc_info_stream); + bool WriteBreakpadInfoStream(MDRawDirectory* breakpad_info_stream); // Helpers uint64_t CurrentPCForStack(breakpad_thread_state_data_t state); bool GetThreadState(thread_act_t target_thread, thread_state_t state, - mach_msg_type_number_t *count); + mach_msg_type_number_t* count); bool WriteStackFromStartAddress(mach_vm_address_t start_addr, - MDMemoryDescriptor *stack_location); + MDMemoryDescriptor* stack_location); bool WriteStack(breakpad_thread_state_data_t state, - MDMemoryDescriptor *stack_location); + MDMemoryDescriptor* stack_location); bool WriteContext(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location); - bool WriteCVRecord(MDRawModule *module, int cpu_type, - const char *module_path, bool in_memory); - bool WriteModuleStream(unsigned int index, MDRawModule *module); + MDLocationDescriptor* register_location); + bool WriteCVRecord(MDRawModule* module, int cpu_type, + const char* module_path, bool in_memory); + bool WriteModuleStream(unsigned int index, MDRawModule* module); size_t CalculateStackSize(mach_vm_address_t start_addr); int FindExecutableModule(); // Per-CPU implementations of these methods #ifdef HAS_ARM_SUPPORT bool WriteStackARM(breakpad_thread_state_data_t state, - MDMemoryDescriptor *stack_location); + MDMemoryDescriptor* stack_location); bool WriteContextARM(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location); + MDLocationDescriptor* register_location); uint64_t CurrentPCForStackARM(breakpad_thread_state_data_t state); #endif #ifdef HAS_ARM64_SUPPORT bool WriteStackARM64(breakpad_thread_state_data_t state, - MDMemoryDescriptor *stack_location); + MDMemoryDescriptor* stack_location); bool WriteContextARM64(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location); + MDLocationDescriptor* register_location); uint64_t CurrentPCForStackARM64(breakpad_thread_state_data_t state); #endif #ifdef HAS_PPC_SUPPORT bool WriteStackPPC(breakpad_thread_state_data_t state, - MDMemoryDescriptor *stack_location); + MDMemoryDescriptor* stack_location); bool WriteContextPPC(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location); + MDLocationDescriptor* register_location); uint64_t CurrentPCForStackPPC(breakpad_thread_state_data_t state); bool WriteStackPPC64(breakpad_thread_state_data_t state, - MDMemoryDescriptor *stack_location); + MDMemoryDescriptor* stack_location); bool WriteContextPPC64(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location); + MDLocationDescriptor* register_location); uint64_t CurrentPCForStackPPC64(breakpad_thread_state_data_t state); #endif #ifdef HAS_X86_SUPPORT bool WriteStackX86(breakpad_thread_state_data_t state, - MDMemoryDescriptor *stack_location); + MDMemoryDescriptor* stack_location); bool WriteContextX86(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location); + MDLocationDescriptor* register_location); uint64_t CurrentPCForStackX86(breakpad_thread_state_data_t state); bool WriteStackX86_64(breakpad_thread_state_data_t state, - MDMemoryDescriptor *stack_location); + MDMemoryDescriptor* stack_location); bool WriteContextX86_64(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location); + MDLocationDescriptor* register_location); uint64_t CurrentPCForStackX86_64(breakpad_thread_state_data_t state); #endif // disallow copy ctor and operator= - explicit MinidumpGenerator(const MinidumpGenerator &); - void operator=(const MinidumpGenerator &); + explicit MinidumpGenerator(const MinidumpGenerator&); + void operator=(const MinidumpGenerator&); protected: // Use this writer to put the data to disk @@ -232,10 +232,10 @@ class MinidumpGenerator { static int os_build_number_; // Context of the task to dump. - breakpad_ucontext_t *task_context_; + breakpad_ucontext_t* task_context_; // Information about dynamically loaded code - DynamicImages *dynamic_images_; + DynamicImages* dynamic_images_; // PageAllocator makes it possible to allocate memory // directly from the system, even while handling an exception. diff --git a/src/client/mac/handler/testcases/DynamicImagesTests.cc b/src/client/mac/handler/testcases/DynamicImagesTests.cc index 0fc7825b..0a80e434 100644 --- a/src/client/mac/handler/testcases/DynamicImagesTests.cc +++ b/src/client/mac/handler/testcases/DynamicImagesTests.cc @@ -42,7 +42,7 @@ DynamicImagesTests test2(TEST_INVOCATION(DynamicImagesTests, DynamicImagesTests test3(TEST_INVOCATION(DynamicImagesTests, ReadLibrariesFromLocalTaskTest)); -DynamicImagesTests::DynamicImagesTests(TestInvocation *invocation) +DynamicImagesTests::DynamicImagesTests(TestInvocation* invocation) : TestCase(invocation) { } @@ -54,7 +54,7 @@ void DynamicImagesTests::ReadTaskMemoryTest() { // pick test2 as a symbol we know to be valid to read // anything will work, really - void *addr = reinterpret_cast(&test2); + void* addr = reinterpret_cast(&test2); std::vector buf(getpagesize()); fprintf(stderr, "reading 0x%p\n", addr); @@ -71,7 +71,7 @@ void DynamicImagesTests::ReadTaskMemoryTest() { void DynamicImagesTests::ReadLibrariesFromLocalTaskTest() { mach_port_t me = mach_task_self(); - google_breakpad::DynamicImages *d = new google_breakpad::DynamicImages(me); + google_breakpad::DynamicImages* d = new google_breakpad::DynamicImages(me); fprintf(stderr,"Local task image count: %d\n", d->GetImageCount()); diff --git a/src/client/mac/handler/testcases/breakpad_nlist_test.cc b/src/client/mac/handler/testcases/breakpad_nlist_test.cc index e7332bfb..2014b907 100644 --- a/src/client/mac/handler/testcases/breakpad_nlist_test.cc +++ b/src/client/mac/handler/testcases/breakpad_nlist_test.cc @@ -40,7 +40,7 @@ BreakpadNlistTest test1(TEST_INVOCATION(BreakpadNlistTest, CompareToNM)); -BreakpadNlistTest::BreakpadNlistTest(TestInvocation *invocation) +BreakpadNlistTest::BreakpadNlistTest(TestInvocation* invocation) : TestCase(invocation) { } @@ -55,7 +55,7 @@ void BreakpadNlistTest::CompareToNM() { system("/usr/bin/nm -arch ppc64 /usr/lib/dyld > /tmp/dyld-namelist.txt"); #endif - FILE *fd = fopen("/tmp/dyld-namelist.txt", "rt"); + FILE* fd = fopen("/tmp/dyld-namelist.txt", "rt"); char oneNMAddr[30]; char symbolType; @@ -63,10 +63,10 @@ void BreakpadNlistTest::CompareToNM() { while (!feof(fd)) { fscanf(fd, "%s %c %s", oneNMAddr, &symbolType, symbolName); breakpad_nlist symbolList[2]; - breakpad_nlist &list = symbolList[0]; + breakpad_nlist& list = symbolList[0]; memset(symbolList, 0, sizeof(breakpad_nlist)*2); - const char *symbolNames[2]; + const char* symbolNames[2]; symbolNames[0] = (const char*)symbolName; symbolNames[1] = "\0"; breakpad_nlist_64("/usr/lib/dyld", &list, symbolNames); @@ -79,12 +79,12 @@ void BreakpadNlistTest::CompareToNM() { fclose(fd); } -bool BreakpadNlistTest::IsSymbolMoreThanOnceInDyld(const char *symbolName) { +bool BreakpadNlistTest::IsSymbolMoreThanOnceInDyld(const char* symbolName) { // These are the symbols that occur more than once when nm dumps // the symbol table of /usr/lib/dyld. Our nlist program returns // the first address because it's doing a search so we need to exclude // these from causing the test to fail - const char *multipleSymbols[] = { + const char* multipleSymbols[] = { "__Z41__static_initialization_and_destruction_0ii", "___tcf_0", "___tcf_1", diff --git a/src/client/mac/handler/testcases/breakpad_nlist_test.h b/src/client/mac/handler/testcases/breakpad_nlist_test.h index e93657cc..ee8010c7 100644 --- a/src/client/mac/handler/testcases/breakpad_nlist_test.h +++ b/src/client/mac/handler/testcases/breakpad_nlist_test.h @@ -47,7 +47,7 @@ class BreakpadNlistTest : public TestCase { // /usr/lib/dyld. So we track those so we don't report failures // in mismatches between what our nlist returns and what nm has // for the duplicate symbols. - bool IsSymbolMoreThanOnceInDyld(const char *symbolName); + bool IsSymbolMoreThanOnceInDyld(const char* symbolName); public: explicit BreakpadNlistTest(TestInvocation* invocation); diff --git a/src/client/mac/testapp/main.m b/src/client/mac/testapp/main.m index 1ed19bf9..de673326 100644 --- a/src/client/mac/testapp/main.m +++ b/src/client/mac/testapp/main.m @@ -30,5 +30,5 @@ #import int main(int argc, char *argv[]) { - return NSApplicationMain(argc, (const char **) argv); + return NSApplicationMain(argc, (const char**)argv); } diff --git a/src/client/mac/tests/crash_generation_server_test.cc b/src/client/mac/tests/crash_generation_server_test.cc index 0164f4a2..128f25c1 100644 --- a/src/client/mac/tests/crash_generation_server_test.cc +++ b/src/client/mac/tests/crash_generation_server_test.cc @@ -147,8 +147,8 @@ TEST_F(CrashGenerationServerTest, testRequestDumpNoDump) { globfree(&dirContents); } -void dumpCallback(void *context, const ClientInfo &client_info, - const std::string &file_path) { +void dumpCallback(void* context, const ClientInfo& client_info, + const std::string& file_path) { if (context) { CrashGenerationServerTest* self = reinterpret_cast(context); @@ -158,7 +158,7 @@ void dumpCallback(void *context, const ClientInfo &client_info, } } -void *RequestDump(void *context) { +void* RequestDump(void* context) { CrashGenerationClient client((const char*)context); bool result = client.RequestDump(); return (void*)(result ? 0 : 1); @@ -206,7 +206,7 @@ TEST_F(CrashGenerationServerTest, testRequestDump) { } static void Crasher() { - int *a = (int*)0x42; + int* a = (int*)0x42; fprintf(stdout, "Going to crash...\n"); fprintf(stdout, "A = %d", *a); diff --git a/src/client/mac/tests/exception_handler_test.cc b/src/client/mac/tests/exception_handler_test.cc index d5b505a1..50f03f81 100644 --- a/src/client/mac/tests/exception_handler_test.cc +++ b/src/client/mac/tests/exception_handler_test.cc @@ -71,7 +71,7 @@ class ExceptionHandlerTest : public Test { }; static void Crasher() { - int *a = (int*)0x42; + int* a = (int*)0x42; fprintf(stdout, "Going to crash...\n"); fprintf(stdout, "A = %d", *a); @@ -86,8 +86,8 @@ static void SoonToCrash(void(*crasher)()) { crasher(); } -static bool MDCallback(const char *dump_dir, const char *file_name, - void *context, bool success) { +static bool MDCallback(const char* dump_dir, const char* file_name, + void* context, bool success) { string path(dump_dir); path.append("/"); path.append(file_name); @@ -179,9 +179,9 @@ TEST_F(ExceptionHandlerTest, InProcessAbort) { InProcessCrash(true); } -static bool DumpNameMDCallback(const char *dump_dir, const char *file_name, - void *context, bool success) { - ExceptionHandlerTest *self = reinterpret_cast(context); +static bool DumpNameMDCallback(const char* dump_dir, const char* file_name, + void* context, bool success) { + ExceptionHandlerTest* self = reinterpret_cast(context); if (dump_dir && file_name) { self->lastDumpName = dump_dir; self->lastDumpName += "/"; @@ -652,7 +652,7 @@ TEST_F(ExceptionHandlerTest, InstructionPointerMemoryNullPointer) { ASSERT_EQ((unsigned int)1, memory_list->region_count()); } -static void *Junk(void *) { +static void* Junk(void*) { sleep(1000000); return NULL; } diff --git a/src/client/mac/tests/minidump_generator_test.cc b/src/client/mac/tests/minidump_generator_test.cc index b1fa5d02..1f374657 100644 --- a/src/client/mac/tests/minidump_generator_test.cc +++ b/src/client/mac/tests/minidump_generator_test.cc @@ -79,7 +79,7 @@ class MinidumpGeneratorTest : public Test { AutoTempDir tempDir; }; -static void *Junk(void* data) { +static void* Junk(void* data) { bool* wait = reinterpret_cast(data); while (!*wait) { usleep(10000); diff --git a/src/client/minidump_file_writer-inl.h b/src/client/minidump_file_writer-inl.h index 0e12e00b..bdac2dae 100644 --- a/src/client/minidump_file_writer-inl.h +++ b/src/client/minidump_file_writer-inl.h @@ -69,7 +69,7 @@ inline bool TypedMDRVA::AllocateObjectAndArray(size_t count, } template -inline bool TypedMDRVA::CopyIndex(unsigned int index, MDType *item) { +inline bool TypedMDRVA::CopyIndex(unsigned int index, MDType* item) { assert(allocation_state_ == ARRAY); return writer_->Copy( static_cast(position_ + index * minidump_size::size()), @@ -78,7 +78,7 @@ inline bool TypedMDRVA::CopyIndex(unsigned int index, MDType *item) { template inline bool TypedMDRVA::CopyIndexAfterObject(unsigned int index, - const void *src, + const void* src, size_t length) { assert(allocation_state_ == SINGLE_OBJECT_WITH_ARRAY); return writer_->Copy( diff --git a/src/client/minidump_file_writer.cc b/src/client/minidump_file_writer.cc index a1957f32..5c3c5cbb 100644 --- a/src/client/minidump_file_writer.cc +++ b/src/client/minidump_file_writer.cc @@ -101,7 +101,7 @@ MinidumpFileWriter::~MinidumpFileWriter() { Close(); } -bool MinidumpFileWriter::Open(const char *path) { +bool MinidumpFileWriter::Open(const char* path) { assert(file_ == -1); #if defined(__linux__) && __linux__ file_ = sys_open(path, O_WRONLY | O_CREAT | O_EXCL, 0600); @@ -145,9 +145,9 @@ bool MinidumpFileWriter::Close() { return result; } -bool MinidumpFileWriter::CopyStringToMDString(const wchar_t *str, +bool MinidumpFileWriter::CopyStringToMDString(const wchar_t* str, unsigned int length, - TypedMDRVA *mdstring) { + TypedMDRVA* mdstring) { bool result = true; if (sizeof(wchar_t) == sizeof(uint16_t)) { // Shortcut if wchar_t is the same size as MDString's buffer @@ -178,9 +178,9 @@ bool MinidumpFileWriter::CopyStringToMDString(const wchar_t *str, return result; } -bool MinidumpFileWriter::CopyStringToMDString(const char *str, +bool MinidumpFileWriter::CopyStringToMDString(const char* str, unsigned int length, - TypedMDRVA *mdstring) { + TypedMDRVA* mdstring) { bool result = true; uint16_t out[2]; int out_idx = 0; @@ -205,9 +205,9 @@ bool MinidumpFileWriter::CopyStringToMDString(const char *str, } template -bool MinidumpFileWriter::WriteStringCore(const CharType *str, +bool MinidumpFileWriter::WriteStringCore(const CharType* str, unsigned int length, - MDLocationDescriptor *location) { + MDLocationDescriptor* location) { assert(str); assert(location); // Calculate the mdstring length by either limiting to |length| as passed in @@ -240,18 +240,18 @@ bool MinidumpFileWriter::WriteStringCore(const CharType *str, return result; } -bool MinidumpFileWriter::WriteString(const wchar_t *str, unsigned int length, - MDLocationDescriptor *location) { +bool MinidumpFileWriter::WriteString(const wchar_t* str, unsigned int length, + MDLocationDescriptor* location) { return WriteStringCore(str, length, location); } -bool MinidumpFileWriter::WriteString(const char *str, unsigned int length, - MDLocationDescriptor *location) { +bool MinidumpFileWriter::WriteString(const char* str, unsigned int length, + MDLocationDescriptor* location) { return WriteStringCore(str, length, location); } -bool MinidumpFileWriter::WriteMemory(const void *src, size_t size, - MDMemoryDescriptor *output) { +bool MinidumpFileWriter::WriteMemory(const void* src, size_t size, + MDMemoryDescriptor* output) { assert(src); assert(output); UntypedMDRVA mem(this); @@ -307,7 +307,7 @@ MDRVA MinidumpFileWriter::Allocate(size_t size) { return current_position; } -bool MinidumpFileWriter::Copy(MDRVA position, const void *src, ssize_t size) { +bool MinidumpFileWriter::Copy(MDRVA position, const void* src, ssize_t size) { assert(src); assert(size); assert(file_ != -1); @@ -340,7 +340,7 @@ bool UntypedMDRVA::Allocate(size_t size) { return position_ != MinidumpFileWriter::kInvalidMDRVA; } -bool UntypedMDRVA::Copy(MDRVA pos, const void *src, size_t size) { +bool UntypedMDRVA::Copy(MDRVA pos, const void* src, size_t size) { assert(src); assert(size); assert(pos + size <= position_ + size_); diff --git a/src/client/minidump_file_writer.h b/src/client/minidump_file_writer.h index ce32b6d0..c66dc591 100644 --- a/src/client/minidump_file_writer.h +++ b/src/client/minidump_file_writer.h @@ -77,7 +77,7 @@ public: // Open |path| as the destination of the minidump data. If |path| already // exists, then Open() will fail. // Return true on success, or false on failure. - bool Open(const char *path); + bool Open(const char* path); // Sets the file descriptor |file| as the destination of the minidump data. // Can be used as an alternative to Open() when a file descriptor is @@ -98,20 +98,20 @@ public: // entire NULL terminated string. Copying will stop at the first NULL. // |location| the allocated location // Return true on success, or false on failure - bool WriteString(const wchar_t *str, unsigned int length, - MDLocationDescriptor *location); + bool WriteString(const wchar_t* str, unsigned int length, + MDLocationDescriptor* location); // Same as above, except with |str| as a UTF-8 string - bool WriteString(const char *str, unsigned int length, - MDLocationDescriptor *location); + bool WriteString(const char* str, unsigned int length, + MDLocationDescriptor* location); // Write |size| bytes starting at |src| into the current position. // Return true on success and set |output| to position, or false on failure - bool WriteMemory(const void *src, size_t size, MDMemoryDescriptor *output); + bool WriteMemory(const void* src, size_t size, MDMemoryDescriptor* output); // Copies |size| bytes from |src| to |position| // Return true on success, or false on failure - bool Copy(MDRVA position, const void *src, ssize_t size); + bool Copy(MDRVA position, const void* src, ssize_t size); // Return the current position for writing to the minidump inline MDRVA position() const { return position_; } @@ -141,21 +141,21 @@ public: // variant may need to create a MDString that has more characters than the // source |str|, whereas the UTF-8 variant may coalesce characters to form // a single UTF-16 character. - bool CopyStringToMDString(const wchar_t *str, unsigned int length, - TypedMDRVA *mdstring); - bool CopyStringToMDString(const char *str, unsigned int length, - TypedMDRVA *mdstring); + bool CopyStringToMDString(const wchar_t* str, unsigned int length, + TypedMDRVA* mdstring); + bool CopyStringToMDString(const char* str, unsigned int length, + TypedMDRVA* mdstring); // The common templated code for writing a string template - bool WriteStringCore(const CharType *str, unsigned int length, - MDLocationDescriptor *location); + bool WriteStringCore(const CharType* str, unsigned int length, + MDLocationDescriptor* location); }; // Represents an untyped allocated chunk class UntypedMDRVA { public: - explicit UntypedMDRVA(MinidumpFileWriter *writer) + explicit UntypedMDRVA(MinidumpFileWriter* writer) : writer_(writer), position_(writer->position()), size_(0) {} @@ -179,16 +179,16 @@ class UntypedMDRVA { // Copy |size| bytes starting at |src| into the minidump at |position| // Return true on success, or false on failure - bool Copy(MDRVA position, const void *src, size_t size); + bool Copy(MDRVA position, const void* src, size_t size); // Copy |size| bytes from |src| to the current position - inline bool Copy(const void *src, size_t size) { + inline bool Copy(const void* src, size_t size) { return Copy(position_, src, size); } protected: // Writer we associate with - MinidumpFileWriter *writer_; + MinidumpFileWriter* writer_; // Position of the start of the data MDRVA position_; @@ -206,7 +206,7 @@ template class TypedMDRVA : public UntypedMDRVA { public: // Constructs an unallocated MDRVA - explicit TypedMDRVA(MinidumpFileWriter *writer) + explicit TypedMDRVA(MinidumpFileWriter* writer) : UntypedMDRVA(writer), data_(), allocation_state_(UNALLOCATED) {} @@ -220,7 +220,7 @@ class TypedMDRVA : public UntypedMDRVA { // Address of object data_ of MDType. This is not declared const as the // typical usage will be to access the underlying |data_| object as to // alter its contents. - MDType *get() { return &data_; } + MDType* get() { return &data_; } // Allocates minidump_size::size() bytes. // Must not call more than once. @@ -245,12 +245,12 @@ class TypedMDRVA : public UntypedMDRVA { // Copy |item| to |index| // Must have been allocated using AllocateArray(). // Return true on success, or false on failure - bool CopyIndex(unsigned int index, MDType *item); + bool CopyIndex(unsigned int index, MDType* item); // Copy |size| bytes starting at |str| to |index| // Must have been allocated using AllocateObjectAndArray(). // Return true on success, or false on failure - bool CopyIndexAfterObject(unsigned int index, const void *src, size_t size); + bool CopyIndexAfterObject(unsigned int index, const void* src, size_t size); // Write data_ bool Flush(); diff --git a/src/client/minidump_file_writer_unittest.cc b/src/client/minidump_file_writer_unittest.cc index 256e3371..16c407d2 100644 --- a/src/client/minidump_file_writer_unittest.cc +++ b/src/client/minidump_file_writer_unittest.cc @@ -70,16 +70,16 @@ typedef struct { ArrayStructure array[0]; } ObjectAndArrayStructure; -static bool WriteFile(const char *path) { +static bool WriteFile(const char* path) { MinidumpFileWriter writer; if (writer.Open(path)) { // Test a single structure google_breakpad::TypedMDRVA strings(&writer); ASSERT_TRUE(strings.Allocate()); strings.get()->integer_value = 0xBEEF; - const char *first = "First String"; + const char* first = "First String"; ASSERT_TRUE(writer.WriteString(first, 0, &strings.get()->first_string)); - const wchar_t *second = L"Second String"; + const wchar_t* second = L"Second String"; ASSERT_TRUE(writer.WriteString(second, 0, &strings.get()->second_string)); // Test an array structure @@ -111,7 +111,7 @@ static bool WriteFile(const char *path) { return writer.Close(); } -static bool CompareFile(const char *path) { +static bool CompareFile(const char* path) { unsigned long expected[] = { #if defined(__BIG_ENDIAN__) 0x0000beef, 0x0000001e, 0x00000018, 0x00000020, 0x00000038, 0x00000000, @@ -146,13 +146,14 @@ static bool CompareFile(const char *path) { }; size_t expected_byte_count = sizeof(expected); int fd = open(path, O_RDONLY, 0600); - void *buffer = malloc(expected_byte_count); + void* buffer = malloc(expected_byte_count); ASSERT_NE(fd, -1); ASSERT_TRUE(buffer); ASSERT_EQ(read(fd, buffer, expected_byte_count), static_cast(expected_byte_count)); - char *b1, *b2; + char* b1; + char* b2; b1 = reinterpret_cast(buffer); b2 = reinterpret_cast(expected); while (*b1 == *b2) { @@ -167,13 +168,13 @@ static bool CompareFile(const char *path) { } static bool RunTests() { - const char *path = "/tmp/minidump_file_writer_unittest.dmp"; + const char* path = "/tmp/minidump_file_writer_unittest.dmp"; ASSERT_TRUE(WriteFile(path)); ASSERT_TRUE(CompareFile(path)); unlink(path); return true; } -extern "C" int main(int argc, const char *argv[]) { +extern "C" int main(int argc, const char* argv[]) { return RunTests() ? 0 : 1; } diff --git a/src/client/solaris/handler/exception_handler.cc b/src/client/solaris/handler/exception_handler.cc index 7fc8d255..c96683f6 100644 --- a/src/client/solaris/handler/exception_handler.cc +++ b/src/client/solaris/handler/exception_handler.cc @@ -54,15 +54,15 @@ static const int kSigTable[] = { SIGBUS }; -std::vector *ExceptionHandler::handler_stack_ = NULL; +std::vector* ExceptionHandler::handler_stack_ = NULL; int ExceptionHandler::handler_stack_index_ = 0; pthread_mutex_t ExceptionHandler::handler_stack_mutex_ = PTHREAD_MUTEX_INITIALIZER; -ExceptionHandler::ExceptionHandler(const string &dump_path, +ExceptionHandler::ExceptionHandler(const string& dump_path, FilterCallback filter, MinidumpCallback callback, - void *callback_context, + void* callback_context, bool install_handler) : filter_(filter), callback_(callback), @@ -79,7 +79,7 @@ ExceptionHandler::ExceptionHandler(const string &dump_path, pthread_mutex_lock(&handler_stack_mutex_); if (handler_stack_ == NULL) - handler_stack_ = new std::vector; + handler_stack_ = new std::vector; handler_stack_->push_back(this); pthread_mutex_unlock(&handler_stack_mutex_); } @@ -92,7 +92,7 @@ ExceptionHandler::~ExceptionHandler() { handler_stack_->pop_back(); } else { print_message1(2, "warning: removing Breakpad handler out of order\n"); - for (std::vector::iterator iterator = + for (std::vector::iterator iterator = handler_stack_->begin(); iterator != handler_stack_->end(); ++iterator) { @@ -116,9 +116,9 @@ bool ExceptionHandler::WriteMinidump() { } // static -bool ExceptionHandler::WriteMinidump(const string &dump_path, +bool ExceptionHandler::WriteMinidump(const string& dump_path, MinidumpCallback callback, - void *callback_context) { + void* callback_context) { ExceptionHandler handler(dump_path, NULL, callback, callback_context, false); return handler.InternalWriteMinidump(0, 0, NULL); @@ -166,7 +166,7 @@ void ExceptionHandler::TeardownAllHandlers() { // static void ExceptionHandler::HandleException(int signo) { -//void ExceptionHandler::HandleException(int signo, siginfo_t *sip, ucontext_t *sig_ctx) { +//void ExceptionHandler::HandleException(int signo, siginfo_t* sip, ucontext_t* sig_ctx) { // The context information about the signal is put on the stack of // the signal handler frame as value parameter. For some reasons, the // prototype of the handler doesn't declare this information as parameter, we @@ -181,14 +181,14 @@ void ExceptionHandler::HandleException(int signo) { uintptr_t current_ebp = (uintptr_t)_getfp(); pthread_mutex_lock(&handler_stack_mutex_); - ExceptionHandler *current_handler = + ExceptionHandler* current_handler = handler_stack_->at(handler_stack_->size() - ++handler_stack_index_); pthread_mutex_unlock(&handler_stack_mutex_); // Restore original handler. current_handler->TeardownHandler(signo); - ucontext_t *sig_ctx = NULL; + ucontext_t* sig_ctx = NULL; if (current_handler->InternalWriteMinidump(signo, current_ebp, &sig_ctx)) { // if (current_handler->InternalWriteMinidump(signo, &sig_ctx)) { // Fully handled this exception, safe to exit. @@ -218,7 +218,7 @@ void ExceptionHandler::HandleException(int signo) { bool ExceptionHandler::InternalWriteMinidump(int signo, uintptr_t sighandler_ebp, - ucontext_t **sig_ctx) { + ucontext_t** sig_ctx) { if (filter_ && !filter_(callback_context_)) return false; diff --git a/src/client/solaris/handler/exception_handler.h b/src/client/solaris/handler/exception_handler.h index 4d72485f..cd6c85ea 100644 --- a/src/client/solaris/handler/exception_handler.h +++ b/src/client/solaris/handler/exception_handler.h @@ -79,7 +79,7 @@ class ExceptionHandler { // attempting to write a minidump. If a FilterCallback returns false, // Breakpad will immediately report the exception as unhandled without // writing a minidump, allowing another handler the opportunity to handle it. - typedef bool (*FilterCallback)(void *context); + typedef bool (*FilterCallback)(void* context); // A callback function to run after the minidump has been written. // minidump_id is a unique id for the dump, so the minidump @@ -97,9 +97,9 @@ class ExceptionHandler { // should normally return the value of |succeeded|, or when they wish to // not report an exception of handled, false. Callbacks will rarely want to // return true directly (unless |succeeded| is true). - typedef bool (*MinidumpCallback)(const char *dump_path, - const char *minidump_id, - void *context, + typedef bool (*MinidumpCallback)(const char* dump_path, + const char* minidump_id, + void* context, bool succeeded); // Creates a new ExceptionHandler instance to handle writing minidumps. @@ -110,15 +110,15 @@ class ExceptionHandler { // If install_handler is true, then a minidump will be written whenever // an unhandled exception occurs. If it is false, minidumps will only // be written when WriteMinidump is called. - ExceptionHandler(const string &dump_path, + ExceptionHandler(const string& dump_path, FilterCallback filter, MinidumpCallback callback, - void *callback_context, + void* callback_context, bool install_handler); ~ExceptionHandler(); // Get and Set the minidump path. string dump_path() const { return dump_path_; } - void set_dump_path(const string &dump_path) { + void set_dump_path(const string& dump_path) { dump_path_ = dump_path; dump_path_c_ = dump_path_.c_str(); } @@ -129,9 +129,9 @@ class ExceptionHandler { // Convenience form of WriteMinidump which does not require an // ExceptionHandler instance. - static bool WriteMinidump(const string &dump_path, + static bool WriteMinidump(const string& dump_path, MinidumpCallback callback, - void *callback_context); + void* callback_context); private: // Setup crash handler. @@ -144,7 +144,7 @@ class ExceptionHandler { void TeardownAllHandlers(); // Runs the main loop for the exception handler thread. - static void* ExceptionHandlerThreadMain(void *lpParameter); + static void* ExceptionHandlerThreadMain(void* lpParameter); // Signal handler. static void HandleException(int signo); @@ -157,20 +157,20 @@ class ExceptionHandler { // for the second and third parameters if you are not calling // this from a signal handler. bool InternalWriteMinidump(int signo, uintptr_t sighandler_ebp, - ucontext_t **sig_ctx); + ucontext_t** sig_ctx); private: // The callbacks before and after writing the dump file. FilterCallback filter_; MinidumpCallback callback_; - void *callback_context_; + void* callback_context_; // The directory in which a minidump will be written, set by the dump_path // argument to the constructor, or set_dump_path. string dump_path_; // C style dump path. Keep this when setting dump path, since calling // c_str() of std::string when crashing may not be safe. - const char *dump_path_c_; + const char* dump_path_c_; // True if the ExceptionHandler installed an unhandled exception filter // when created (with an install_handler parameter set to true). @@ -183,7 +183,7 @@ class ExceptionHandler { // The global exception handler stack. This is need becuase there may exist // multiple ExceptionHandler instances in a process. Each will have itself // registered in this stack. - static std::vector *handler_stack_; + static std::vector* handler_stack_; // The index of the handler that should handle the next exception. static int handler_stack_index_; static pthread_mutex_t handler_stack_mutex_; @@ -192,8 +192,8 @@ class ExceptionHandler { MinidumpGenerator minidump_generator_; // disallow copy ctor and operator= - explicit ExceptionHandler(const ExceptionHandler &); - void operator=(const ExceptionHandler &); + explicit ExceptionHandler(const ExceptionHandler&); + void operator=(const ExceptionHandler&); }; } // namespace google_breakpad diff --git a/src/client/solaris/handler/exception_handler_test.cc b/src/client/solaris/handler/exception_handler_test.cc index 6bb8e18d..4d2b33fa 100644 --- a/src/client/solaris/handler/exception_handler_test.cc +++ b/src/client/solaris/handler/exception_handler_test.cc @@ -49,7 +49,7 @@ static int foo2(int arg) { // Stack variable, used for debugging stack dumps. int c = 0xcccccccc; fprintf(stderr, "Thread trying to crash: %x\n", getpid()); - c = *reinterpret_cast(0x5); + c = *reinterpret_cast(0x5); return c; } @@ -60,7 +60,7 @@ static int foo(int arg) { return b; } -static void *thread_crash(void *) { +static void* thread_crash(void*) { // Stack variable, used for debugging stack dumps. int a = 0xaaaaaaaa; sleep(3); @@ -69,7 +69,7 @@ static void *thread_crash(void *) { return NULL; } -static void *thread_main(void *) { +static void* thread_main(void*) { while (!should_exit) sleep(1); return NULL; @@ -91,9 +91,9 @@ static void CreateThread(int num) { } // Callback when minidump written. -static bool MinidumpCallback(const char *dump_path, - const char *minidump_id, - void *context, +static bool MinidumpCallback(const char* dump_path, + const char* minidump_id, + void* context, bool succeeded) { int index = reinterpret_cast(context); if (index == 0) { @@ -104,7 +104,7 @@ static bool MinidumpCallback(const char *dump_path, return false; } -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { int handler_index = 1; ExceptionHandler handler_ignore(".", NULL, MinidumpCallback, (void*)handler_index, true); diff --git a/src/client/solaris/handler/minidump_generator.cc b/src/client/solaris/handler/minidump_generator.cc index 7485025f..56756665 100644 --- a/src/client/solaris/handler/minidump_generator.cc +++ b/src/client/solaris/handler/minidump_generator.cc @@ -50,7 +50,7 @@ using namespace google_breakpad; // Argument for the writer function. struct WriterArgument { - MinidumpFileWriter *minidump_writer; + MinidumpFileWriter* minidump_writer; // Pid of the lwp who called WriteMinidumpToFile int requester_pid; @@ -73,15 +73,15 @@ struct WriterArgument { // User context when crash happens. Can be NULL if this is a requested dump. // This is actually an out parameter, but it will be filled in at the start // of the writer LWP. - ucontext_t *sig_ctx; + ucontext_t* sig_ctx; // Used to get information about the lwps. - SolarisLwp *lwp_lister; + SolarisLwp* lwp_lister; }; // Holding context information for the callback of finding the crashing lwp. struct FindCrashLwpContext { - const SolarisLwp *lwp_lister; + const SolarisLwp* lwp_lister; uintptr_t crashing_stack_bottom; int crashing_lwpid; @@ -96,11 +96,11 @@ struct FindCrashLwpContext { // It will compare the stack bottom of the provided lwp with the stack // bottom of the crashed lwp, it they are eqaul, this lwp is the one // who crashed. -bool IsLwpCrashedCallback(lwpstatus_t *lsp, void *context) { - FindCrashLwpContext *crashing_context = - static_cast(context); - const SolarisLwp *lwp_lister = crashing_context->lwp_lister; - const prgregset_t *gregs = &(lsp->pr_reg); +bool IsLwpCrashedCallback(lwpstatus_t* lsp, void* context) { + FindCrashLwpContext* crashing_context = + static_cast(context); + const SolarisLwp* lwp_lister = crashing_context->lwp_lister; + const prgregset_t* gregs = &(lsp->pr_reg); #if TARGET_CPU_SPARC uintptr_t last_ebp = (*gregs)[R_FP]; #elif TARGET_CPU_X86 @@ -121,7 +121,7 @@ bool IsLwpCrashedCallback(lwpstatus_t *lsp, void *context) { // This is done based on stack bottom comparing. int FindCrashingLwp(uintptr_t crashing_stack_bottom, int requester_pid, - const SolarisLwp *lwp_lister) { + const SolarisLwp* lwp_lister) { FindCrashLwpContext context; context.lwp_lister = lwp_lister; context.crashing_stack_bottom = crashing_stack_bottom; @@ -131,17 +131,17 @@ int FindCrashingLwp(uintptr_t crashing_stack_bottom, return context.crashing_lwpid; } -bool WriteLwpStack(const SolarisLwp *lwp_lister, +bool WriteLwpStack(const SolarisLwp* lwp_lister, uintptr_t last_esp, - UntypedMDRVA *memory, - MDMemoryDescriptor *loc) { + UntypedMDRVA* memory, + MDMemoryDescriptor* loc) { uintptr_t stack_bottom = lwp_lister->GetLwpStackBottom(last_esp); if (stack_bottom >= last_esp) { int size = stack_bottom - last_esp; if (size > 0) { if (!memory->Allocate(size)) return false; - memory->Copy(reinterpret_cast(last_esp), size); + memory->Copy(reinterpret_cast(last_esp), size); loc->start_of_memory_range = last_esp; loc->memory = memory->location(); } @@ -151,7 +151,7 @@ bool WriteLwpStack(const SolarisLwp *lwp_lister, } #if TARGET_CPU_SPARC -bool WriteContext(MDRawContextSPARC *context, ucontext_t *sig_ctx) { +bool WriteContext(MDRawContextSPARC* context, ucontext_t* sig_ctx) { assert(sig_ctx != NULL); int* regs = sig_ctx->uc_mcontext.gregs; context->context_flags = MD_CONTEXT_SPARC_FULL; @@ -170,13 +170,13 @@ bool WriteContext(MDRawContextSPARC *context, ucontext_t *sig_ctx) { for ( int i = 1 ; i < 16; ++i ) { context->g_r[i] = (uintptr_t)(sig_ctx->uc_mcontext.gregs[i + 3]); } - context->g_r[30] = (uintptr_t)(((struct frame *)context->g_r[14])->fr_savfp); + context->g_r[30] = (uintptr_t)(((struct frame*)context->g_r[14])->fr_savfp); return true; } -bool WriteContext(MDRawContextSPARC *context, prgregset_t regs, - prfpregset_t *fp_regs) { +bool WriteContext(MDRawContextSPARC* context, prgregset_t regs, + prfpregset_t* fp_regs) { if (!context || !regs) return false; @@ -195,8 +195,8 @@ bool WriteContext(MDRawContextSPARC *context, prgregset_t regs, return true; } #elif TARGET_CPU_X86 -bool WriteContext(MDRawContextX86 *context, prgregset_t regs, - prfpregset_t *fp_regs) { +bool WriteContext(MDRawContextX86* context, prgregset_t regs, + prfpregset_t* fp_regs) { if (!context || !regs) return false; @@ -228,10 +228,10 @@ bool WriteContext(MDRawContextX86 *context, prgregset_t regs, // signal. This makes the current stack not reliable, and our stack walker // won't figure out the whole call stack for this. So we write the stack at the // time of the crash into the minidump file, not the current stack. -bool WriteCrashedLwpStream(MinidumpFileWriter *minidump_writer, - const WriterArgument *writer_args, - const lwpstatus_t *lsp, - MDRawThread *lwp) { +bool WriteCrashedLwpStream(MinidumpFileWriter* minidump_writer, + const WriterArgument* writer_args, + const lwpstatus_t* lsp, + MDRawThread* lwp) { assert(writer_args->sig_ctx != NULL); lwp->thread_id = lsp->pr_lwpid; @@ -264,16 +264,16 @@ bool WriteCrashedLwpStream(MinidumpFileWriter *minidump_writer, lwp->thread_context = context.location(); memset(context.get(), 0, sizeof(MDRawContextX86)); return WriteContext(context.get(), - (int *)&writer_args->sig_ctx->uc_mcontext.gregs, + (int*)&writer_args->sig_ctx->uc_mcontext.gregs, &writer_args->sig_ctx->uc_mcontext.fpregs); #endif } -bool WriteLwpStream(MinidumpFileWriter *minidump_writer, - const SolarisLwp *lwp_lister, - const lwpstatus_t *lsp, MDRawThread *lwp) { +bool WriteLwpStream(MinidumpFileWriter* minidump_writer, + const SolarisLwp* lwp_lister, + const lwpstatus_t* lsp, MDRawThread* lwp) { prfpregset_t fp_regs = lsp->pr_fpreg; - const prgregset_t *gregs = &(lsp->pr_reg); + const prgregset_t* gregs = &(lsp->pr_reg); UntypedMDRVA memory(minidump_writer); #if TARGET_CPU_SPARC if (!WriteLwpStack(lwp_lister, @@ -306,10 +306,10 @@ bool WriteLwpStream(MinidumpFileWriter *minidump_writer, lwp->thread_context = context.location(); memset(context.get(), 0, sizeof(MDRawContextX86)); #endif /* TARGET_CPU_XXX */ - return WriteContext(context.get(), (int *)gregs, &fp_regs); + return WriteContext(context.get(), (int*)gregs, &fp_regs); } -bool WriteCPUInformation(MDRawSystemInfo *sys_info) { +bool WriteCPUInformation(MDRawSystemInfo* sys_info) { struct utsname uts; char *major, *minor, *build; @@ -337,8 +337,8 @@ bool WriteCPUInformation(MDRawSystemInfo *sys_info) { return true; } -bool WriteOSInformation(MinidumpFileWriter *minidump_writer, - MDRawSystemInfo *sys_info) { +bool WriteOSInformation(MinidumpFileWriter* minidump_writer, + MDRawSystemInfo* sys_info) { sys_info->platform_id = MD_OS_SOLARIS; struct utsname uts; @@ -346,7 +346,7 @@ bool WriteOSInformation(MinidumpFileWriter *minidump_writer, char os_version[512]; size_t space_left = sizeof(os_version); memset(os_version, 0, space_left); - const char *os_info_table[] = { + const char* os_info_table[] = { uts.sysname, uts.release, uts.version, @@ -354,7 +354,7 @@ bool WriteOSInformation(MinidumpFileWriter *minidump_writer, "OpenSolaris", NULL }; - for (const char **cur_os_info = os_info_table; + for (const char** cur_os_info = os_info_table; *cur_os_info != NULL; ++cur_os_info) { if (cur_os_info != os_info_table && space_left > 1) { @@ -379,21 +379,21 @@ bool WriteOSInformation(MinidumpFileWriter *minidump_writer, // Callback context for get writting lwp information. struct LwpInfoCallbackCtx { - MinidumpFileWriter *minidump_writer; - const WriterArgument *writer_args; - TypedMDRVA *list; + MinidumpFileWriter* minidump_writer; + const WriterArgument* writer_args; + TypedMDRVA* list; int lwp_index; }; -bool LwpInformationCallback(lwpstatus_t *lsp, void *context) { +bool LwpInformationCallback(lwpstatus_t* lsp, void* context) { bool success = true; - LwpInfoCallbackCtx *callback_context = - static_cast(context); + LwpInfoCallbackCtx* callback_context = + static_cast(context); // The current lwp is the one to handle the crash. Ignore it. if (lsp->pr_lwpid != pthread_self()) { - LwpInfoCallbackCtx *callback_context = - static_cast(context); + LwpInfoCallbackCtx* callback_context = + static_cast(context); MDRawThread lwp; memset(&lwp, 0, sizeof(MDRawThread)); @@ -417,11 +417,11 @@ bool LwpInformationCallback(lwpstatus_t *lsp, void *context) { return success; } -bool WriteLwpListStream(MinidumpFileWriter *minidump_writer, - const WriterArgument *writer_args, - MDRawDirectory *dir) { +bool WriteLwpListStream(MinidumpFileWriter* minidump_writer, + const WriterArgument* writer_args, + MDRawDirectory* dir) { // Get the lwp information. - const SolarisLwp *lwp_lister = writer_args->lwp_lister; + const SolarisLwp* lwp_lister = writer_args->lwp_lister; int lwp_count = lwp_lister->GetLwpCount(); if (lwp_count < 0) return false; @@ -444,14 +444,14 @@ bool WriteLwpListStream(MinidumpFileWriter *minidump_writer, return written == lwp_count; } -bool WriteCVRecord(MinidumpFileWriter *minidump_writer, - MDRawModule *module, - const char *module_path, - char *realname) { +bool WriteCVRecord(MinidumpFileWriter* minidump_writer, + MDRawModule* module, + const char* module_path, + char* realname) { TypedMDRVA cv(minidump_writer); char path[PATH_MAX]; - const char *module_name = module_path ? module_path : ""; + const char* module_name = module_path ? module_path : ""; snprintf(path, sizeof(path), "/proc/self/object/%s", module_name); size_t module_name_length = strlen(realname); @@ -461,7 +461,7 @@ bool WriteCVRecord(MinidumpFileWriter *minidump_writer, return false; module->cv_record = cv.location(); - MDCVInfoPDB70 *cv_ptr = cv.get(); + MDCVInfoPDB70* cv_ptr = cv.get(); memset(cv_ptr, 0, sizeof(MDCVInfoPDB70)); cv_ptr->cv_signature = MD_CVINFOPDB70_SIGNATURE; cv_ptr->age = 0; @@ -489,15 +489,15 @@ bool WriteCVRecord(MinidumpFileWriter *minidump_writer, } struct ModuleInfoCallbackCtx { - MinidumpFileWriter *minidump_writer; - const WriterArgument *writer_args; - TypedMDRVA *list; + MinidumpFileWriter* minidump_writer; + const WriterArgument* writer_args; + TypedMDRVA* list; int module_index; }; -bool ModuleInfoCallback(const ModuleInfo &module_info, void *context) { - ModuleInfoCallbackCtx *callback_context = - static_cast(context); +bool ModuleInfoCallback(const ModuleInfo& module_info, void* context) { + ModuleInfoCallbackCtx* callback_context = + static_cast(context); // Skip those modules without name, or those that are not modules. if (strlen(module_info.name) == 0) return true; @@ -507,7 +507,7 @@ bool ModuleInfoCallback(const ModuleInfo &module_info, void *context) { MDLocationDescriptor loc; char path[PATH_MAX]; char buf[PATH_MAX]; - char *realname; + char* realname; int count; snprintf(path, sizeof (path), "/proc/self/path/%s", module_info.name); @@ -535,9 +535,9 @@ bool ModuleInfoCallback(const ModuleInfo &module_info, void *context) { return true; } -bool WriteModuleListStream(MinidumpFileWriter *minidump_writer, - const WriterArgument *writer_args, - MDRawDirectory *dir) { +bool WriteModuleListStream(MinidumpFileWriter* minidump_writer, + const WriterArgument* writer_args, + MDRawDirectory* dir) { TypedMDRVA list(minidump_writer); int module_count = writer_args->lwp_lister->GetModuleCount(); @@ -558,9 +558,9 @@ bool WriteModuleListStream(MinidumpFileWriter *minidump_writer, return writer_args->lwp_lister->ListModules(&callback) == module_count; } -bool WriteSystemInfoStream(MinidumpFileWriter *minidump_writer, - const WriterArgument *writer_args, - MDRawDirectory *dir) { +bool WriteSystemInfoStream(MinidumpFileWriter* minidump_writer, + const WriterArgument* writer_args, + MDRawDirectory* dir) { TypedMDRVA sys_info(minidump_writer); if (!sys_info.Allocate()) @@ -573,9 +573,9 @@ bool WriteSystemInfoStream(MinidumpFileWriter *minidump_writer, WriteOSInformation(minidump_writer, sys_info.get()); } -bool WriteExceptionStream(MinidumpFileWriter *minidump_writer, - const WriterArgument *writer_args, - MDRawDirectory *dir) { +bool WriteExceptionStream(MinidumpFileWriter* minidump_writer, + const WriterArgument* writer_args, + MDRawDirectory* dir) { // This happenes when this is not a crash, but a requested dump. if (writer_args->sig_ctx == NULL) return false; @@ -620,14 +620,14 @@ bool WriteExceptionStream(MinidumpFileWriter *minidump_writer, exception.get()->thread_context = context.location(); memset(context.get(), 0, sizeof(MDRawContextX86)); return WriteContext(context.get(), - (int *)&writer_args->sig_ctx->uc_mcontext.gregs, + (int*)&writer_args->sig_ctx->uc_mcontext.gregs, NULL); #endif } -bool WriteMiscInfoStream(MinidumpFileWriter *minidump_writer, - const WriterArgument *writer_args, - MDRawDirectory *dir) { +bool WriteMiscInfoStream(MinidumpFileWriter* minidump_writer, + const WriterArgument* writer_args, + MDRawDirectory* dir) { TypedMDRVA info(minidump_writer); if (!info.Allocate()) @@ -642,9 +642,9 @@ bool WriteMiscInfoStream(MinidumpFileWriter *minidump_writer, return true; } -bool WriteBreakpadInfoStream(MinidumpFileWriter *minidump_writer, - const WriterArgument *writer_args, - MDRawDirectory *dir) { +bool WriteBreakpadInfoStream(MinidumpFileWriter* minidump_writer, + const WriterArgument* writer_args, + MDRawDirectory* dir) { TypedMDRVA info(minidump_writer); if (!info.Allocate()) @@ -662,16 +662,16 @@ bool WriteBreakpadInfoStream(MinidumpFileWriter *minidump_writer, class AutoLwpResumer { public: - AutoLwpResumer(SolarisLwp *lwp) : lwp_(lwp) {} + AutoLwpResumer(SolarisLwp* lwp) : lwp_(lwp) {} ~AutoLwpResumer() { lwp_->ControlAllLwps(false); } private: - SolarisLwp *lwp_; + SolarisLwp* lwp_; }; // Prototype of writer functions. -typedef bool (*WriteStreamFN)(MinidumpFileWriter *, - const WriterArgument *, - MDRawDirectory *); +typedef bool (*WriteStreamFN)(MinidumpFileWriter*, + const WriterArgument*, + MDRawDirectory*); // Function table to writer a full minidump. const WriteStreamFN writers[] = { @@ -684,9 +684,9 @@ const WriteStreamFN writers[] = { }; // Will call each writer function in the writers table. -//void* MinidumpGenerator::Write(void *argument) { -void* Write(void *argument) { - WriterArgument *writer_args = static_cast(argument); +//void* MinidumpGenerator::Write(void* argument) { +void* Write(void* argument) { + WriterArgument* writer_args = static_cast(argument); if (!writer_args->lwp_lister->ControlAllLwps(true)) return NULL; @@ -712,7 +712,7 @@ void* Write(void *argument) { writer_args->crashed_lwpid = crashed_lwpid; } - MinidumpFileWriter *minidump_writer = writer_args->minidump_writer; + MinidumpFileWriter* minidump_writer = writer_args->minidump_writer; TypedMDRVA header(minidump_writer); TypedMDRVA dir(minidump_writer); if (!header.Allocate()) @@ -750,10 +750,10 @@ MinidumpGenerator::~MinidumpGenerator() { // Write minidump into file. // It runs in a different thread from the crashing thread. -bool MinidumpGenerator::WriteMinidumpToFile(const char *file_pathname, +bool MinidumpGenerator::WriteMinidumpToFile(const char* file_pathname, int signo, uintptr_t sighandler_ebp, - ucontext_t **sig_ctx) const { + ucontext_t** sig_ctx) const { // The exception handler thread. pthread_t handler_thread; @@ -775,7 +775,7 @@ bool MinidumpGenerator::WriteMinidumpToFile(const char *file_pathname, argument.sighandler_ebp = sighandler_ebp; argument.sig_ctx = NULL; - pthread_create(&handler_thread, NULL, Write, (void *)&argument); + pthread_create(&handler_thread, NULL, Write, (void*)&argument); pthread_join(handler_thread, NULL); return true; } diff --git a/src/client/solaris/handler/minidump_generator.h b/src/client/solaris/handler/minidump_generator.h index 882f9e1d..daa6fe01 100644 --- a/src/client/solaris/handler/minidump_generator.h +++ b/src/client/solaris/handler/minidump_generator.h @@ -48,10 +48,10 @@ namespace google_breakpad { // class MinidumpGenerator { // Callback run for writing lwp information in the process. - friend bool LwpInformationCallback(lwpstatus_t *lsp, void *context); + friend bool LwpInformationCallback(lwpstatus_t* lsp, void* context); // Callback run for writing module information in the process. - friend bool ModuleInfoCallback(const ModuleInfo &module_info, void *context); + friend bool ModuleInfoCallback(const ModuleInfo& module_info, void* context); public: MinidumpGenerator(); @@ -59,10 +59,10 @@ class MinidumpGenerator { ~MinidumpGenerator(); // Write minidump. - bool WriteMinidumpToFile(const char *file_pathname, + bool WriteMinidumpToFile(const char* file_pathname, int signo, uintptr_t sighandler_ebp, - ucontext_t **sig_ctx) const; + ucontext_t** sig_ctx) const; }; } // namespace google_breakpad diff --git a/src/client/solaris/handler/minidump_test.cc b/src/client/solaris/handler/minidump_test.cc index 33302d86..5f685ef2 100644 --- a/src/client/solaris/handler/minidump_test.cc +++ b/src/client/solaris/handler/minidump_test.cc @@ -40,7 +40,7 @@ using google_breakpad::MinidumpGenerator; static bool doneWritingReport = false; -static void *Reporter(void *) { +static void* Reporter(void*) { char buffer[PATH_MAX]; MinidumpGenerator md; diff --git a/src/client/solaris/handler/solaris_lwp.cc b/src/client/solaris/handler/solaris_lwp.cc index 0148997a..cb6cc8ab 100644 --- a/src/client/solaris/handler/solaris_lwp.cc +++ b/src/client/solaris/handler/solaris_lwp.cc @@ -69,10 +69,10 @@ struct AddressValidatingContext { }; // Convert from string to int. -static bool LocalAtoi(char *s, int *r) { +static bool LocalAtoi(char* s, int* r) { assert(s != NULL); assert(r != NULL); - char *endptr = NULL; + char* endptr = NULL; int ret = strtol(s, &endptr, 10); if (endptr == s) return false; @@ -82,10 +82,10 @@ static bool LocalAtoi(char *s, int *r) { // Callback invoked for each mapped module. // It uses the module's adderss range to validate the address. -static bool AddressNotInModuleCallback(const ModuleInfo &module_info, - void *context) { - AddressValidatingContext *addr = - reinterpret_cast(context); +static bool AddressNotInModuleCallback(const ModuleInfo& module_info, + void* context) { + AddressValidatingContext* addr = + reinterpret_cast(context); if (addr->is_mapped = ((module_info.start_addr > 0) && (addr->address >= module_info.start_addr) && (addr->address <= module_info.start_addr + @@ -97,16 +97,16 @@ static bool AddressNotInModuleCallback(const ModuleInfo &module_info, } static int IterateLwpAll(int pid, - CallbackParam *callback_param) { + CallbackParam* callback_param) { char lwp_path[40]; - DIR *dir; + DIR* dir; int count = 0; snprintf(lwp_path, sizeof (lwp_path), "/proc/%d/lwp", (int)pid); if ((dir = opendir(lwp_path)) == NULL) return -1; - struct dirent *entry = NULL; + struct dirent* entry = NULL; while ((entry = readdir(dir)) != NULL) { if ((strcmp(entry->d_name, ".") != 0) && (strcmp(entry->d_name, "..") != 0)) { @@ -128,22 +128,22 @@ static int IterateLwpAll(int pid, } #if defined(__i386) && !defined(NO_FRAME_POINTER) -void *GetNextFrame(void **last_ebp) { - void *sp = *last_ebp; +void* GetNextFrame(void** last_ebp) { + void* sp = *last_ebp; if ((unsigned long)sp == (unsigned long)last_ebp) return NULL; - if ((unsigned long)sp & (sizeof(void *) - 1)) + if ((unsigned long)sp & (sizeof(void*) - 1)) return NULL; if ((unsigned long)sp - (unsigned long)last_ebp > 100000) return NULL; return sp; } #elif defined(__sparc) -void *GetNextFrame(void *last_ebp) { - return reinterpret_cast(last_ebp)->fr_savfp; +void* GetNextFrame(void* last_ebp) { + return reinterpret_cast(last_ebp)->fr_savfp; } #else -void *GetNextFrame(void **last_ebp) { +void* GetNextFrame(void** last_ebp) { return reinterpret_cast(last_ebp); } #endif @@ -159,12 +159,12 @@ class AutoCloser { // Control the execution of the lwp. // Suspend/Resume lwp based on the value of context. -static bool ControlLwp(int lwpid, void *context) { +static bool ControlLwp(int lwpid, void* context) { // The current thread is the one to handle the crash. Ignore it. if (lwpid != pthread_self()) { int ctlfd; char procname[PATH_MAX]; - bool suspend = *(bool *)context; + bool suspend = *(bool*)context; // Open the /proc/$pid/lwp/$lwpid/lwpctl files snprintf(procname, sizeof (procname), "/proc/self/lwp/%d/lwpctl", lwpid); @@ -193,7 +193,7 @@ static bool ControlLwp(int lwpid, void *context) { * prheader_t at the start (/proc/$pid/lstatus or /proc/$pid/lpsinfo). * Return true on success. */ -static bool read_lfile(int pid, const char *lname, prheader_t *lhp) { +static bool read_lfile(int pid, const char* lname, prheader_t* lhp) { char lpath[PATH_MAX]; struct stat statb; int fd; @@ -242,14 +242,14 @@ int SolarisLwp::GetLwpCount() const { } int SolarisLwp::Lwp_iter_all(int pid, - CallbackParam *callback_param) const { - lwpstatus_t *Lsp; - lwpstatus_t *sp; + CallbackParam* callback_param) const { + lwpstatus_t* Lsp; + lwpstatus_t* sp; prheader_t lphp[HEADER_MAX]; prheader_t lhp[HEADER_MAX]; - prheader_t *Lphp = lphp; - prheader_t *Lhp = lhp; - lwpsinfo_t *Lpsp; + prheader_t* Lphp = lphp; + prheader_t* Lhp = lhp; + lwpsinfo_t* Lpsp; long nstat; long ninfo; int rv = 0; @@ -264,13 +264,13 @@ int SolarisLwp::Lwp_iter_all(int pid, return -1; } - Lsp = (lwpstatus_t *)(uintptr_t)(Lhp + 1); - Lpsp = (lwpsinfo_t *)(uintptr_t)(Lphp + 1); + Lsp = (lwpstatus_t*)(uintptr_t)(Lhp + 1); + Lpsp = (lwpsinfo_t*)(uintptr_t)(Lphp + 1); for (ninfo = Lphp->pr_nent; ninfo != 0; --ninfo) { if (Lpsp->pr_sname != 'Z') { sp = Lsp; - Lsp = (lwpstatus_t *)((uintptr_t)Lsp + Lhp->pr_entsize); + Lsp = (lwpstatus_t*)((uintptr_t)Lsp + Lhp->pr_entsize); } else { sp = NULL; } @@ -278,7 +278,7 @@ int SolarisLwp::Lwp_iter_all(int pid, !(callback_param->call_back)(sp, callback_param->context)) break; ++rv; - Lpsp = (lwpsinfo_t *)((uintptr_t)Lpsp + Lphp->pr_entsize); + Lpsp = (lwpsinfo_t*)((uintptr_t)Lpsp + Lphp->pr_entsize); } return rv; @@ -298,12 +298,12 @@ int SolarisLwp::GetModuleCount() const { } int SolarisLwp::ListModules( - CallbackParam *callback_param) const { - const char *maps_path = "/proc/self/map"; + CallbackParam* callback_param) const { + const char* maps_path = "/proc/self/map"; struct stat status; int fd = 0, num; prmap_t map_array[MAP_MAX]; - prmap_t *maps = map_array; + prmap_t* maps = map_array; size_t size; if ((fd = open(maps_path, O_RDONLY)) == -1) { @@ -326,12 +326,12 @@ int SolarisLwp::ListModules( return -1; } - if (read(fd, (void *)maps, size) < 0) { + if (read(fd, (void*)maps, size) < 0) { print_message2(2, "failed to read %d\n", fd); return -1; } - prmap_t *_maps; + prmap_t* _maps; int _num; int module_count = 0; @@ -345,7 +345,7 @@ int SolarisLwp::ListModules( */ for (_num = 0, _maps = maps; _num < num; ++_num, ++_maps) { ModuleInfo module; - char *name = _maps->pr_mapname; + char* name = _maps->pr_mapname; memset(&module, 0, sizeof (module)); module.start_addr = _maps->pr_vaddr; @@ -403,7 +403,7 @@ bool SolarisLwp::IsAddressMapped(uintptr_t address) const { // The Solaris stack looks like this: // http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libproc/common/Pstack.c#81 bool SolarisLwp::FindSigContext(uintptr_t sighandler_ebp, - ucontext_t **sig_ctx) { + ucontext_t** sig_ctx) { uintptr_t previous_ebp; uintptr_t sig_ebp; const int MAX_STACK_DEPTH = 50; @@ -416,7 +416,7 @@ bool SolarisLwp::FindSigContext(uintptr_t sighandler_ebp, *sig_ctx = reinterpret_cast(sighandler_ebp + sizeof (struct frame)); uintptr_t sig_esp = (*sig_ctx)->uc_mcontext.gregs[REG_O6]; if (sig_esp < previous_ebp && sig_esp > sighandler_ebp) - sig_ebp = (uintptr_t)(((struct frame *)sig_esp)->fr_savfp); + sig_ebp = (uintptr_t)(((struct frame*)sig_esp)->fr_savfp); #elif TARGET_CPU_X86 previous_ebp = reinterpret_cast(GetNextFrame( diff --git a/src/client/solaris/handler/solaris_lwp.h b/src/client/solaris/handler/solaris_lwp.h index 0914cfcd..afe352ce 100644 --- a/src/client/solaris/handler/solaris_lwp.h +++ b/src/client/solaris/handler/solaris_lwp.h @@ -70,17 +70,17 @@ struct ModuleInfo { // A callback to run when getting a lwp in the process. // Return true will go on to the next lwp while return false will stop the // iteration. -typedef bool (*LwpCallback)(lwpstatus_t* lsp, void *context); +typedef bool (*LwpCallback)(lwpstatus_t* lsp, void* context); // A callback to run when a new module is found in the process. // Return true will go on to the next module while return false will stop the // iteration. -typedef bool (*ModuleCallback)(const ModuleInfo &module_info, void *context); +typedef bool (*ModuleCallback)(const ModuleInfo& module_info, void* context); // A callback to run when getting a lwpid in the process. // Return true will go on to the next lwp while return false will stop the // iteration. -typedef bool (*LwpidCallback)(int lwpid, void *context); +typedef bool (*LwpidCallback)(int lwpid, void* context); // Holding the callback information. template @@ -88,12 +88,12 @@ struct CallbackParam { // Callback function address. CallbackFunc call_back; // Callback context; - void *context; + void* context; CallbackParam() : call_back(NULL), context(NULL) { } - CallbackParam(CallbackFunc func, void *func_context) : + CallbackParam(CallbackFunc func, void* func_context) : call_back(func), context(func_context) { } }; @@ -129,7 +129,7 @@ class SolarisLwp { // Whenever there is a lwp found, the callback will be invoked to process // the information. // Return the callback return value or -1 on error. - int Lwp_iter_all(int pid, CallbackParam *callback_param) const; + int Lwp_iter_all(int pid, CallbackParam* callback_param) const; // Get the module count of the current process. int GetModuleCount() const; @@ -138,13 +138,13 @@ class SolarisLwp { // Whenever a module is found, the callback will be invoked to process the // information. // Return how may modules are found. - int ListModules(CallbackParam *callback_param) const; + int ListModules(CallbackParam* callback_param) const; // Get the bottom of the stack from esp. uintptr_t GetLwpStackBottom(uintptr_t current_esp) const; // Finds a signal context on the stack given the ebp of our signal handler. - bool FindSigContext(uintptr_t sighandler_ebp, ucontext_t **sig_ctx); + bool FindSigContext(uintptr_t sighandler_ebp, ucontext_t** sig_ctx); private: // Check if the address is a valid virtual address. diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc index ad45b200..20d63a84 100644 --- a/src/client/windows/handler/exception_handler.cc +++ b/src/client/windows/handler/exception_handler.cc @@ -118,7 +118,7 @@ ExceptionHandler::ExceptionHandler( NULL); // custom_info - not used } -ExceptionHandler::ExceptionHandler(const wstring &dump_path, +ExceptionHandler::ExceptionHandler(const wstring& dump_path, FilterCallback filter, MinidumpCallback callback, void* callback_context, @@ -383,7 +383,7 @@ bool ExceptionHandler::RequestUpload(DWORD crash_id) { // static DWORD ExceptionHandler::ExceptionHandlerThreadMain(void* lpParameter) { - ExceptionHandler* self = reinterpret_cast(lpParameter); + ExceptionHandler* self = reinterpret_cast(lpParameter); assert(self); assert(self->handler_start_semaphore_ != NULL); assert(self->handler_finish_semaphore_ != NULL); @@ -765,7 +765,7 @@ bool ExceptionHandler::WriteMinidumpForException(EXCEPTION_POINTERS* exinfo) { } // static -bool ExceptionHandler::WriteMinidump(const wstring &dump_path, +bool ExceptionHandler::WriteMinidump(const wstring& dump_path, MinidumpCallback callback, void* callback_context, MINIDUMP_TYPE dump_type) { diff --git a/src/client/windows/handler/exception_handler.h b/src/client/windows/handler/exception_handler.h index 11babe51..eb5adaac 100644 --- a/src/client/windows/handler/exception_handler.h +++ b/src/client/windows/handler/exception_handler.h @@ -218,7 +218,7 @@ class ExceptionHandler { // Get and set the minidump path. wstring dump_path() const { return dump_path_; } - void set_dump_path(const wstring &dump_path) { + void set_dump_path(const wstring& dump_path) { dump_path_ = dump_path; dump_path_c_ = dump_path_.c_str(); UpdateNextID(); // Necessary to put dump_path_ in next_minidump_path_. @@ -237,7 +237,7 @@ class ExceptionHandler { // Convenience form of WriteMinidump which does not require an // ExceptionHandler instance. - static bool WriteMinidump(const wstring &dump_path, + static bool WriteMinidump(const wstring& dump_path, MinidumpCallback callback, void* callback_context, MINIDUMP_TYPE dump_type = MiniDumpNormal); @@ -513,8 +513,8 @@ class ExceptionHandler { static volatile LONG instance_count_; // disallow copy ctor and operator= - explicit ExceptionHandler(const ExceptionHandler &); - void operator=(const ExceptionHandler &); + explicit ExceptionHandler(const ExceptionHandler&); + void operator=(const ExceptionHandler&); }; } // namespace google_breakpad diff --git a/src/client/windows/sender/crash_report_sender.cc b/src/client/windows/sender/crash_report_sender.cc index eb2b422a..7fc64483 100644 --- a/src/client/windows/sender/crash_report_sender.cc +++ b/src/client/windows/sender/crash_report_sender.cc @@ -45,12 +45,12 @@ namespace google_breakpad { static const char kCheckpointSignature[] = "GBP1\n"; -CrashReportSender::CrashReportSender(const wstring &checkpoint_file) +CrashReportSender::CrashReportSender(const wstring& checkpoint_file) : checkpoint_file_(checkpoint_file), max_reports_per_day_(-1), last_sent_date_(-1), reports_sent_(0) { - FILE *fd; + FILE* fd; if (OpenCheckpointFile(L"r", &fd) == 0) { ReadCheckpoint(fd); fclose(fd); @@ -58,8 +58,8 @@ CrashReportSender::CrashReportSender(const wstring &checkpoint_file) } ReportResult CrashReportSender::SendCrashReport( - const wstring &url, const map ¶meters, - const map &files, wstring *report_code) { + const wstring& url, const map& parameters, + const map& files, wstring* report_code) { int today = GetCurrentDate(); if (today == last_sent_date_ && max_reports_per_day_ != -1 && @@ -82,7 +82,7 @@ ReportResult CrashReportSender::SendCrashReport( } } -void CrashReportSender::ReadCheckpoint(FILE *fd) { +void CrashReportSender::ReadCheckpoint(FILE* fd) { char buf[128]; if (!fgets(buf, sizeof(buf), fd) || strcmp(buf, kCheckpointSignature) != 0) { @@ -108,7 +108,7 @@ void CrashReportSender::ReportSent(int today) { ++reports_sent_; // Update the checkpoint file - FILE *fd; + FILE* fd; if (OpenCheckpointFile(L"w", &fd) == 0) { fputs(kCheckpointSignature, fd); fprintf(fd, "%d\n", last_sent_date_); @@ -124,7 +124,7 @@ int CrashReportSender::GetCurrentDate() const { system_time.wDay; } -int CrashReportSender::OpenCheckpointFile(const wchar_t *mode, FILE **fd) { +int CrashReportSender::OpenCheckpointFile(const wchar_t* mode, FILE** fd) { if (checkpoint_file_.empty()) { return ENOENT; } diff --git a/src/client/windows/sender/crash_report_sender.h b/src/client/windows/sender/crash_report_sender.h index 7786cc69..e6055857 100644 --- a/src/client/windows/sender/crash_report_sender.h +++ b/src/client/windows/sender/crash_report_sender.h @@ -65,7 +65,7 @@ class CrashReportSender { // If checkpoint_file is non-empty, breakpad will persist crash report // state to this file. A checkpoint file is required for // set_max_reports_per_day() to function properly. - explicit CrashReportSender(const wstring &checkpoint_file); + explicit CrashReportSender(const wstring& checkpoint_file); ~CrashReportSender() {} // Sets the maximum number of crash reports that will be sent in a 24-hour @@ -87,14 +87,14 @@ class CrashReportSender { // the return value is RESULT_SUCCEEDED), a code uniquely identifying the // report will be returned in report_code. // (Otherwise, report_code will be unchanged.) - ReportResult SendCrashReport(const wstring &url, - const map ¶meters, - const map &files, - wstring *report_code); + ReportResult SendCrashReport(const wstring& url, + const map& parameters, + const map& files, + wstring* report_code); private: // Reads persistent state from a checkpoint file. - void ReadCheckpoint(FILE *fd); + void ReadCheckpoint(FILE* fd); // Called when a new report has been sent, to update the checkpoint state. void ReportSent(int today); @@ -104,7 +104,7 @@ class CrashReportSender { // Opens the checkpoint file with the specified mode. // Returns zero on success, or an error code on failure. - int OpenCheckpointFile(const wchar_t *mode, FILE **fd); + int OpenCheckpointFile(const wchar_t* mode, FILE** fd); wstring checkpoint_file_; int max_reports_per_day_; @@ -114,8 +114,8 @@ class CrashReportSender { int reports_sent_; // Disallow copy constructor and operator= - explicit CrashReportSender(const CrashReportSender &); - void operator=(const CrashReportSender &); + explicit CrashReportSender(const CrashReportSender&); + void operator=(const CrashReportSender&); }; } // namespace google_breakpad diff --git a/src/client/windows/unittests/dump_analysis.cc b/src/client/windows/unittests/dump_analysis.cc index 53d4ddbd..0bb8f6c4 100644 --- a/src/client/windows/unittests/dump_analysis.cc +++ b/src/client/windows/unittests/dump_analysis.cc @@ -127,8 +127,8 @@ size_t DumpAnalysis::GetStreamImpl(ULONG stream_number, void** stream) const { return ret ? memory_list_size : 0; } -bool DumpAnalysis::HasMemoryImpl(const void *addr_in, size_t structuresize, - void **structure) const { +bool DumpAnalysis::HasMemoryImpl(const void* addr_in, size_t structuresize, + void** structure) const { uintptr_t address = reinterpret_cast(addr_in); MINIDUMP_MEMORY_LIST* memory_list = NULL; size_t memory_list_size = GetStream(MemoryListStream, &memory_list); diff --git a/src/client/windows/unittests/exception_handler_death_test.cc b/src/client/windows/unittests/exception_handler_death_test.cc index 5ef9e64d..04034e8d 100644 --- a/src/client/windows/unittests/exception_handler_death_test.cc +++ b/src/client/windows/unittests/exception_handler_death_test.cc @@ -52,7 +52,7 @@ const char kSuccessIndicator[] = "success"; const char kFailureIndicator[] = "failure"; // Utility function to test for a path's existence. -BOOL DoesPathExist(const TCHAR *path_name); +BOOL DoesPathExist(const TCHAR* path_name); enum OutOfProcGuarantee { OUT_OF_PROC_GUARANTEED, @@ -92,7 +92,7 @@ void ExceptionHandlerDeathTest::SetUp() { CreateDirectory(temp_path_, NULL); } -BOOL DoesPathExist(const TCHAR *path_name) { +BOOL DoesPathExist(const TCHAR* path_name) { DWORD flags = GetFileAttributes(path_name); if (flags == INVALID_FILE_ATTRIBUTES) { return FALSE; @@ -135,15 +135,15 @@ TEST_F(ExceptionHandlerDeathTest, InProcTest) { // Disable GTest SEH handler testing::DisableExceptionHandlerInScope disable_exception_handler; - int *i = NULL; + int* i = NULL; ASSERT_DEATH((*i)++, kSuccessIndicator); } static bool gDumpCallbackCalled = false; -void clientDumpCallback(void *dump_context, - const google_breakpad::ClientInfo *client_info, - const std::wstring *dump_path) { +void clientDumpCallback(void* dump_context, + const google_breakpad::ClientInfo* client_info, + const std::wstring* dump_path) { gDumpCallbackCalled = true; } @@ -152,7 +152,7 @@ void ExceptionHandlerDeathTest::DoCrashAccessViolation( scoped_ptr exc; if (out_of_proc_guarantee == OUT_OF_PROC_GUARANTEED) { - google_breakpad::CrashGenerationClient *client = + google_breakpad::CrashGenerationClient* client = new google_breakpad::CrashGenerationClient(kPipeName, MiniDumpNormal, NULL); // custom_info @@ -184,7 +184,7 @@ void ExceptionHandlerDeathTest::DoCrashAccessViolation( // if it's not true we'll still get an error rather than the crash // being expected. ASSERT_TRUE(exc->IsOutOfProcess()); - int *i = NULL; + int* i = NULL; printf("%d\n", (*i)++); } @@ -283,7 +283,7 @@ TEST_F(ExceptionHandlerDeathTest, PureVirtualCallTest) { EXPECT_EXIT(DoCrashPureVirtualCall(), ::testing::ExitedWithCode(0), ""); } -wstring find_minidump_in_directory(const wstring &directory) { +wstring find_minidump_in_directory(const wstring& directory) { wstring search_path = directory + L"\\*"; WIN32_FIND_DATA find_data; HANDLE find_handle = FindFirstFileW(search_path.c_str(), &find_data); diff --git a/src/client/windows/unittests/exception_handler_nesting_test.cc b/src/client/windows/unittests/exception_handler_nesting_test.cc index 3ae1d7cd..e24bd18b 100644 --- a/src/client/windows/unittests/exception_handler_nesting_test.cc +++ b/src/client/windows/unittests/exception_handler_nesting_test.cc @@ -49,7 +49,7 @@ const char kFilterReturnsFalse[] = "filter_returns_false"; const char kCallbackReturnsTrue[] = "callback_returns_true"; const char kCallbackReturnsFalse[] = "callback_returns_false"; -bool DoesPathExist(const wchar_t *path_name) { +bool DoesPathExist(const wchar_t* path_name) { DWORD flags = GetFileAttributes(path_name); if (flags == INVALID_FILE_ATTRIBUTES) { return false; @@ -128,12 +128,12 @@ bool MinidumpWrittenCallback(const wchar_t* dump_path, } -void DoCrash(const char *message) { +void DoCrash(const char* message) { if (message) { fprintf(stderr, "%s", message); fflush(stderr); } - int *i = NULL; + int* i = NULL; (*i)++; ASSERT_TRUE(false); diff --git a/src/client/windows/unittests/exception_handler_test.cc b/src/client/windows/unittests/exception_handler_test.cc index a4ce12a8..51196ca0 100644 --- a/src/client/windows/unittests/exception_handler_test.cc +++ b/src/client/windows/unittests/exception_handler_test.cc @@ -87,13 +87,13 @@ class ExceptionHandlerTest : public ::testing::Test { void DoCrashPureVirtualCall(); // Utility function to test for a path's existence. - static BOOL DoesPathExist(const TCHAR *path_name); + static BOOL DoesPathExist(const TCHAR* path_name); // Client callback. static void ClientDumpCallback( - void *dump_context, - const google_breakpad::ClientInfo *client_info, - const std::wstring *dump_path); + void* dump_context, + const google_breakpad::ClientInfo* client_info, + const std::wstring* dump_path); static bool DumpCallback(const wchar_t* dump_path, const wchar_t* minidump_id, @@ -141,7 +141,7 @@ void ExceptionHandlerTest::TearDown() { } } -BOOL ExceptionHandlerTest::DoesPathExist(const TCHAR *path_name) { +BOOL ExceptionHandlerTest::DoesPathExist(const TCHAR* path_name) { DWORD flags = GetFileAttributes(path_name); if (flags == INVALID_FILE_ATTRIBUTES) { return FALSE; @@ -151,9 +151,9 @@ BOOL ExceptionHandlerTest::DoesPathExist(const TCHAR *path_name) { // static void ExceptionHandlerTest::ClientDumpCallback( - void *dump_context, - const google_breakpad::ClientInfo *client_info, - const wstring *dump_path) { + void* dump_context, + const google_breakpad::ClientInfo* client_info, + const wstring* dump_path) { dump_file = *dump_path; // Create the full dump file name from the dump path. full_dump_file = dump_file.substr(0, dump_file.length() - 4) + L"-full.dmp"; @@ -174,7 +174,7 @@ bool ExceptionHandlerTest::DumpCallback(const wchar_t* dump_path, } void ExceptionHandlerTest::DoCrashInvalidParameter() { - google_breakpad::ExceptionHandler *exc = + google_breakpad::ExceptionHandler* exc = new google_breakpad::ExceptionHandler( temp_path_, NULL, NULL, NULL, google_breakpad::ExceptionHandler::HANDLER_INVALID_PARAMETER, @@ -206,7 +206,7 @@ struct PureVirtualCall : public PureVirtualCallBase { }; void ExceptionHandlerTest::DoCrashPureVirtualCall() { - google_breakpad::ExceptionHandler *exc = + google_breakpad::ExceptionHandler* exc = new google_breakpad::ExceptionHandler( temp_path_, NULL, NULL, NULL, google_breakpad::ExceptionHandler::HANDLER_PURECALL, -- cgit v1.2.1