[lldb-dev] Thread debugging (thread_db interface?)
gclayton at apple.com
Mon Jun 28 09:52:39 PDT 2010
On Jun 28, 2010, at 4:08 AM, Kevin Pouget wrote:
> is LLDB already able to debug multithreaded codes?
LLDB was build with multi-threaded debugging in mind and it can current debug multi-threaded processes. It currently does multi-threaded debugging in a process centric fashion: it suspends all other threads when one or more threads stop for any reason. Each thread knows why it stopped and maintains its own notion of what job that thread is doing: there are ThreadPlan objects that can be stacked to keep track of what each thread is doing when it comes to run control. The plans are stackable and allow you to be single stepping over a source line of code in thread 1, then hit a breakpoint in a deeper call stack (again in thread 1) and after resuming again from the second breakpoint, get back to your original stepping task.
We designed LLDB to be able to switch to thread centric mode where we let other threads run when others are stopped, but that is not currently the way LLDB runs and it will take some work to get it there. One big reason for this is that most of the design to date has happend on Mac OS X where we don't have a reliable way to be notified of thread creation or termination.
> if yes, does it (totally) rely on Thread_db to query the thread library? (could you
> point me to the relevant source file?)
No, for Mac OS X we don't currently have thread_db.h or anything like it so the Mac OS X debugger plug-in doesn't use this. Let me know if you are interested in any more specifics on the Mac OS X side, but I am guessing you are more interested in the linux side of things?
We have a linux port started by Eli Friedman, though I am not sure what will be used on the linux side.
More information about the lldb-dev