<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Python API: process will never stopped at a breakpoint when using LaunchSimple (lldb trunk)"
   href="https://bugs.llvm.org/show_bug.cgi?id=46149">46149</a>
          </td>
        </tr>
        <tr>
          <th>Summary</th>
          <td>Python API: process will never stopped at a breakpoint when using LaunchSimple (lldb trunk)
          </td>
        </tr>
        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>
        <tr>
          <th>Version</th>
          <td>unspecified
          </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>yangyibiao@hust.edu.cn
          </td>
        </tr>
        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When using python api to debugging an executable, the process is never reaching
to a breakpoint. 
When using lldb in terminal, there is no such problem. 
Consider a python script:
...
$ cat test.py
#!/usr/bin/python3
import lldb
import os
import pdb
debugger = lldb.SBDebugger.Create()
debugger.SetAsync(False)
target = debugger.CreateTarget("./a.out")
if target:
    main_bp = target.BreakpointCreateByName("main",
target.GetExecutable().GetFilename())
    print(main_bp)
    process = target.LaunchSimple(None, None, os.getcwd())
    if process:
        print(process)
lldb.SBDebugger.Terminate()
...
the output from python:
...
$ python3 test.py
SBBreakpoint: id = 1, name = 'main', module = a.out, locations = 1
SBProcess: pid = 0, state = launching, threads = 0, executable = a.out
...
$ cat small.c
$ cat small.c
int a, b, d=1;
int main() {
  if (d)
    a = b==0;
  if (a!=1)
    return 1;
  return 0;
}
$ clang -g small.c
$ clang --version
Ubuntu clang version
11.0.0-++20200531052611+dfbfdc96f9e-1~exp1~20200531153245.58 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ lldb --version
lldb version 11.0.0
$ python3 --version
Python 3.8.2</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>