<p dir="ltr">Thanks for the detailed explanation! I guess i'll try my luck with suspending other threads, emulating thread-centric debugging. We might luck out, our environment is very controlled. If that doesn't work out we may have to live with process centric debugging for the time being.</p>
<p dir="ltr">Thanks,<br>
Mario</p>
<div class="gmail_quote">On Sep 5, 2014 10:01 PM, "Greg Clayton" <<a href="mailto:gclayton@apple.com">gclayton@apple.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Right now LLDB does something we term "process centric debugging". If any thread stops, then all threads and the process stops. This is required because of how software breakpoints are implemented. When we hit a software breakpoint, we stop all threads. When you want to continue we must do a:<br>
1 - disable software breakpoint<br>
2 - instruction single step thread that hit breakpoint on its own<br>
3 - enable software breakpoint<br>
4 - resume<br>
<br>
If we don't stop other threads, they could easily miss the breakpoint if a thread is in state 2 above and other threads are left to run.<br>
<br>
"thread centric debugging" is a long term goal, but has not been implemented yet. In order to do this we will require being able to evaluate an opcode by emulating the instruction itself and giving the emulator a read/write register and read/write memory callback. We currently have this with the (see lldb/include/lldb/Core/EmulateInstruction.h). The main problem is that we don't support emulating all the instructions for any architectures that we support. This would be the first step required in order to allow thread centric debugging (unless that is some really good hardware breakpoint support on your platform).<br>
<br>
So right now, when any thread stops they all stop. When you resume, you have the option to suspend all other threads if you want to (we could easily add a SBThread::Resume() to implement this to make it easier. The main problem you run into there is deadlocks.<br>
<br>
Greg Clayton<br>
<br>
> On Sep 4, 2014, at 12:54 AM, Mario Zechner <<a href="mailto:badlogicgames@gmail.com">badlogicgames@gmail.com</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> i'm currently working on a debugger based on the public LLDB API and am currently looking into multi-threaded debugging. The debugger should support the following scenario:<br>
><br>
> - user sets breakpoints<br>
> - two or more threads get stopped due to breakpoints<br>
> - user wants to continue execution of only one of the threads<br>
><br>
> SBThread has the methods Suspend/Resume. To my understanding (and tests), Suspend marks a thread as not to be continued when the entire process is continued. Which is the oposite of what i'd need for my use case.<br>
><br>
> I looked into the implementation of the command 'thread continue', but that uses the private LLDB API, which is sadly not an option for us at this point.<br>
><br>
> I'd be greatful for any hints.<br>
><br>
> Thanks,<br>
> Mario<br>
><br>
> _______________________________________________<br>
> lldb-dev mailing list<br>
> <a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
<br>
</blockquote></div>