[Lldb-commits] [lldb] r250364 - In r240466, when Greg added the jThreadsInfo packet, he accidentally

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 14 21:20:43 PDT 2015


Author: jmolenda
Date: Wed Oct 14 23:20:42 2015
New Revision: 250364

URL: http://llvm.org/viewvc/llvm-project?rev=250364&view=rev
Log:
In r240466, when Greg added the jThreadsInfo packet, he accidentally
disabled the use of the jThreadGetExtendedInfo packet which is used
to retrieve additional information about a thread, such as the QoS
setting for that thread on darwin systems.  

Re-enable the use of the jThreadGetExtendedInfo packet, and add 
some quick tests to the TestQueues mac test case which will verify
that we can retrieve the QoS names for these test threads.

<rdar://problem/22925096> 

Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/trunk/test/macosx/queues/TestQueues.py
    lldb/trunk/test/macosx/queues/main.c

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=250364&r1=250363&r2=250364&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Wed Oct 14 23:20:42 2015
@@ -619,7 +619,6 @@ GDBRemoteCommunicationClient::GetThreads
     if (m_supports_jThreadsInfo)
     {
         StringExtractorGDBRemote response;
-        m_supports_jThreadExtendedInfo = eLazyBoolNo;
         if (SendPacketAndWaitForResponse("jThreadsInfo", response, false) == PacketResult::Success)
         {
             if (response.IsUnsupportedResponse())

Modified: lldb/trunk/test/macosx/queues/TestQueues.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/queues/TestQueues.py?rev=250364&r1=250363&r2=250364&view=diff
==============================================================================
--- lldb/trunk/test/macosx/queues/TestQueues.py (original)
+++ lldb/trunk/test/macosx/queues/TestQueues.py Wed Oct 14 23:20:42 2015
@@ -108,6 +108,51 @@ class TestQueues(TestBase):
         self.check_queues_threads_match_queue (queue_performer_2)
         self.check_queues_threads_match_queue (queue_performer_3)
 
+
+
+        # We have threads running with all the different dispatch QoS service
+        # levels - find those threads and check that we can get the correct
+        # QoS name for each of them.
+
+        user_initiated_thread = lldb.SBThread()
+        user_interactive_thread = lldb.SBThread()
+        utility_thread = lldb.SBThread()
+        unspecified_thread = lldb.SBThread()
+        background_thread = lldb.SBThread()
+        for th in process.threads:
+            if th.GetName() == "user initiated QoS":
+                user_initiated_thread = th
+            if th.GetName() == "user interactive QoS":
+                user_interactive_thread = th
+            if th.GetName() == "utility QoS":
+                utility_thread = th
+            if th.GetName() == "unspecified QoS":
+                unspecified_thread = th
+            if th.GetName() == "background QoS":
+                background_thread = th
+
+        self.assertTrue(user_initiated_thread.IsValid(), "Found user initiated QoS thread")
+        self.assertTrue(user_interactive_thread.IsValid(), "Found user interactive QoS thread")
+        self.assertTrue(utility_thread.IsValid(), "Found utility QoS thread")
+        self.assertTrue(unspecified_thread.IsValid(), "Found unspecified QoS thread")
+        self.assertTrue(background_thread.IsValid(), "Found background QoS thread")
+
+        stream = lldb.SBStream()
+        self.assertTrue(user_initiated_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for user initiated QoS thread")
+        self.assertTrue(stream.GetData() == "User Initiated", "user initiated QoS thread name is valid")
+        stream.Clear()
+        self.assertTrue(user_interactive_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for user interactive QoS thread")
+        self.assertTrue(stream.GetData() == "User Interactive", "user interactive QoS thread name is valid")
+        stream.Clear()
+        self.assertTrue(utility_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for utility QoS thread")
+        self.assertTrue(stream.GetData() == "Utility", "utility QoS thread name is valid")
+        stream.Clear()
+        self.assertTrue(unspecified_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for unspecified QoS thread")
+        self.assertTrue(stream.GetData() == "User Initiated", "unspecified QoS thread name is valid")
+        stream.Clear()
+        self.assertTrue(background_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for background QoS thread")
+        self.assertTrue(stream.GetData() == "Background", "background QoS thread name is valid")
+
     def queues_with_libBacktraceRecording(self):
         """Test queues inspection SB APIs with libBacktraceRecording present."""
         exe = os.path.join(os.getcwd(), "a.out")
@@ -193,7 +238,6 @@ class TestQueues(TestBase):
         self.assertTrue(queue_performer_2.GetPendingItemAtIndex(9998).GetAddress().GetSymbol().GetName() == "doing_the_work_2", "queue 2's pending item #0 should be doing_the_work_2")
         self.assertTrue(queue_performer_2.GetPendingItemAtIndex(9999).IsValid() == False, "queue 2's pending item #9999 is invalid")
 
-        
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()

Modified: lldb/trunk/test/macosx/queues/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/queues/main.c?rev=250364&r1=250363&r2=250364&view=diff
==============================================================================
--- lldb/trunk/test/macosx/queues/main.c (original)
+++ lldb/trunk/test/macosx/queues/main.c Wed Oct 14 23:20:42 2015
@@ -91,6 +91,41 @@ int main ()
 
     dispatch_async_f (work_submittor_3, (void*) &work_performer_3, submit_work_3);
 
+
+    // Spin up threads with each of the different libdispatch QoS values.
+
+    dispatch_async (dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
+            pthread_setname_np ("user initiated QoS");
+            while (1)
+                sleep (10);
+                });
+    dispatch_async (dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
+            pthread_setname_np ("user interactive QoS");
+            while (1)
+                sleep (10);
+                });
+    dispatch_async (dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{
+            pthread_setname_np ("default QoS");
+            while (1)
+                sleep (10);
+                });
+    dispatch_async (dispatch_get_global_queue(QOS_CLASS_UTILITY, 0), ^{
+            pthread_setname_np ("utility QoS");
+            while (1)
+                sleep (10);
+                });
+    dispatch_async (dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0), ^{
+            pthread_setname_np ("background QoS");
+            while (1)
+                sleep (10);
+                });
+    dispatch_async (dispatch_get_global_queue(QOS_CLASS_UNSPECIFIED, 0), ^{
+            pthread_setname_np ("unspecified QoS");
+            while (1)
+                sleep (10);
+                });
+
+
     sleep (1);
     stopper ();
 




More information about the lldb-commits mailing list