mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-01-26 07:50:58 +00:00
Fix a bunch of small nits.
Review URL: https://breakpad.appspot.com/463004 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1051 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
5edf194493
commit
d053a94be8
|
@ -103,11 +103,10 @@ exception_mask_t s_exception_mask = EXC_MASK_BAD_ACCESS |
|
||||||
EXC_MASK_BAD_INSTRUCTION | EXC_MASK_ARITHMETIC | EXC_MASK_BREAKPOINT;
|
EXC_MASK_BAD_INSTRUCTION | EXC_MASK_ARITHMETIC | EXC_MASK_BREAKPOINT;
|
||||||
|
|
||||||
#if !TARGET_OS_IPHONE
|
#if !TARGET_OS_IPHONE
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
// Forward declarations for functions that need "C" style compilation
|
// Forward declarations for functions that need "C" style compilation
|
||||||
boolean_t exc_server(mach_msg_header_t *request,
|
boolean_t exc_server(mach_msg_header_t* request,
|
||||||
mach_msg_header_t *reply);
|
mach_msg_header_t* reply);
|
||||||
|
|
||||||
// This symbol must be visible to dlsym() - see
|
// This symbol must be visible to dlsym() - see
|
||||||
// http://code.google.com/p/google-breakpad/issues/detail?id=345 for details.
|
// http://code.google.com/p/google-breakpad/issues/detail?id=345 for details.
|
||||||
|
@ -129,8 +128,8 @@ kern_return_t ForwardException(mach_port_t task,
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
// Implementation is based on the implementation generated by mig.
|
// Implementation is based on the implementation generated by mig.
|
||||||
boolean_t breakpad_exc_server(mach_msg_header_t *InHeadP,
|
boolean_t breakpad_exc_server(mach_msg_header_t* InHeadP,
|
||||||
mach_msg_header_t *OutHeadP) {
|
mach_msg_header_t* OutHeadP) {
|
||||||
OutHeadP->msgh_bits =
|
OutHeadP->msgh_bits =
|
||||||
MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(InHeadP->msgh_bits), 0);
|
MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(InHeadP->msgh_bits), 0);
|
||||||
OutHeadP->msgh_remote_port = InHeadP->msgh_remote_port;
|
OutHeadP->msgh_remote_port = InHeadP->msgh_remote_port;
|
||||||
|
@ -140,8 +139,8 @@ boolean_t breakpad_exc_server(mach_msg_header_t *InHeadP,
|
||||||
OutHeadP->msgh_id = InHeadP->msgh_id + 100;
|
OutHeadP->msgh_id = InHeadP->msgh_id + 100;
|
||||||
|
|
||||||
if (InHeadP->msgh_id != 2401) {
|
if (InHeadP->msgh_id != 2401) {
|
||||||
((mig_reply_error_t *)OutHeadP)->NDR = NDR_record;
|
((mig_reply_error_t*)OutHeadP)->NDR = NDR_record;
|
||||||
((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID;
|
((mig_reply_error_t*)OutHeadP)->RetCode = MIG_BAD_ID;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,8 +170,8 @@ boolean_t breakpad_exc_server(mach_msg_header_t *InHeadP,
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Request *In0P = (Request *)InHeadP;
|
Request* In0P = (Request*)InHeadP;
|
||||||
Reply *OutP = (Reply *)OutHeadP;
|
Reply* OutP = (Reply*)OutHeadP;
|
||||||
|
|
||||||
if (In0P->task.name != mach_task_self()) {
|
if (In0P->task.name != mach_task_self()) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -186,8 +185,8 @@ boolean_t breakpad_exc_server(mach_msg_header_t *InHeadP,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
boolean_t breakpad_exc_server(mach_msg_header_t *request,
|
boolean_t breakpad_exc_server(mach_msg_header_t* request,
|
||||||
mach_msg_header_t *reply) {
|
mach_msg_header_t* reply) {
|
||||||
return exc_server(request, reply);
|
return exc_server(request, reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,9 +206,9 @@ kern_return_t catch_exception_raise(mach_port_t port, mach_port_t failed_thread,
|
||||||
ExceptionHandler::ExceptionHandler(const string &dump_path,
|
ExceptionHandler::ExceptionHandler(const string &dump_path,
|
||||||
FilterCallback filter,
|
FilterCallback filter,
|
||||||
MinidumpCallback callback,
|
MinidumpCallback callback,
|
||||||
void *callback_context,
|
void* callback_context,
|
||||||
bool install_handler,
|
bool install_handler,
|
||||||
const char *port_name)
|
const char* port_name)
|
||||||
: dump_path_(),
|
: dump_path_(),
|
||||||
filter_(filter),
|
filter_(filter),
|
||||||
callback_(callback),
|
callback_(callback),
|
||||||
|
@ -235,7 +234,7 @@ ExceptionHandler::ExceptionHandler(const string &dump_path,
|
||||||
// special constructor if we want to bypass minidump writing and
|
// special constructor if we want to bypass minidump writing and
|
||||||
// simply get a callback with the exception information
|
// simply get a callback with the exception information
|
||||||
ExceptionHandler::ExceptionHandler(DirectCallback callback,
|
ExceptionHandler::ExceptionHandler(DirectCallback callback,
|
||||||
void *callback_context,
|
void* callback_context,
|
||||||
bool install_handler)
|
bool install_handler)
|
||||||
: dump_path_(),
|
: dump_path_(),
|
||||||
filter_(NULL),
|
filter_(NULL),
|
||||||
|
@ -287,7 +286,7 @@ bool ExceptionHandler::WriteMinidump(bool write_exception_stream) {
|
||||||
bool ExceptionHandler::WriteMinidump(const string &dump_path,
|
bool ExceptionHandler::WriteMinidump(const string &dump_path,
|
||||||
bool write_exception_stream,
|
bool write_exception_stream,
|
||||||
MinidumpCallback callback,
|
MinidumpCallback callback,
|
||||||
void *callback_context) {
|
void* callback_context) {
|
||||||
ExceptionHandler handler(dump_path, NULL, callback, callback_context, false,
|
ExceptionHandler handler(dump_path, NULL, callback, callback_context, false,
|
||||||
NULL);
|
NULL);
|
||||||
return handler.WriteMinidump(write_exception_stream);
|
return handler.WriteMinidump(write_exception_stream);
|
||||||
|
@ -298,7 +297,7 @@ bool ExceptionHandler::WriteMinidumpForChild(mach_port_t child,
|
||||||
mach_port_t child_blamed_thread,
|
mach_port_t child_blamed_thread,
|
||||||
const string &dump_path,
|
const string &dump_path,
|
||||||
MinidumpCallback callback,
|
MinidumpCallback callback,
|
||||||
void *callback_context) {
|
void* callback_context) {
|
||||||
ScopedTaskSuspend suspend(child);
|
ScopedTaskSuspend suspend(child);
|
||||||
|
|
||||||
MinidumpGenerator generator(child, MACH_PORT_NULL);
|
MinidumpGenerator generator(child, MACH_PORT_NULL);
|
||||||
|
@ -306,11 +305,11 @@ bool ExceptionHandler::WriteMinidumpForChild(mach_port_t child,
|
||||||
string dump_filename = generator.UniqueNameInDirectory(dump_path, &dump_id);
|
string dump_filename = generator.UniqueNameInDirectory(dump_path, &dump_id);
|
||||||
|
|
||||||
generator.SetExceptionInformation(EXC_BREAKPOINT,
|
generator.SetExceptionInformation(EXC_BREAKPOINT,
|
||||||
#if defined (__i386__) || defined(__x86_64__)
|
#if defined(__i386__) || defined(__x86_64__)
|
||||||
EXC_I386_BPT,
|
EXC_I386_BPT,
|
||||||
#elif defined (__ppc__) || defined (__ppc64__)
|
#elif defined(__ppc__) || defined(__ppc64__)
|
||||||
EXC_PPC_BREAKPOINT,
|
EXC_PPC_BREAKPOINT,
|
||||||
#elif defined (__arm__)
|
#elif defined(__arm__)
|
||||||
EXC_ARM_BREAKPOINT,
|
EXC_ARM_BREAKPOINT,
|
||||||
#else
|
#else
|
||||||
#error architecture not supported
|
#error architecture not supported
|
||||||
|
@ -329,7 +328,7 @@ bool ExceptionHandler::WriteMinidumpForChild(mach_port_t child,
|
||||||
bool ExceptionHandler::WriteMinidumpWithException(int exception_type,
|
bool ExceptionHandler::WriteMinidumpWithException(int exception_type,
|
||||||
int exception_code,
|
int exception_code,
|
||||||
int exception_subcode,
|
int exception_subcode,
|
||||||
ucontext_t *task_context,
|
ucontext_t* task_context,
|
||||||
mach_port_t thread_name,
|
mach_port_t thread_name,
|
||||||
bool exit_after_write,
|
bool exit_after_write,
|
||||||
bool report_current_thread) {
|
bool report_current_thread) {
|
||||||
|
@ -450,9 +449,9 @@ kern_return_t ForwardException(mach_port_t task, mach_port_t failed_thread,
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
|
void* ExceptionHandler::WaitForMessage(void* exception_handler_class) {
|
||||||
ExceptionHandler *self =
|
ExceptionHandler* self =
|
||||||
reinterpret_cast<ExceptionHandler *>(exception_handler_class);
|
reinterpret_cast<ExceptionHandler*>(exception_handler_class);
|
||||||
ExceptionMessage receive;
|
ExceptionMessage receive;
|
||||||
|
|
||||||
// Wait for the exception info
|
// Wait for the exception info
|
||||||
|
@ -497,11 +496,11 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
|
||||||
if (receive.header.msgh_id == kWriteDumpWithExceptionMessage) {
|
if (receive.header.msgh_id == kWriteDumpWithExceptionMessage) {
|
||||||
thread = receive.thread.name;
|
thread = receive.thread.name;
|
||||||
exception_type = EXC_BREAKPOINT;
|
exception_type = EXC_BREAKPOINT;
|
||||||
#if defined (__i386__) || defined(__x86_64__)
|
#if defined(__i386__) || defined(__x86_64__)
|
||||||
exception_code = EXC_I386_BPT;
|
exception_code = EXC_I386_BPT;
|
||||||
#elif defined (__ppc__) || defined (__ppc64__)
|
#elif defined(__ppc__) || defined(__ppc64__)
|
||||||
exception_code = EXC_PPC_BREAKPOINT;
|
exception_code = EXC_PPC_BREAKPOINT;
|
||||||
#elif defined (__arm__)
|
#elif defined(__arm__)
|
||||||
exception_code = EXC_ARM_BREAKPOINT;
|
exception_code = EXC_ARM_BREAKPOINT;
|
||||||
#else
|
#else
|
||||||
#error architecture not supported
|
#error architecture not supported
|
||||||
|
@ -582,7 +581,7 @@ void *ExceptionHandler::WaitForMessage(void *exception_handler_class) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
// static
|
||||||
void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
|
void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
|
||||||
#if USE_PROTECTED_ALLOCATIONS
|
#if USE_PROTECTED_ALLOCATIONS
|
||||||
if (gBreakpadAllocator)
|
if (gBreakpadAllocator)
|
||||||
|
@ -636,7 +635,6 @@ bool ExceptionHandler::InstallHandler() {
|
||||||
#else
|
#else
|
||||||
previous_ = new ExceptionParameters();
|
previous_ = new ExceptionParameters();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (std::bad_alloc) {
|
catch (std::bad_alloc) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -735,7 +733,7 @@ bool ExceptionHandler::Setup(bool install_handler) {
|
||||||
result = thread_create_result ? KERN_FAILURE : KERN_SUCCESS;
|
result = thread_create_result ? KERN_FAILURE : KERN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result == KERN_SUCCESS ? true : false;
|
return result == KERN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ExceptionHandler::Teardown() {
|
bool ExceptionHandler::Teardown() {
|
||||||
|
|
|
@ -57,7 +57,7 @@ extern unsigned my_uint_len(uintmax_t i);
|
||||||
|
|
||||||
// Convert an unsigned integer to a string
|
// Convert an unsigned integer to a string
|
||||||
// output: (output) the resulting string is written here. This buffer must be
|
// output: (output) the resulting string is written here. This buffer must be
|
||||||
// large enough to hold the resulting string. Call |my_int_len| to get the
|
// large enough to hold the resulting string. Call |my_uint_len| to get the
|
||||||
// required length.
|
// required length.
|
||||||
// i: the unsigned integer to serialise.
|
// i: the unsigned integer to serialise.
|
||||||
// i_len: the length of the integer in base 10 (see |my_uint_len|).
|
// i_len: the length of the integer in base 10 (see |my_uint_len|).
|
||||||
|
|
Loading…
Reference in a new issue