[Lldb-commits] [lldb] r152291 - in /lldb/trunk/tools/debugserver/source/MacOSX: MachException.cpp MachException.h MachTask.cpp
Greg Clayton
gclayton at apple.com
Wed Mar 7 19:27:28 PST 2012
Author: gclayton
Date: Wed Mar 7 21:27:27 2012
New Revision: 152291
URL: http://llvm.org/viewvc/llvm-project?rev=152291&view=rev
Log:
<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.
Modified:
lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachException.h
lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp?rev=152291&r1=152290&r2=152291&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp Wed Mar 7 21:27:27 2012
@@ -165,12 +165,16 @@
(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 @@
}
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
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachException.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachException.h?rev=152291&r1=152290&r2=152291&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachException.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachException.h Wed Mar 7 21:27:27 2012
@@ -101,7 +101,7 @@
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,
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp?rev=152291&r1=152290&r2=152291&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachTask.cpp Wed Mar 7 21:27:27 2012
@@ -592,7 +592,7 @@
}
else
{
- if (exception_message.CatchExceptionRaise())
+ if (exception_message.CatchExceptionRaise(task))
{
++num_exceptions_received;
mach_proc->ExceptionMessageReceived(exception_message);
More information about the lldb-commits
mailing list