Bug ID 46149
Summary Python API: process will never stopped at a breakpoint when using LaunchSimple (lldb trunk)
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter yangyibiao@hust.edu.cn
CC jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
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