[lldb-dev] How to enumerate stopped threads in C++ API?

Eugene Birukov via lldb-dev lldb-dev at lists.llvm.org
Thu Mar 3 09:54:16 PST 2016


Hi,
I am working on a custom debugger on Linux and I am using LLDB C++ API for that. So far, from the functionality point of view the life is good, but I am running into severe performance issue.
The problem is that the target application has literally hundreds of threads, and when the target process stops, I need to identify all the threads that have non-trivial stop reason. So, I am doing something like that:
    // Loop over threads    int numThreads = m_Process.GetNumThreads();    for (int threadIndex = 0; threadIndex < numThreads; ++threadIndex)    {        // Inspect the thread state        sbThread = m_Process.GetThreadAtIndex(threadIndex);        stopReason = sbThread.GetStopReason();...

Well, this loop turns out to be a bottleneck. 
So, is there any way to find all the stopped threads without iterating over the whole world?
Thanks,Eugene

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20160303/262eea6f/attachment-0001.html>


More information about the lldb-dev mailing list