<div dir="ltr">Here is a patch you can apply on top of your patch to fix the compiler and runtime errors (on Windows at least).<div><br></div><div>Most of the compiler errors were around the use of duration_cast.  I've never used std::chrono before, but my best guess is that system_time::now() is a different type on Windows and other platforms, and so explicitly specifying the type to store it to results in implicit conversion errors.  Apparently this is exactly what duration_cast is for, so I used it.</div><div><br></div><div>There was a semantic change in the event handler that caused runtime errors.  Basically in WaitForEventsInternal() if it didn't find an event the first time, it would wait for a condition variable, then try again.  But in the changed code, it would wait for a condition variable and then immediately return failure without retrying.  So I fixed this and everything seems to be going smooth.I would encourage Greg or someone else to actually test this on OSX, but at least on Windows it looks good with the attached patch.<br><div><br></div><div><br><div class="gmail_quote"><div dir="ltr">On Fri, May 20, 2016 at 5:54 PM Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">zturner added a comment.<br>
<br>
I'm still getting a lot of crashes after this, but this will at least fix the compiler errors.  I will try to look at the crashes on Monday.<br>
<br>
<br>
================<br>
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp:354-355<br>
@@ -358,5 +353,4 @@<br>
 {<br>
-    // Calculate absolute timeout value<br>
-    TimeValue timeout = TimeValue::Now();<br>
-    timeout.OffsetWithMicroSeconds(timeout_usec);<br>
+    std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds> until =<br>
+        std::chrono::system_clock::now() + std::chrono::microseconds(timeout_usec);<br>
<br>
----------------<br>
Need to use `auto` here, otherwise there's a compiler error.<br>
<br>
================<br>
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:844<br>
@@ -845,1 +843,3 @@<br>
+                        if (m_async_packet_predicate.WaitForValueEqualTo(<br>
+                                false, until - std::chrono::system_clock::now(), &timed_out))<br>
                         {<br>
----------------<br>
this needs to use `std::chrono::duration_cast<std::chrono::microseconds>(until - std::chrono::system_clock::now())`.  Maybe raise this into a temporary variable (also make sure to use auto on the result just in case).<br>
<br>
================<br>
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:860<br>
@@ -859,2 +859,3 @@<br>
                         // Make sure we wait until the continue packet has been sent again...<br>
-                        if (m_private_is_running.WaitForValueEqualTo (true, &timeout_time, &timed_out))<br>
+                        if (m_private_is_running.WaitForValueEqualTo(true, until - std::chrono::system_clock::now(),<br>
+                                                                     &timed_out))<br>
----------------<br>
`duration_cast` again.<br>
<br>
================<br>
Comment at: source/Target/Process.cpp:5547<br>
@@ +5546,3 @@<br>
+                    log->Printf("Process::RunThreadPlan(): about to wait - now is %llu - endpoint is %llu",<br>
+                                std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds>(<br>
+                                    std::chrono::system_clock::now())<br>
----------------<br>
Delete the cast here.  Just use `std::chrono::system_clock::now()`.<br>
<br>
================<br>
Comment at: source/Target/Process.cpp:5551<br>
@@ +5550,3 @@<br>
+                                    .count(),<br>
+                                std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds>(timeout)<br>
+                                    .time_since_epoch()<br>
----------------<br>
Change to `timeout.time_since_epoch()`<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D20436" rel="noreferrer" target="_blank">http://reviews.llvm.org/D20436</a><br>
<br>
<br>
<br>
</blockquote></div></div></div></div>