Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Unified Diff: src/client/mac/handler/exception_handler.cc

Issue 148001: Support generating minidumps from live processes on OS X (Closed)
Patch Set: Created 14 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_,

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1004:630ec63f810e-tainted