Index: src/client/mac/handler/exception_handler.cc |
=================================================================== |
--- a/src/client/mac/handler/exception_handler.cc |
+++ b/src/client/mac/handler/exception_handler.cc |
@@ -318,16 +318,49 @@ bool ExceptionHandler::WriteMinidump() { |
// static |
bool ExceptionHandler::WriteMinidump(const string &dump_path, |
MinidumpCallback callback, |
void *callback_context) { |
ExceptionHandler handler(dump_path, NULL, callback, callback_context, false); |
return handler.WriteMinidump(); |
} |
+// static |
+bool ExceptionHandler::WriteMinidumpForChild(mach_port_t child, |
+ mach_port_t child_blamed_thread, |
+ const string &dump_path, |
+ MinidumpCallback callback, |
+ void *callback_context) { |
+ if (task_suspend(child) != KERN_SUCCESS) |
Mark Mentovai
2010/08/13 16:59:42
ScopedTaskSuspend would be helpful here too.
Ted Mielczarek
2010/08/13 17:07:47
Is this something that's already written, or are y
|
+ return false; |
+ |
+ MinidumpGenerator generator(child, MACH_PORT_NULL); |
+ string dump_id; |
+ string dump_filename = generator.UniqueNameInDirectory(dump_path, &dump_id); |
+ |
+ generator.SetExceptionInformation(EXC_BREAKPOINT, |
+#if defined (__i386__) || defined(__x86_64__) |
+ EXC_I386_BPT, |
+#elif defined (__ppc__) || defined (__ppc64__) |
+ EXC_PPC_BREAKPOINT, |
+#else |
+ #error architecture not supported |
+#endif |
+ 0, |
+ child_blamed_thread); |
+ bool result = generator.Write(dump_filename.c_str()); |
+ task_resume(child); |
+ |
+ if (callback) { |
+ return callback(dump_path.c_str(), dump_id.c_str(), |
+ callback_context, result); |
+ } |
+ return result; |
+} |
+ |
bool ExceptionHandler::WriteMinidumpWithException(int exception_type, |
int exception_code, |
int exception_subcode, |
mach_port_t thread_name) { |
bool result = false; |
if (directCallback_) { |
if (directCallback_(callback_context_, |