From 09b056975dacd1f0f815ad820b6dc9913b0118a3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 23 Jun 2020 18:55:43 -0400 Subject: fix pointer style to match the style guide We do this in a lot of places, but we're inconsistent. Normalize the code to the Google C++ style guide. Change-Id: Ic2aceab661ce8f6b993dda21b1cdf5d2198dcbbf Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2262932 Reviewed-by: Sterling Augustine Reviewed-by: Mark Mentovai --- src/client/solaris/handler/exception_handler.cc | 22 +-- src/client/solaris/handler/exception_handler.h | 32 ++-- .../solaris/handler/exception_handler_test.cc | 14 +- src/client/solaris/handler/minidump_generator.cc | 176 ++++++++++----------- src/client/solaris/handler/minidump_generator.h | 8 +- src/client/solaris/handler/minidump_test.cc | 2 +- src/client/solaris/handler/solaris_lwp.cc | 72 ++++----- src/client/solaris/handler/solaris_lwp.h | 16 +- 8 files changed, 171 insertions(+), 171 deletions(-) (limited to 'src/client/solaris') diff --git a/src/client/solaris/handler/exception_handler.cc b/src/client/solaris/handler/exception_handler.cc index 7fc8d255..c96683f6 100644 --- a/src/client/solaris/handler/exception_handler.cc +++ b/src/client/solaris/handler/exception_handler.cc @@ -54,15 +54,15 @@ static const int kSigTable[] = { SIGBUS }; -std::vector *ExceptionHandler::handler_stack_ = NULL; +std::vector* ExceptionHandler::handler_stack_ = NULL; int ExceptionHandler::handler_stack_index_ = 0; pthread_mutex_t ExceptionHandler::handler_stack_mutex_ = PTHREAD_MUTEX_INITIALIZER; -ExceptionHandler::ExceptionHandler(const string &dump_path, +ExceptionHandler::ExceptionHandler(const string& dump_path, FilterCallback filter, MinidumpCallback callback, - void *callback_context, + void* callback_context, bool install_handler) : filter_(filter), callback_(callback), @@ -79,7 +79,7 @@ ExceptionHandler::ExceptionHandler(const string &dump_path, pthread_mutex_lock(&handler_stack_mutex_); if (handler_stack_ == NULL) - handler_stack_ = new std::vector; + handler_stack_ = new std::vector; handler_stack_->push_back(this); pthread_mutex_unlock(&handler_stack_mutex_); } @@ -92,7 +92,7 @@ ExceptionHandler::~ExceptionHandler() { handler_stack_->pop_back(); } else { print_message1(2, "warning: removing Breakpad handler out of order\n"); - for (std::vector::iterator iterator = + for (std::vector::iterator iterator = handler_stack_->begin(); iterator != handler_stack_->end(); ++iterator) { @@ -116,9 +116,9 @@ bool ExceptionHandler::WriteMinidump() { } // static -bool ExceptionHandler::WriteMinidump(const string &dump_path, +bool ExceptionHandler::WriteMinidump(const string& dump_path, MinidumpCallback callback, - void *callback_context) { + void* callback_context) { ExceptionHandler handler(dump_path, NULL, callback, callback_context, false); return handler.InternalWriteMinidump(0, 0, NULL); @@ -166,7 +166,7 @@ void ExceptionHandler::TeardownAllHandlers() { // static void ExceptionHandler::HandleException(int signo) { -//void ExceptionHandler::HandleException(int signo, siginfo_t *sip, ucontext_t *sig_ctx) { +//void ExceptionHandler::HandleException(int signo, siginfo_t* sip, ucontext_t* sig_ctx) { // The context information about the signal is put on the stack of // the signal handler frame as value parameter. For some reasons, the // prototype of the handler doesn't declare this information as parameter, we @@ -181,14 +181,14 @@ void ExceptionHandler::HandleException(int signo) { uintptr_t current_ebp = (uintptr_t)_getfp(); pthread_mutex_lock(&handler_stack_mutex_); - ExceptionHandler *current_handler = + ExceptionHandler* current_handler = handler_stack_->at(handler_stack_->size() - ++handler_stack_index_); pthread_mutex_unlock(&handler_stack_mutex_); // Restore original handler. current_handler->TeardownHandler(signo); - ucontext_t *sig_ctx = NULL; + ucontext_t* sig_ctx = NULL; if (current_handler->InternalWriteMinidump(signo, current_ebp, &sig_ctx)) { // if (current_handler->InternalWriteMinidump(signo, &sig_ctx)) { // Fully handled this exception, safe to exit. @@ -218,7 +218,7 @@ void ExceptionHandler::HandleException(int signo) { bool ExceptionHandler::InternalWriteMinidump(int signo, uintptr_t sighandler_ebp, - ucontext_t **sig_ctx) { + ucontext_t** sig_ctx) { if (filter_ && !filter_(callback_context_)) return false; diff --git a/src/client/solaris/handler/exception_handler.h b/src/client/solaris/handler/exception_handler.h index 4d72485f..cd6c85ea 100644 --- a/src/client/solaris/handler/exception_handler.h +++ b/src/client/solaris/handler/exception_handler.h @@ -79,7 +79,7 @@ class ExceptionHandler { // attempting to write a minidump. If a FilterCallback returns false, // Breakpad will immediately report the exception as unhandled without // writing a minidump, allowing another handler the opportunity to handle it. - typedef bool (*FilterCallback)(void *context); + typedef bool (*FilterCallback)(void* context); // A callback function to run after the minidump has been written. // minidump_id is a unique id for the dump, so the minidump @@ -97,9 +97,9 @@ class ExceptionHandler { // should normally return the value of |succeeded|, or when they wish to // not report an exception of handled, false. Callbacks will rarely want to // return true directly (unless |succeeded| is true). - typedef bool (*MinidumpCallback)(const char *dump_path, - const char *minidump_id, - void *context, + typedef bool (*MinidumpCallback)(const char* dump_path, + const char* minidump_id, + void* context, bool succeeded); // Creates a new ExceptionHandler instance to handle writing minidumps. @@ -110,15 +110,15 @@ class ExceptionHandler { // If install_handler is true, then a minidump will be written whenever // an unhandled exception occurs. If it is false, minidumps will only // be written when WriteMinidump is called. - ExceptionHandler(const string &dump_path, + ExceptionHandler(const string& dump_path, FilterCallback filter, MinidumpCallback callback, - void *callback_context, + void* callback_context, bool install_handler); ~ExceptionHandler(); // Get and Set the minidump path. string dump_path() const { return dump_path_; } - void set_dump_path(const string &dump_path) { + void set_dump_path(const string& dump_path) { dump_path_ = dump_path; dump_path_c_ = dump_path_.c_str(); } @@ -129,9 +129,9 @@ class ExceptionHandler { // Convenience form of WriteMinidump which does not require an // ExceptionHandler instance. - static bool WriteMinidump(const string &dump_path, + static bool WriteMinidump(const string& dump_path, MinidumpCallback callback, - void *callback_context); + void* callback_context); private: // Setup crash handler. @@ -144,7 +144,7 @@ class ExceptionHandler { void TeardownAllHandlers(); // Runs the main loop for the exception handler thread. - static void* ExceptionHandlerThreadMain(void *lpParameter); + static void* ExceptionHandlerThreadMain(void* lpParameter); // Signal handler. static void HandleException(int signo); @@ -157,20 +157,20 @@ class ExceptionHandler { // for the second and third parameters if you are not calling // this from a signal handler. bool InternalWriteMinidump(int signo, uintptr_t sighandler_ebp, - ucontext_t **sig_ctx); + ucontext_t** sig_ctx); private: // The callbacks before and after writing the dump file. FilterCallback filter_; MinidumpCallback callback_; - void *callback_context_; + void* callback_context_; // The directory in which a minidump will be written, set by the dump_path // argument to the constructor, or set_dump_path. string dump_path_; // C style dump path. Keep this when setting dump path, since calling // c_str() of std::string when crashing may not be safe. - const char *dump_path_c_; + const char* dump_path_c_; // True if the ExceptionHandler installed an unhandled exception filter // when created (with an install_handler parameter set to true). @@ -183,7 +183,7 @@ class ExceptionHandler { // The global exception handler stack. This is need becuase there may exist // multiple ExceptionHandler instances in a process. Each will have itself // registered in this stack. - static std::vector *handler_stack_; + static std::vector* handler_stack_; // The index of the handler that should handle the next exception. static int handler_stack_index_; static pthread_mutex_t handler_stack_mutex_; @@ -192,8 +192,8 @@ class ExceptionHandler { MinidumpGenerator minidump_generator_; // disallow copy ctor and operator= - explicit ExceptionHandler(const ExceptionHandler &); - void operator=(const ExceptionHandler &); + explicit ExceptionHandler(const ExceptionHandler&); + void operator=(const ExceptionHandler&); }; } // namespace google_breakpad diff --git a/src/client/solaris/handler/exception_handler_test.cc b/src/client/solaris/handler/exception_handler_test.cc index 6bb8e18d..4d2b33fa 100644 --- a/src/client/solaris/handler/exception_handler_test.cc +++ b/src/client/solaris/handler/exception_handler_test.cc @@ -49,7 +49,7 @@ static int foo2(int arg) { // Stack variable, used for debugging stack dumps. int c = 0xcccccccc; fprintf(stderr, "Thread trying to crash: %x\n", getpid()); - c = *reinterpret_cast(0x5); + c = *reinterpret_cast(0x5); return c; } @@ -60,7 +60,7 @@ static int foo(int arg) { return b; } -static void *thread_crash(void *) { +static void* thread_crash(void*) { // Stack variable, used for debugging stack dumps. int a = 0xaaaaaaaa; sleep(3); @@ -69,7 +69,7 @@ static void *thread_crash(void *) { return NULL; } -static void *thread_main(void *) { +static void* thread_main(void*) { while (!should_exit) sleep(1); return NULL; @@ -91,9 +91,9 @@ static void CreateThread(int num) { } // Callback when minidump written. -static bool MinidumpCallback(const char *dump_path, - const char *minidump_id, - void *context, +static bool MinidumpCallback(const char* dump_path, + const char* minidump_id, + void* context, bool succeeded) { int index = reinterpret_cast(context); if (index == 0) { @@ -104,7 +104,7 @@ static bool MinidumpCallback(const char *dump_path, return false; } -int main(int argc, char *argv[]) { +int main(int argc, char* argv[]) { int handler_index = 1; ExceptionHandler handler_ignore(".", NULL, MinidumpCallback, (void*)handler_index, true); diff --git a/src/client/solaris/handler/minidump_generator.cc b/src/client/solaris/handler/minidump_generator.cc index 7485025f..56756665 100644 --- a/src/client/solaris/handler/minidump_generator.cc +++ b/src/client/solaris/handler/minidump_generator.cc @@ -50,7 +50,7 @@ using namespace google_breakpad; // Argument for the writer function. struct WriterArgument { - MinidumpFileWriter *minidump_writer; + MinidumpFileWriter* minidump_writer; // Pid of the lwp who called WriteMinidumpToFile int requester_pid; @@ -73,15 +73,15 @@ struct WriterArgument { // User context when crash happens. Can be NULL if this is a requested dump. // This is actually an out parameter, but it will be filled in at the start // of the writer LWP. - ucontext_t *sig_ctx; + ucontext_t* sig_ctx; // Used to get information about the lwps. - SolarisLwp *lwp_lister; + SolarisLwp* lwp_lister; }; // Holding context information for the callback of finding the crashing lwp. struct FindCrashLwpContext { - const SolarisLwp *lwp_lister; + const SolarisLwp* lwp_lister; uintptr_t crashing_stack_bottom; int crashing_lwpid; @@ -96,11 +96,11 @@ struct FindCrashLwpContext { // It will compare the stack bottom of the provided lwp with the stack // bottom of the crashed lwp, it they are eqaul, this lwp is the one // who crashed. -bool IsLwpCrashedCallback(lwpstatus_t *lsp, void *context) { - FindCrashLwpContext *crashing_context = - static_cast(context); - const SolarisLwp *lwp_lister = crashing_context->lwp_lister; - const prgregset_t *gregs = &(lsp->pr_reg); +bool IsLwpCrashedCallback(lwpstatus_t* lsp, void* context) { + FindCrashLwpContext* crashing_context = + static_cast(context); + const SolarisLwp* lwp_lister = crashing_context->lwp_lister; + const prgregset_t* gregs = &(lsp->pr_reg); #if TARGET_CPU_SPARC uintptr_t last_ebp = (*gregs)[R_FP]; #elif TARGET_CPU_X86 @@ -121,7 +121,7 @@ bool IsLwpCrashedCallback(lwpstatus_t *lsp, void *context) { // This is done based on stack bottom comparing. int FindCrashingLwp(uintptr_t crashing_stack_bottom, int requester_pid, - const SolarisLwp *lwp_lister) { + const SolarisLwp* lwp_lister) { FindCrashLwpContext context; context.lwp_lister = lwp_lister; context.crashing_stack_bottom = crashing_stack_bottom; @@ -131,17 +131,17 @@ int FindCrashingLwp(uintptr_t crashing_stack_bottom, return context.crashing_lwpid; } -bool WriteLwpStack(const SolarisLwp *lwp_lister, +bool WriteLwpStack(const SolarisLwp* lwp_lister, uintptr_t last_esp, - UntypedMDRVA *memory, - MDMemoryDescriptor *loc) { + UntypedMDRVA* memory, + MDMemoryDescriptor* loc) { uintptr_t stack_bottom = lwp_lister->GetLwpStackBottom(last_esp); if (stack_bottom >= last_esp) { int size = stack_bottom - last_esp; if (size > 0) { if (!memory->Allocate(size)) return false; - memory->Copy(reinterpret_cast(last_esp), size); + memory->Copy(reinterpret_cast(last_esp), size); loc->start_of_memory_range = last_esp; loc->memory = memory->location(); } @@ -151,7 +151,7 @@ bool WriteLwpStack(const SolarisLwp *lwp_lister, } #if TARGET_CPU_SPARC -bool WriteContext(MDRawContextSPARC *context, ucontext_t *sig_ctx) { +bool WriteContext(MDRawContextSPARC* context, ucontext_t* sig_ctx) { assert(sig_ctx != NULL); int* regs = sig_ctx->uc_mcontext.gregs; context->context_flags = MD_CONTEXT_SPARC_FULL; @@ -170,13 +170,13 @@ bool WriteContext(MDRawContextSPARC *context, ucontext_t *sig_ctx) { for ( int i = 1 ; i < 16; ++i ) { context->g_r[i] = (uintptr_t)(sig_ctx->uc_mcontext.gregs[i + 3]); } - context->g_r[30] = (uintptr_t)(((struct frame *)context->g_r[14])->fr_savfp); + context->g_r[30] = (uintptr_t)(((struct frame*)context->g_r[14])->fr_savfp); return true; } -bool WriteContext(MDRawContextSPARC *context, prgregset_t regs, - prfpregset_t *fp_regs) { +bool WriteContext(MDRawContextSPARC* context, prgregset_t regs, + prfpregset_t* fp_regs) { if (!context || !regs) return false; @@ -195,8 +195,8 @@ bool WriteContext(MDRawContextSPARC *context, prgregset_t regs, return true; } #elif TARGET_CPU_X86 -bool WriteContext(MDRawContextX86 *context, prgregset_t regs, - prfpregset_t *fp_regs) { +bool WriteContext(MDRawContextX86* context, prgregset_t regs, + prfpregset_t* fp_regs) { if (!context || !regs) return false; @@ -228,10 +228,10 @@ bool WriteContext(MDRawContextX86 *context, prgregset_t regs, // signal. This makes the current stack not reliable, and our stack walker // won't figure out the whole call stack for this. So we write the stack at the // time of the crash into the minidump file, not the current stack. -bool WriteCrashedLwpStream(MinidumpFileWriter *minidump_writer, - const WriterArgument *writer_args, - const lwpstatus_t *lsp, - MDRawThread *lwp) { +bool WriteCrashedLwpStream(MinidumpFileWriter* minidump_writer, + const WriterArgument* writer_args, + const lwpstatus_t* lsp, + MDRawThread* lwp) { assert(writer_args->sig_ctx != NULL); lwp->thread_id = lsp->pr_lwpid; @@ -264,16 +264,16 @@ bool WriteCrashedLwpStream(MinidumpFileWriter *minidump_writer, lwp->thread_context = context.location(); memset(context.get(), 0, sizeof(MDRawContextX86)); return WriteContext(context.get(), - (int *)&writer_args->sig_ctx->uc_mcontext.gregs, + (int*)&writer_args->sig_ctx->uc_mcontext.gregs, &writer_args->sig_ctx->uc_mcontext.fpregs); #endif } -bool WriteLwpStream(MinidumpFileWriter *minidump_writer, - const SolarisLwp *lwp_lister, - const lwpstatus_t *lsp, MDRawThread *lwp) { +bool WriteLwpStream(MinidumpFileWriter* minidump_writer, + const SolarisLwp* lwp_lister, + const lwpstatus_t* lsp, MDRawThread* lwp) { prfpregset_t fp_regs = lsp->pr_fpreg; - const prgregset_t *gregs = &(lsp->pr_reg); + const prgregset_t* gregs = &(lsp->pr_reg); UntypedMDRVA memory(minidump_writer); #if TARGET_CPU_SPARC if (!WriteLwpStack(lwp_lister, @@ -306,10 +306,10 @@ bool WriteLwpStream(MinidumpFileWriter *minidump_writer, lwp->thread_context = context.location(); memset(context.get(), 0, sizeof(MDRawContextX86)); #endif /* TARGET_CPU_XXX */ - return WriteContext(context.get(), (int *)gregs, &fp_regs); + return WriteContext(context.get(), (int*)gregs, &fp_regs); } -bool WriteCPUInformation(MDRawSystemInfo *sys_info) { +bool WriteCPUInformation(MDRawSystemInfo* sys_info) { struct utsname uts; char *major, *minor, *build; @@ -337,8 +337,8 @@ bool WriteCPUInformation(MDRawSystemInfo *sys_info) { return true; } -bool WriteOSInformation(MinidumpFileWriter *minidump_writer, - MDRawSystemInfo *sys_info) { +bool WriteOSInformation(MinidumpFileWriter* minidump_writer, + MDRawSystemInfo* sys_info) { sys_info->platform_id = MD_OS_SOLARIS; struct utsname uts; @@ -346,7 +346,7 @@ bool WriteOSInformation(MinidumpFileWriter *minidump_writer, char os_version[512]; size_t space_left = sizeof(os_version); memset(os_version, 0, space_left); - const char *os_info_table[] = { + const char* os_info_table[] = { uts.sysname, uts.release, uts.version, @@ -354,7 +354,7 @@ bool WriteOSInformation(MinidumpFileWriter *minidump_writer, "OpenSolaris", NULL }; - for (const char **cur_os_info = os_info_table; + for (const char** cur_os_info = os_info_table; *cur_os_info != NULL; ++cur_os_info) { if (cur_os_info != os_info_table && space_left > 1) { @@ -379,21 +379,21 @@ bool WriteOSInformation(MinidumpFileWriter *minidump_writer, // Callback context for get writting lwp information. struct LwpInfoCallbackCtx { - MinidumpFileWriter *minidump_writer; - const WriterArgument *writer_args; - TypedMDRVA *list; + MinidumpFileWriter* minidump_writer; + const WriterArgument* writer_args; + TypedMDRVA* list; int lwp_index; }; -bool LwpInformationCallback(lwpstatus_t *lsp, void *context) { +bool LwpInformationCallback(lwpstatus_t* lsp, void* context) { bool success = true; - LwpInfoCallbackCtx *callback_context = - static_cast(context); + LwpInfoCallbackCtx* callback_context = + static_cast(context); // The current lwp is the one to handle the crash. Ignore it. if (lsp->pr_lwpid != pthread_self()) { - LwpInfoCallbackCtx *callback_context = - static_cast(context); + LwpInfoCallbackCtx* callback_context = + static_cast(context); MDRawThread lwp; memset(&lwp, 0, sizeof(MDRawThread)); @@ -417,11 +417,11 @@ bool LwpInformationCallback(lwpstatus_t *lsp, void *context) { return success; } -bool WriteLwpListStream(MinidumpFileWriter *minidump_writer, - const WriterArgument *writer_args, - MDRawDirectory *dir) { +bool WriteLwpListStream(MinidumpFileWriter* minidump_writer, + const WriterArgument* writer_args, + MDRawDirectory* dir) { // Get the lwp information. - const SolarisLwp *lwp_lister = writer_args->lwp_lister; + const SolarisLwp* lwp_lister = writer_args->lwp_lister; int lwp_count = lwp_lister->GetLwpCount(); if (lwp_count < 0) return false; @@ -444,14 +444,14 @@ bool WriteLwpListStream(MinidumpFileWriter *minidump_writer, return written == lwp_count; } -bool WriteCVRecord(MinidumpFileWriter *minidump_writer, - MDRawModule *module, - const char *module_path, - char *realname) { +bool WriteCVRecord(MinidumpFileWriter* minidump_writer, + MDRawModule* module, + const char* module_path, + char* realname) { TypedMDRVA cv(minidump_writer); char path[PATH_MAX]; - const char *module_name = module_path ? module_path : ""; + const char* module_name = module_path ? module_path : ""; snprintf(path, sizeof(path), "/proc/self/object/%s", module_name); size_t module_name_length = strlen(realname); @@ -461,7 +461,7 @@ bool WriteCVRecord(MinidumpFileWriter *minidump_writer, return false; module->cv_record = cv.location(); - MDCVInfoPDB70 *cv_ptr = cv.get(); + MDCVInfoPDB70* cv_ptr = cv.get(); memset(cv_ptr, 0, sizeof(MDCVInfoPDB70)); cv_ptr->cv_signature = MD_CVINFOPDB70_SIGNATURE; cv_ptr->age = 0; @@ -489,15 +489,15 @@ bool WriteCVRecord(MinidumpFileWriter *minidump_writer, } struct ModuleInfoCallbackCtx { - MinidumpFileWriter *minidump_writer; - const WriterArgument *writer_args; - TypedMDRVA *list; + MinidumpFileWriter* minidump_writer; + const WriterArgument* writer_args; + TypedMDRVA* list; int module_index; }; -bool ModuleInfoCallback(const ModuleInfo &module_info, void *context) { - ModuleInfoCallbackCtx *callback_context = - static_cast(context); +bool ModuleInfoCallback(const ModuleInfo& module_info, void* context) { + ModuleInfoCallbackCtx* callback_context = + static_cast(context); // Skip those modules without name, or those that are not modules. if (strlen(module_info.name) == 0) return true; @@ -507,7 +507,7 @@ bool ModuleInfoCallback(const ModuleInfo &module_info, void *context) { MDLocationDescriptor loc; char path[PATH_MAX]; char buf[PATH_MAX]; - char *realname; + char* realname; int count; snprintf(path, sizeof (path), "/proc/self/path/%s", module_info.name); @@ -535,9 +535,9 @@ bool ModuleInfoCallback(const ModuleInfo &module_info, void *context) { return true; } -bool WriteModuleListStream(MinidumpFileWriter *minidump_writer, - const WriterArgument *writer_args, - MDRawDirectory *dir) { +bool WriteModuleListStream(MinidumpFileWriter* minidump_writer, + const WriterArgument* writer_args, + MDRawDirectory* dir) { TypedMDRVA list(minidump_writer); int module_count = writer_args->lwp_lister->GetModuleCount(); @@ -558,9 +558,9 @@ bool WriteModuleListStream(MinidumpFileWriter *minidump_writer, return writer_args->lwp_lister->ListModules(&callback) == module_count; } -bool WriteSystemInfoStream(MinidumpFileWriter *minidump_writer, - const WriterArgument *writer_args, - MDRawDirectory *dir) { +bool WriteSystemInfoStream(MinidumpFileWriter* minidump_writer, + const WriterArgument* writer_args, + MDRawDirectory* dir) { TypedMDRVA sys_info(minidump_writer); if (!sys_info.Allocate()) @@ -573,9 +573,9 @@ bool WriteSystemInfoStream(MinidumpFileWriter *minidump_writer, WriteOSInformation(minidump_writer, sys_info.get()); } -bool WriteExceptionStream(MinidumpFileWriter *minidump_writer, - const WriterArgument *writer_args, - MDRawDirectory *dir) { +bool WriteExceptionStream(MinidumpFileWriter* minidump_writer, + const WriterArgument* writer_args, + MDRawDirectory* dir) { // This happenes when this is not a crash, but a requested dump. if (writer_args->sig_ctx == NULL) return false; @@ -620,14 +620,14 @@ bool WriteExceptionStream(MinidumpFileWriter *minidump_writer, exception.get()->thread_context = context.location(); memset(context.get(), 0, sizeof(MDRawContextX86)); return WriteContext(context.get(), - (int *)&writer_args->sig_ctx->uc_mcontext.gregs, + (int*)&writer_args->sig_ctx->uc_mcontext.gregs, NULL); #endif } -bool WriteMiscInfoStream(MinidumpFileWriter *minidump_writer, - const WriterArgument *writer_args, - MDRawDirectory *dir) { +bool WriteMiscInfoStream(MinidumpFileWriter* minidump_writer, + const WriterArgument* writer_args, + MDRawDirectory* dir) { TypedMDRVA info(minidump_writer); if (!info.Allocate()) @@ -642,9 +642,9 @@ bool WriteMiscInfoStream(MinidumpFileWriter *minidump_writer, return true; } -bool WriteBreakpadInfoStream(MinidumpFileWriter *minidump_writer, - const WriterArgument *writer_args, - MDRawDirectory *dir) { +bool WriteBreakpadInfoStream(MinidumpFileWriter* minidump_writer, + const WriterArgument* writer_args, + MDRawDirectory* dir) { TypedMDRVA info(minidump_writer); if (!info.Allocate()) @@ -662,16 +662,16 @@ bool WriteBreakpadInfoStream(MinidumpFileWriter *minidump_writer, class AutoLwpResumer { public: - AutoLwpResumer(SolarisLwp *lwp) : lwp_(lwp) {} + AutoLwpResumer(SolarisLwp* lwp) : lwp_(lwp) {} ~AutoLwpResumer() { lwp_->ControlAllLwps(false); } private: - SolarisLwp *lwp_; + SolarisLwp* lwp_; }; // Prototype of writer functions. -typedef bool (*WriteStreamFN)(MinidumpFileWriter *, - const WriterArgument *, - MDRawDirectory *); +typedef bool (*WriteStreamFN)(MinidumpFileWriter*, + const WriterArgument*, + MDRawDirectory*); // Function table to writer a full minidump. const WriteStreamFN writers[] = { @@ -684,9 +684,9 @@ const WriteStreamFN writers[] = { }; // Will call each writer function in the writers table. -//void* MinidumpGenerator::Write(void *argument) { -void* Write(void *argument) { - WriterArgument *writer_args = static_cast(argument); +//void* MinidumpGenerator::Write(void* argument) { +void* Write(void* argument) { + WriterArgument* writer_args = static_cast(argument); if (!writer_args->lwp_lister->ControlAllLwps(true)) return NULL; @@ -712,7 +712,7 @@ void* Write(void *argument) { writer_args->crashed_lwpid = crashed_lwpid; } - MinidumpFileWriter *minidump_writer = writer_args->minidump_writer; + MinidumpFileWriter* minidump_writer = writer_args->minidump_writer; TypedMDRVA header(minidump_writer); TypedMDRVA dir(minidump_writer); if (!header.Allocate()) @@ -750,10 +750,10 @@ MinidumpGenerator::~MinidumpGenerator() { // Write minidump into file. // It runs in a different thread from the crashing thread. -bool MinidumpGenerator::WriteMinidumpToFile(const char *file_pathname, +bool MinidumpGenerator::WriteMinidumpToFile(const char* file_pathname, int signo, uintptr_t sighandler_ebp, - ucontext_t **sig_ctx) const { + ucontext_t** sig_ctx) const { // The exception handler thread. pthread_t handler_thread; @@ -775,7 +775,7 @@ bool MinidumpGenerator::WriteMinidumpToFile(const char *file_pathname, argument.sighandler_ebp = sighandler_ebp; argument.sig_ctx = NULL; - pthread_create(&handler_thread, NULL, Write, (void *)&argument); + pthread_create(&handler_thread, NULL, Write, (void*)&argument); pthread_join(handler_thread, NULL); return true; } diff --git a/src/client/solaris/handler/minidump_generator.h b/src/client/solaris/handler/minidump_generator.h index 882f9e1d..daa6fe01 100644 --- a/src/client/solaris/handler/minidump_generator.h +++ b/src/client/solaris/handler/minidump_generator.h @@ -48,10 +48,10 @@ namespace google_breakpad { // class MinidumpGenerator { // Callback run for writing lwp information in the process. - friend bool LwpInformationCallback(lwpstatus_t *lsp, void *context); + friend bool LwpInformationCallback(lwpstatus_t* lsp, void* context); // Callback run for writing module information in the process. - friend bool ModuleInfoCallback(const ModuleInfo &module_info, void *context); + friend bool ModuleInfoCallback(const ModuleInfo& module_info, void* context); public: MinidumpGenerator(); @@ -59,10 +59,10 @@ class MinidumpGenerator { ~MinidumpGenerator(); // Write minidump. - bool WriteMinidumpToFile(const char *file_pathname, + bool WriteMinidumpToFile(const char* file_pathname, int signo, uintptr_t sighandler_ebp, - ucontext_t **sig_ctx) const; + ucontext_t** sig_ctx) const; }; } // namespace google_breakpad diff --git a/src/client/solaris/handler/minidump_test.cc b/src/client/solaris/handler/minidump_test.cc index 33302d86..5f685ef2 100644 --- a/src/client/solaris/handler/minidump_test.cc +++ b/src/client/solaris/handler/minidump_test.cc @@ -40,7 +40,7 @@ using google_breakpad::MinidumpGenerator; static bool doneWritingReport = false; -static void *Reporter(void *) { +static void* Reporter(void*) { char buffer[PATH_MAX]; MinidumpGenerator md; diff --git a/src/client/solaris/handler/solaris_lwp.cc b/src/client/solaris/handler/solaris_lwp.cc index 0148997a..cb6cc8ab 100644 --- a/src/client/solaris/handler/solaris_lwp.cc +++ b/src/client/solaris/handler/solaris_lwp.cc @@ -69,10 +69,10 @@ struct AddressValidatingContext { }; // Convert from string to int. -static bool LocalAtoi(char *s, int *r) { +static bool LocalAtoi(char* s, int* r) { assert(s != NULL); assert(r != NULL); - char *endptr = NULL; + char* endptr = NULL; int ret = strtol(s, &endptr, 10); if (endptr == s) return false; @@ -82,10 +82,10 @@ static bool LocalAtoi(char *s, int *r) { // Callback invoked for each mapped module. // It uses the module's adderss range to validate the address. -static bool AddressNotInModuleCallback(const ModuleInfo &module_info, - void *context) { - AddressValidatingContext *addr = - reinterpret_cast(context); +static bool AddressNotInModuleCallback(const ModuleInfo& module_info, + void* context) { + AddressValidatingContext* addr = + reinterpret_cast(context); if (addr->is_mapped = ((module_info.start_addr > 0) && (addr->address >= module_info.start_addr) && (addr->address <= module_info.start_addr + @@ -97,16 +97,16 @@ static bool AddressNotInModuleCallback(const ModuleInfo &module_info, } static int IterateLwpAll(int pid, - CallbackParam *callback_param) { + CallbackParam* callback_param) { char lwp_path[40]; - DIR *dir; + DIR* dir; int count = 0; snprintf(lwp_path, sizeof (lwp_path), "/proc/%d/lwp", (int)pid); if ((dir = opendir(lwp_path)) == NULL) return -1; - struct dirent *entry = NULL; + struct dirent* entry = NULL; while ((entry = readdir(dir)) != NULL) { if ((strcmp(entry->d_name, ".") != 0) && (strcmp(entry->d_name, "..") != 0)) { @@ -128,22 +128,22 @@ static int IterateLwpAll(int pid, } #if defined(__i386) && !defined(NO_FRAME_POINTER) -void *GetNextFrame(void **last_ebp) { - void *sp = *last_ebp; +void* GetNextFrame(void** last_ebp) { + void* sp = *last_ebp; if ((unsigned long)sp == (unsigned long)last_ebp) return NULL; - if ((unsigned long)sp & (sizeof(void *) - 1)) + if ((unsigned long)sp & (sizeof(void*) - 1)) return NULL; if ((unsigned long)sp - (unsigned long)last_ebp > 100000) return NULL; return sp; } #elif defined(__sparc) -void *GetNextFrame(void *last_ebp) { - return reinterpret_cast(last_ebp)->fr_savfp; +void* GetNextFrame(void* last_ebp) { + return reinterpret_cast(last_ebp)->fr_savfp; } #else -void *GetNextFrame(void **last_ebp) { +void* GetNextFrame(void** last_ebp) { return reinterpret_cast(last_ebp); } #endif @@ -159,12 +159,12 @@ class AutoCloser { // Control the execution of the lwp. // Suspend/Resume lwp based on the value of context. -static bool ControlLwp(int lwpid, void *context) { +static bool ControlLwp(int lwpid, void* context) { // The current thread is the one to handle the crash. Ignore it. if (lwpid != pthread_self()) { int ctlfd; char procname[PATH_MAX]; - bool suspend = *(bool *)context; + bool suspend = *(bool*)context; // Open the /proc/$pid/lwp/$lwpid/lwpctl files snprintf(procname, sizeof (procname), "/proc/self/lwp/%d/lwpctl", lwpid); @@ -193,7 +193,7 @@ static bool ControlLwp(int lwpid, void *context) { * prheader_t at the start (/proc/$pid/lstatus or /proc/$pid/lpsinfo). * Return true on success. */ -static bool read_lfile(int pid, const char *lname, prheader_t *lhp) { +static bool read_lfile(int pid, const char* lname, prheader_t* lhp) { char lpath[PATH_MAX]; struct stat statb; int fd; @@ -242,14 +242,14 @@ int SolarisLwp::GetLwpCount() const { } int SolarisLwp::Lwp_iter_all(int pid, - CallbackParam *callback_param) const { - lwpstatus_t *Lsp; - lwpstatus_t *sp; + CallbackParam* callback_param) const { + lwpstatus_t* Lsp; + lwpstatus_t* sp; prheader_t lphp[HEADER_MAX]; prheader_t lhp[HEADER_MAX]; - prheader_t *Lphp = lphp; - prheader_t *Lhp = lhp; - lwpsinfo_t *Lpsp; + prheader_t* Lphp = lphp; + prheader_t* Lhp = lhp; + lwpsinfo_t* Lpsp; long nstat; long ninfo; int rv = 0; @@ -264,13 +264,13 @@ int SolarisLwp::Lwp_iter_all(int pid, return -1; } - Lsp = (lwpstatus_t *)(uintptr_t)(Lhp + 1); - Lpsp = (lwpsinfo_t *)(uintptr_t)(Lphp + 1); + Lsp = (lwpstatus_t*)(uintptr_t)(Lhp + 1); + Lpsp = (lwpsinfo_t*)(uintptr_t)(Lphp + 1); for (ninfo = Lphp->pr_nent; ninfo != 0; --ninfo) { if (Lpsp->pr_sname != 'Z') { sp = Lsp; - Lsp = (lwpstatus_t *)((uintptr_t)Lsp + Lhp->pr_entsize); + Lsp = (lwpstatus_t*)((uintptr_t)Lsp + Lhp->pr_entsize); } else { sp = NULL; } @@ -278,7 +278,7 @@ int SolarisLwp::Lwp_iter_all(int pid, !(callback_param->call_back)(sp, callback_param->context)) break; ++rv; - Lpsp = (lwpsinfo_t *)((uintptr_t)Lpsp + Lphp->pr_entsize); + Lpsp = (lwpsinfo_t*)((uintptr_t)Lpsp + Lphp->pr_entsize); } return rv; @@ -298,12 +298,12 @@ int SolarisLwp::GetModuleCount() const { } int SolarisLwp::ListModules( - CallbackParam *callback_param) const { - const char *maps_path = "/proc/self/map"; + CallbackParam* callback_param) const { + const char* maps_path = "/proc/self/map"; struct stat status; int fd = 0, num; prmap_t map_array[MAP_MAX]; - prmap_t *maps = map_array; + prmap_t* maps = map_array; size_t size; if ((fd = open(maps_path, O_RDONLY)) == -1) { @@ -326,12 +326,12 @@ int SolarisLwp::ListModules( return -1; } - if (read(fd, (void *)maps, size) < 0) { + if (read(fd, (void*)maps, size) < 0) { print_message2(2, "failed to read %d\n", fd); return -1; } - prmap_t *_maps; + prmap_t* _maps; int _num; int module_count = 0; @@ -345,7 +345,7 @@ int SolarisLwp::ListModules( */ for (_num = 0, _maps = maps; _num < num; ++_num, ++_maps) { ModuleInfo module; - char *name = _maps->pr_mapname; + char* name = _maps->pr_mapname; memset(&module, 0, sizeof (module)); module.start_addr = _maps->pr_vaddr; @@ -403,7 +403,7 @@ bool SolarisLwp::IsAddressMapped(uintptr_t address) const { // The Solaris stack looks like this: // http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libproc/common/Pstack.c#81 bool SolarisLwp::FindSigContext(uintptr_t sighandler_ebp, - ucontext_t **sig_ctx) { + ucontext_t** sig_ctx) { uintptr_t previous_ebp; uintptr_t sig_ebp; const int MAX_STACK_DEPTH = 50; @@ -416,7 +416,7 @@ bool SolarisLwp::FindSigContext(uintptr_t sighandler_ebp, *sig_ctx = reinterpret_cast(sighandler_ebp + sizeof (struct frame)); uintptr_t sig_esp = (*sig_ctx)->uc_mcontext.gregs[REG_O6]; if (sig_esp < previous_ebp && sig_esp > sighandler_ebp) - sig_ebp = (uintptr_t)(((struct frame *)sig_esp)->fr_savfp); + sig_ebp = (uintptr_t)(((struct frame*)sig_esp)->fr_savfp); #elif TARGET_CPU_X86 previous_ebp = reinterpret_cast(GetNextFrame( diff --git a/src/client/solaris/handler/solaris_lwp.h b/src/client/solaris/handler/solaris_lwp.h index 0914cfcd..afe352ce 100644 --- a/src/client/solaris/handler/solaris_lwp.h +++ b/src/client/solaris/handler/solaris_lwp.h @@ -70,17 +70,17 @@ struct ModuleInfo { // A callback to run when getting a lwp in the process. // Return true will go on to the next lwp while return false will stop the // iteration. -typedef bool (*LwpCallback)(lwpstatus_t* lsp, void *context); +typedef bool (*LwpCallback)(lwpstatus_t* lsp, void* context); // A callback to run when a new module is found in the process. // Return true will go on to the next module while return false will stop the // iteration. -typedef bool (*ModuleCallback)(const ModuleInfo &module_info, void *context); +typedef bool (*ModuleCallback)(const ModuleInfo& module_info, void* context); // A callback to run when getting a lwpid in the process. // Return true will go on to the next lwp while return false will stop the // iteration. -typedef bool (*LwpidCallback)(int lwpid, void *context); +typedef bool (*LwpidCallback)(int lwpid, void* context); // Holding the callback information. template @@ -88,12 +88,12 @@ struct CallbackParam { // Callback function address. CallbackFunc call_back; // Callback context; - void *context; + void* context; CallbackParam() : call_back(NULL), context(NULL) { } - CallbackParam(CallbackFunc func, void *func_context) : + CallbackParam(CallbackFunc func, void* func_context) : call_back(func), context(func_context) { } }; @@ -129,7 +129,7 @@ class SolarisLwp { // Whenever there is a lwp found, the callback will be invoked to process // the information. // Return the callback return value or -1 on error. - int Lwp_iter_all(int pid, CallbackParam *callback_param) const; + int Lwp_iter_all(int pid, CallbackParam* callback_param) const; // Get the module count of the current process. int GetModuleCount() const; @@ -138,13 +138,13 @@ class SolarisLwp { // Whenever a module is found, the callback will be invoked to process the // information. // Return how may modules are found. - int ListModules(CallbackParam *callback_param) const; + int ListModules(CallbackParam* callback_param) const; // Get the bottom of the stack from esp. uintptr_t GetLwpStackBottom(uintptr_t current_esp) const; // Finds a signal context on the stack given the ebp of our signal handler. - bool FindSigContext(uintptr_t sighandler_ebp, ucontext_t **sig_ctx); + bool FindSigContext(uintptr_t sighandler_ebp, ucontext_t** sig_ctx); private: // Check if the address is a valid virtual address. -- cgit v1.2.1