From c7ab1c1602755b1648e4588477810034739c49fa Mon Sep 17 00:00:00 2001 From: Sergiy Kuryata Date: Sat, 28 Feb 2015 17:47:30 -0800 Subject: [PATCH] Change the RtlRestoreContext function to use MachSetThreadContext on OSX. --- src/pal/src/debug/debug.cpp | 14 +++++++++++--- src/pal/src/exception/machmessage.h | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/pal/src/debug/debug.cpp b/src/pal/src/debug/debug.cpp index eb28e2e..07fd1d8 100644 --- a/src/pal/src/debug/debug.cpp +++ b/src/pal/src/debug/debug.cpp @@ -59,6 +59,10 @@ Revision History: #include #endif // HAVE_PROCFS_H +#if HAVE_MACH_EXCEPTIONS +#include "../exception/machexception.h" +#endif // HAVE_MACH_EXCEPTIONS + using namespace CorUnix; SET_DEFAULT_DEBUG_CHANNEL(DEBUG); @@ -530,14 +534,13 @@ RtlRestoreContext( IN PEXCEPTION_RECORD ExceptionRecord ) { - native_context_t ucontext; - // //TODO: This needs to be properly implemented // because this code does not restore XMM registers // - +#if !HAVE_MACH_EXCEPTIONS #if HAVE_GETCONTEXT + native_context_t ucontext; getcontext(&ucontext); #else #error Don't know how to get current context on this platform! @@ -551,6 +554,11 @@ RtlRestoreContext( #else #error Don't know how to set current context on this platform! #endif + +#else + MachSetThreadContext(const_cast(ContextRecord)); + ASSERT("MachSetThreadContext should never return\n"); +#endif // HAVE_MACH_EXCEPTIONS } /*++ diff --git a/src/pal/src/exception/machmessage.h b/src/pal/src/exception/machmessage.h index 8225852..cb80890 100644 --- a/src/pal/src/exception/machmessage.h +++ b/src/pal/src/exception/machmessage.h @@ -153,7 +153,7 @@ private: // The maximum size in bytes of any Mach message we can send or receive. Calculating an exact size for // this is non trivial (basically because of the security trailers that Mach appends) but the current // value has proven to be more than enough so far. - static const size_t kcbMaxMessageSize = 900; + static const size_t kcbMaxMessageSize = 1500; // The following are structures describing the formats of the Mach messages we understand. -- 2.7.4