diff options
Diffstat (limited to 'lldb/tools/debugserver')
-rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachException.cpp | 6 | ||||
-rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachException.h | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/MachException.cpp b/lldb/tools/debugserver/source/MacOSX/MachException.cpp index 12479b8b7e8..cc309e47d86 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachException.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachException.cpp @@ -113,8 +113,7 @@ catch_mach_exception_raise(mach_port_t exc_port, mach_port_t thread_port, g_message->task_port = task_port; g_message->thread_port = thread_port; g_message->exc_type = exc_type; - for (mach_msg_type_number_t i=0; i<exc_data_count; ++i) - g_message->exc_data.push_back(exc_data[i]); + g_message->AppendExceptionData(exc_data, exc_data_count); return KERN_SUCCESS; } else if (!MachTask::IsValid(g_message->task_port)) { // Our original exception port isn't valid anymore check for a SIGTRAP @@ -126,8 +125,7 @@ catch_mach_exception_raise(mach_port_t exc_port, mach_port_t thread_port, g_message->task_port = task_port; g_message->thread_port = thread_port; g_message->exc_type = exc_type; - for (mach_msg_type_number_t i=0; i<exc_data_count; ++i) - g_message->exc_data.push_back(exc_data[i]); + g_message->AppendExceptionData(exc_data, exc_data_count); return KERN_SUCCESS; } } diff --git a/lldb/tools/debugserver/source/MacOSX/MachException.h b/lldb/tools/debugserver/source/MacOSX/MachException.h index a45a41e01f4..e1af12def10 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachException.h +++ b/lldb/tools/debugserver/source/MacOSX/MachException.h @@ -71,6 +71,15 @@ public: return (exc_type == EXC_BREAKPOINT || ((exc_type == EXC_SOFTWARE) && exc_data[0] == 1)); } + void AppendExceptionData(mach_exception_data_t Data, + mach_msg_type_number_t Count) { + mach_exception_data_type_t Buf; + for (mach_msg_type_number_t i = 0; i < Count; ++i) { + // Perform an unaligned copy. + memcpy(&Buf, Data + i, sizeof(mach_exception_data_type_t)); + exc_data.push_back(Buf); + } + } void Dump() const; void DumpStopReason() const; bool GetStopInfo(struct DNBThreadStopInfo *stop_info) const; |