diff options
author | Mike Frysinger <vapier@chromium.org> | 2020-06-23 18:55:43 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@chromium.org> | 2020-07-15 06:20:02 +0000 |
commit | 09b056975dacd1f0f815ad820b6dc9913b0118a3 (patch) | |
tree | 67ba67549b44e6d98b9ff2dfb3e0396e0a252b96 /src/client/mac/handler | |
parent | Add support for dwarf5 line tables. (diff) | |
download | breakpad-09b056975dacd1f0f815ad820b6dc9913b0118a3.tar.xz |
fix pointer style to match the style guide
We do this in a lot of places, but we're inconsistent.
Normalize the code to the Google C++ style guide.
Change-Id: Ic2aceab661ce8f6b993dda21b1cdf5d2198dcbbf
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2262932
Reviewed-by: Sterling Augustine <saugustine@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Diffstat (limited to 'src/client/mac/handler')
-rw-r--r-- | src/client/mac/handler/breakpad_nlist_64.cc | 77 | ||||
-rw-r--r-- | src/client/mac/handler/breakpad_nlist_64.h | 12 | ||||
-rw-r--r-- | src/client/mac/handler/dynamic_images.cc | 44 | ||||
-rw-r--r-- | src/client/mac/handler/dynamic_images.h | 26 | ||||
-rw-r--r-- | src/client/mac/handler/exception_handler.cc | 6 | ||||
-rw-r--r-- | src/client/mac/handler/exception_handler.h | 62 | ||||
-rw-r--r-- | src/client/mac/handler/minidump_generator.cc | 184 | ||||
-rw-r--r-- | src/client/mac/handler/minidump_generator.h | 70 | ||||
-rw-r--r-- | src/client/mac/handler/testcases/DynamicImagesTests.cc | 6 | ||||
-rw-r--r-- | src/client/mac/handler/testcases/breakpad_nlist_test.cc | 12 | ||||
-rw-r--r-- | src/client/mac/handler/testcases/breakpad_nlist_test.h | 2 |
11 files changed, 249 insertions, 252 deletions
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); |