diff options
Diffstat (limited to 'src/client/mac')
25 files changed, 458 insertions, 461 deletions
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/<kDefaultLibrarySubdirectory>/<Product Name> 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<CrashGenerationServer*>(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<nlist64> { template<typename nlist_type> 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 <typename nlist_type> -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<typename nlist_type> -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<nlist_type>::mach_header_type mach_header_type; typedef typename MachBits<nlist_type>::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 <mach/machine.h> -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<uint8_t> &bytes) { + vector<uint8_t>& 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<const struct load_command *>(header + 1); + const struct load_command* cmd = + reinterpret_cast<const struct load_command*>(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<const mach_segment_command_type *>(cmd); + const mach_segment_command_type* seg = + reinterpret_cast<const mach_segment_command_type*>(cmd); if (!strcmp(seg->segname, "__TEXT")) { image.vmaddr_ = static_cast<mach_vm_address_t>(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<const struct dylib_command *>(cmd); + const struct dylib_command* dc = + reinterpret_cast<const struct dylib_command*>(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<const struct load_command *> - (reinterpret_cast<const char *>(cmd) + cmd->cmdsize); + cmd = reinterpret_cast<const struct load_command*> + (reinterpret_cast<const char*>(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<MachO64>(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_image_infos*>(&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_image_info*>(&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<uint8_t> 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_type*>(&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<typename MachBits> @@ -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<DynamicImageRef*>(this)->p) < (*const_cast<DynamicImageRef&>(inRef).p); } - bool operator==(const DynamicImageRef &inInfo) const { + bool operator==(const DynamicImageRef& inInfo) const { return (*const_cast<DynamicImageRef*>(this)->p).GetLoadAddress() == (*const_cast<DynamicImageRef&>(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<int>(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<uint8_t> &bytes); + vector<uint8_t>& 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<time_t *>(&(header_ptr->time_date_stamp))); + time(reinterpret_cast<time_t*>(&(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<const void *>(start_addr), size); + result = memory.Copy(reinterpret_cast<const void*>(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<arm_thread_state_t *>(state); + MDMemoryDescriptor* stack_location) { + arm_thread_state_t* machine_state = + reinterpret_cast<arm_thread_state_t*>(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<arm_thread_state_t *>(state); + arm_thread_state_t* machine_state = + reinterpret_cast<arm_thread_state_t*>(state); return REGISTER_FROM_THREADSTATE(machine_state, pc); } bool MinidumpGenerator::WriteContextARM(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location) + MDLocationDescriptor* register_location) { TypedMDRVA<MDRawContextARM> context(&writer_); - arm_thread_state_t *machine_state = - reinterpret_cast<arm_thread_state_t *>(state); + arm_thread_state_t* machine_state = + reinterpret_cast<arm_thread_state_t*>(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<arm_thread_state64_t *>(state); + MDMemoryDescriptor* stack_location) { + arm_thread_state64_t* machine_state = + reinterpret_cast<arm_thread_state64_t*>(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<arm_thread_state64_t *>(state); + arm_thread_state64_t* machine_state = + reinterpret_cast<arm_thread_state64_t*>(state); return REGISTER_FROM_THREADSTATE(machine_state, pc); } bool MinidumpGenerator::WriteContextARM64(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location) + MDLocationDescriptor* register_location) { TypedMDRVA<MDRawContextARM64_Old> context(&writer_); - arm_thread_state64_t *machine_state = - reinterpret_cast<arm_thread_state64_t *>(state); + arm_thread_state64_t* machine_state = + reinterpret_cast<arm_thread_state64_t*>(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<ppc_thread_state_t *>(state); + MDMemoryDescriptor* stack_location) { + ppc_thread_state_t* machine_state = + reinterpret_cast<ppc_thread_state_t*>(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<ppc_thread_state64_t *>(state); + MDMemoryDescriptor* stack_location) { + ppc_thread_state64_t* machine_state = + reinterpret_cast<ppc_thread_state64_t*>(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<ppc_thread_state_t *>(state); + ppc_thread_state_t* machine_state = + reinterpret_cast<ppc_thread_state_t*>(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<ppc_thread_state64_t *>(state); + ppc_thread_state64_t* machine_state = + reinterpret_cast<ppc_thread_state64_t*>(state); return REGISTER_FROM_THREADSTATE(machine_state, srr0); } bool MinidumpGenerator::WriteContextPPC(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location) + MDLocationDescriptor* register_location) { TypedMDRVA<MDRawContextPPC> context(&writer_); - ppc_thread_state_t *machine_state = - reinterpret_cast<ppc_thread_state_t *>(state); + ppc_thread_state_t* machine_state = + reinterpret_cast<ppc_thread_state_t*>(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<MDRawContextPPC64> context(&writer_); - ppc_thread_state64_t *machine_state = - reinterpret_cast<ppc_thread_state64_t *>(state); + ppc_thread_state64_t* machine_state = + reinterpret_cast<ppc_thread_state64_t*>(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<i386_thread_state_t *>(state); + MDMemoryDescriptor* stack_location) { + i386_thread_state_t* machine_state = + reinterpret_cast<i386_thread_state_t*>(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<x86_thread_state64_t *>(state); + MDMemoryDescriptor* stack_location) { + x86_thread_state64_t* machine_state = + reinterpret_cast<x86_thread_state64_t*>(state); mach_vm_address_t start_addr = static_cast<mach_vm_address_t>( 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<i386_thread_state_t *>(state); + i386_thread_state_t* machine_state = + reinterpret_cast<i386_thread_state_t*>(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<x86_thread_state64_t *>(state); + x86_thread_state64_t* machine_state = + reinterpret_cast<x86_thread_state64_t*>(state); return REGISTER_FROM_THREADSTATE(machine_state, rip); } bool MinidumpGenerator::WriteContextX86(breakpad_thread_state_data_t state, - MDLocationDescriptor *register_location) + MDLocationDescriptor* register_location) { TypedMDRVA<MDRawContextX86> context(&writer_); - i386_thread_state_t *machine_state = - reinterpret_cast<i386_thread_state_t *>(state); + i386_thread_state_t* machine_state = + reinterpret_cast<i386_thread_state_t*>(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<MDRawContextAMD64> context(&writer_); - x86_thread_state64_t *machine_state = - reinterpret_cast<x86_thread_state64_t *>(state); + x86_thread_state64_t* machine_state = + reinterpret_cast<x86_thread_state64_t*>(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<mach_msg_type_number_t>(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<MDRawThreadList> 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<MDRawMemoryList> 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<const void *>(ip_memory_d.start_of_memory_range), + reinterpret_cast<const void*>(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<MDRawExceptionStream> 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<MDRawSystemInfo> 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<const struct load_command *>(header + 1); + const struct load_command* cmd = + reinterpret_cast<const struct load_command*>(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<const breakpad_mach_segment_command *>(cmd); + const breakpad_mach_segment_command* seg = + reinterpret_cast<const breakpad_mach_segment_command*>(cmd); if (!strcmp(seg->segname, "__TEXT")) { MDLocationDescriptor string_location; @@ -1389,7 +1389,7 @@ bool MinidumpGenerator::WriteModuleStream(unsigned int index, } } - cmd = reinterpret_cast<struct load_command*>((char *)cmd + cmd->cmdsize); + cmd = reinterpret_cast<struct load_command*>((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<MDCVInfoPDB70> 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<void *>(module->base_of_image), + reinterpret_cast<void*>(module->base_of_image), static_cast<size_t>(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<MDRawModuleList> 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<MDRawMiscInfo> 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<uint32_t>(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<MDRawBreakpadInfo> 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 <dir>/<unique_name>.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<void*>(&test2); + void* addr = reinterpret_cast<void*>(&test2); std::vector<uint8_t> 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 <Cocoa/Cocoa.h> 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<CrashGenerationServerTest*>(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<ExceptionHandlerTest*>(context); +static bool DumpNameMDCallback(const char* dump_dir, const char* file_name, + void* context, bool success) { + ExceptionHandlerTest* self = reinterpret_cast<ExceptionHandlerTest*>(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<bool*>(data); while (!*wait) { usleep(10000); |