[Bug 24681] New: Allow LLDB to distinguish between user threads and system threads

Bug ID 24681
Summary Allow LLDB to distinguish between user threads and system threads
Product lldb
Version unspecified
Hardware PC
OS Windows NT
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter zturner@google.com
CC llvm-bugs@lists.llvm.org
Classification Unclassified

Various tests are written to test multithreaded functionality of LLDB by
creating a number of threads, and then verifying that the expected and actual
numbers of threads match.

This doesn't work in the presence of threads which are created by the operating
system, and on Windows this can happen even in a trivial single-threaded hello
world application.

To fix this, we should add to LLDB the notion of a user-created thread versus a
system thread, and expose this through the SB API in a way that the tests can
query only the user threads.  On Windows this can be done by checking for the
presence of ntdll!TppWorkerThread in the call stack, and on Mac this can be
done by checking for start_wqthread or _dispatch_mgr_thread as the last frame
of the callstack.  Similar methods probably can be found for other platforms.

For now, the following tests are XFAIL'ed on Windows until this is resolved: