[llvm-bugs] [Bug 25046] New: SBProcess::Stop stops only the main thread, not all threads

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 4 12:04:03 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25046

            Bug ID: 25046
           Summary: SBProcess::Stop stops only the main thread, not all
                    threads
           Product: lldb
           Version: 3.6
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: berykubik at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 14997
  --> https://llvm.org/bugs/attachment.cgi?id=14997&action=edit
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)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151004/acab483c/attachment.html>


More information about the llvm-bugs mailing list