[Lldb-commits] [PATCH] D20436: Clean up vestigial remnants of locking primitives

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Fri May 20 17:54:23 PDT 2016


zturner added a comment.

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.


================
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp:354-355
@@ -358,5 +353,4 @@
 {
-    // Calculate absolute timeout value
-    TimeValue timeout = TimeValue::Now();
-    timeout.OffsetWithMicroSeconds(timeout_usec);
+    std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds> until =
+        std::chrono::system_clock::now() + std::chrono::microseconds(timeout_usec);
 
----------------
Need to use `auto` here, otherwise there's a compiler error.

================
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:844
@@ -845,1 +843,3 @@
+                        if (m_async_packet_predicate.WaitForValueEqualTo(
+                                false, until - std::chrono::system_clock::now(), &timed_out))
                         {
----------------
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).

================
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:860
@@ -859,2 +859,3 @@
                         // Make sure we wait until the continue packet has been sent again...
-                        if (m_private_is_running.WaitForValueEqualTo (true, &timeout_time, &timed_out))
+                        if (m_private_is_running.WaitForValueEqualTo(true, until - std::chrono::system_clock::now(),
+                                                                     &timed_out))
----------------
`duration_cast` again.

================
Comment at: source/Target/Process.cpp:5547
@@ +5546,3 @@
+                    log->Printf("Process::RunThreadPlan(): about to wait - now is %llu - endpoint is %llu",
+                                std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds>(
+                                    std::chrono::system_clock::now())
----------------
Delete the cast here.  Just use `std::chrono::system_clock::now()`.

================
Comment at: source/Target/Process.cpp:5551
@@ +5550,3 @@
+                                    .count(),
+                                std::chrono::time_point<std::chrono::system_clock, std::chrono::microseconds>(timeout)
+                                    .time_since_epoch()
----------------
Change to `timeout.time_since_epoch()`


Repository:
  rL LLVM

http://reviews.llvm.org/D20436





More information about the lldb-commits mailing list