Change the RtlRestoreContext function to use MachSetThreadContext on OSX.
authorSergiy Kuryata <sergeyk@microsoft.com>
Sun, 1 Mar 2015 01:47:30 +0000 (17:47 -0800)
committerSergiy Kuryata <sergeyk@microsoft.com>
Sun, 1 Mar 2015 01:47:30 +0000 (17:47 -0800)
src/pal/src/debug/debug.cpp
src/pal/src/exception/machmessage.h

index eb28e2e..07fd1d8 100644 (file)
@@ -59,6 +59,10 @@ Revision History:
 #include <procfs.h>
 #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<CONTEXT *>(ContextRecord));
+    ASSERT("MachSetThreadContext should never return\n");
+#endif // HAVE_MACH_EXCEPTIONS
 }
 
 /*++
index 8225852..cb80890 100644 (file)
@@ -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.