[Lldb-commits] [PATCH] D58912: [debugserver] Fix IsUserReady thread filtering

Frederic Riss via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 4 10:23:40 PST 2019


friss created this revision.
friss added reviewers: jasonmolenda, clayborg, jingham.
Herald added a subscriber: jdoerfert.

In 2010 (r118866), filtering code was added to debugserver to avoid reporting threads
that were "not ready to be displayed to the user". This code inspects the thread's
state and discards threads marked 'uninterruptible'. Turns out, this state is pretty
common and not only a characterisitic of 'user-readiness'. This filtering was tracked
down as the source of the flakiness of TestQueues and TestConcurrent* with the symptom
of missing threads.

We discussed with the kernel team and there should be no need for us to filter the
restult of task_threads(). Everything that is returned from there can be examined.
So I went on and tried to remove the filtering completely. This produces other test
failures, where we were reporting more theads than expected. Always threads that had
been terminated, but weren't removed from the task bookkeeping structures yet. Those
threads always had a PC of 0.

This patch changes the heuristic to make the filtering a little less strict and only
rejects threads that are 'uninteruptible' *and* have a PC of 0. This has proven to be
solid in my testing.


https://reviews.llvm.org/D58912

Files:
  tools/debugserver/source/MacOSX/MachThread.cpp


Index: tools/debugserver/source/MacOSX/MachThread.cpp
===================================================================
--- tools/debugserver/source/MacOSX/MachThread.cpp
+++ tools/debugserver/source/MacOSX/MachThread.cpp
@@ -243,7 +243,7 @@
   case TH_STATE_HALTED:
     return true;
   }
-  return false;
+  return GetPC(0) != 0;
 }
 
 struct thread_basic_info *MachThread::GetBasicInfo() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58912.189163.patch
Type: text/x-patch
Size: 395 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190304/a34c15ed/attachment.bin>


More information about the lldb-commits mailing list