[lldb-dev] How to enumerate stopped threads in C++ API?
Jim Ingham via lldb-dev
lldb-dev at lists.llvm.org
Thu Mar 3 12:17:06 PST 2016
I'm surprised that this turns out to be a bottleneck. All the work to create the threads should have been done when you stopped, so this should just be running over a vector that already exists and pulling a field out. Can you profile this and see what is actually slow?
> On Mar 3, 2016, at 9:54 AM, Eugene Birukov via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 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?
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
More information about the lldb-dev