diff options
author | Greg Clayton <gclayton@apple.com> | 2012-03-08 03:27:27 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-03-08 03:27:27 +0000 |
commit | 85f3fa5411a86e36cc9b97c2a906827b1a356ccc (patch) | |
tree | 55e7088abf019373770d6ddbb3f5cf3a79223ffe | |
parent | 5e152182a476163c61a9e6cc39fde94c489f6ef3 (diff) | |
download | bcm5719-llvm-85f3fa5411a86e36cc9b97c2a906827b1a356ccc.tar.gz bcm5719-llvm-85f3fa5411a86e36cc9b97c2a906827b1a356ccc.zip |
<rdar://problem/11007934>
On darwin, if child process of process being debugged dies due to mach exception, the debugged process will die.
debugserver now only handles the mach exceptions for the task being debugged.
llvm-svn: 152291
-rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachException.cpp | 19 | ||||
-rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachException.h | 2 | ||||
-rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachTask.cpp | 2 |
3 files changed, 14 insertions, 9 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/MachException.cpp b/lldb/tools/debugserver/source/MacOSX/MachException.cpp index 7492e9a66de..ead512ea148 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachException.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachException.cpp @@ -165,12 +165,16 @@ catch_mach_exception_raise (uint64_t)(exc_data_count > 1 ? exc_data[1] : 0xBADDBADD)); } - g_message->task_port = task_port; - g_message->thread_port = thread_port; - g_message->exc_type = exc_type; - g_message->exc_data.resize(exc_data_count); - ::memcpy (&g_message->exc_data[0], exc_data, g_message->exc_data.size() * sizeof (mach_exception_data_type_t)); - return KERN_SUCCESS; + if (task_port == g_message->task_port) + { + g_message->task_port = task_port; + g_message->thread_port = thread_port; + g_message->exc_type = exc_type; + g_message->exc_data.resize(exc_data_count); + ::memcpy (&g_message->exc_data[0], exc_data, g_message->exc_data.size() * sizeof (mach_exception_data_type_t)); + return KERN_SUCCESS; + } + return KERN_FAILURE; } @@ -318,12 +322,13 @@ MachException::Message::Receive(mach_port_t port, mach_msg_option_t options, mac } bool -MachException::Message::CatchExceptionRaise() +MachException::Message::CatchExceptionRaise(task_t task) { bool success = false; // locker will keep a mutex locked until it goes out of scope // PThreadMutex::Locker locker(&g_message_mutex); // DNBLogThreaded("calling mach_exc_server"); + state.task_port = task; g_message = &state; // The exc_server function is the MIG generated server handling function // to handle messages from the kernel relating to the occurrence of an diff --git a/lldb/tools/debugserver/source/MacOSX/MachException.h b/lldb/tools/debugserver/source/MacOSX/MachException.h index 330978ba5d1..08d22cd28e6 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachException.h +++ b/lldb/tools/debugserver/source/MacOSX/MachException.h @@ -101,7 +101,7 @@ public: memset(&exc_msg, 0, sizeof(exc_msg)); memset(&reply_msg, 0, sizeof(reply_msg)); } - bool CatchExceptionRaise(); + bool CatchExceptionRaise(task_t task); void Dump() const; kern_return_t Reply (MachProcess *process, int signal); kern_return_t Receive( mach_port_t receive_port, diff --git a/lldb/tools/debugserver/source/MacOSX/MachTask.cpp b/lldb/tools/debugserver/source/MacOSX/MachTask.cpp index 869384cc545..14a8fca9286 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachTask.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachTask.cpp @@ -592,7 +592,7 @@ MachTask::ExceptionThread (void *arg) } else { - if (exception_message.CatchExceptionRaise()) + if (exception_message.CatchExceptionRaise(task)) { ++num_exceptions_received; mach_proc->ExceptionMessageReceived(exception_message); |