<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - SBProcess::Stop stops only the main thread, not all threads"
href="https://llvm.org/bugs/show_bug.cgi?id=25046">25046</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>SBProcess::Stop stops only the main thread, not all threads
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>3.6
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>berykubik@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=14997" name="attach_14997" title="C++ app with two threads doing an endless printing loop">attachment 14997</a> <a href="attachment.cgi?id=14997&action=edit" title="C++ app with two threads doing an endless printing loop">[details]</a></span>
C++ app with two threads doing an endless printing loop
When I have more threads in an app and I call SBProcess::Stop, only the main
thread stops and the rest of the threads continue.
The description of SBThread::Suspend states: "LLDB currently supports process
centric debugging which means when any thread in a process stops, all other
threads are stopped.".
I attached a simple C++ app that spawns a thread with the pthread library. Both
the main and the second thread print a message and then sleep for a while, when
I stop the process with SBProcess::Stop, the main thread stops printing, but
the other thread keeps printing the message and it's property is_stopped
returns False.
Do I need to do anything else to stop the other threads? I don't know how I
could stop them, as they don't have a stop method (apart of SBThread::Suspend,
but that serves a different purpose as far as I know).
Here's a minimal code example that shows that only the main thread gets stopped
(it prints True, False instead of True, True).
import lldb
import os
import time
debugger = lldb.SBDebugger.Create()
debugger.SetAsync(True)
target = debugger.CreateTargetWithFileAndArch("./test", lldb.LLDB_ARCH_DEFAULT)
process = target.LaunchSimple([], [], os.getcwd())
time.sleep(3) # ensure second thread is started
process.Stop()
for t in process:
print(t.is_stopped)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>