[Bug 24759] The example "Using the lldb.py module in python" is not working on Linux

Louis.Granboulan.Developer@gmail.com changed bug 24759

What | Removed | Added |

  • | - | - |
    Status | RESOLVED | REOPENED |
    Resolution | WORKSFORME | — |

Comment # 4 on bug 24759 from Louis.Granboulan.Developer@gmail.com

I still have the same issue with lldb-3.9.
Here are more details, which may help to understand why it is not teh same for
you.

I compiled a C file containing only "int main(){}" in a binary at /tmp/a.out

Here is an extract from the script at
[http://lldb.llvm.org/python-reference.html](http://lldb.llvm.org/python-reference.html) which reproduces the behaviour.

#!/usr/bin/python
import lldb, os, sys
exe = "/tmp/a.out"
debugger = lldb.SBDebugger.Create()
print debugger.GetVersionString()
debugger.SetAsync (False)
target = debugger.CreateTargetWithFileAndArch (exe, lldb.LLDB_ARCH_DEFAULT)
if not target:
    print "CreateTargetWithFileAndArch failed"
    sys.exit(1)
main_bp = target.BreakpointCreateByName ("main",
target.GetExecutable().GetFilename())
print main_bp
process = target.LaunchSimple (None, None, os.getcwd())
print process

On MacOSX, the output is:

lldb-360.1.70
Creating a target for '/tmp/a.out'
SBBreakpoint: id = 1, name = 'main', module = a.out, locations = 1
SBProcess: pid = 10449, state = stopped, threads = 1, executable = a.out

On Linux, where lldb-3.9.1 is installed using the apt repository from
[http://apt.llvm.org/jessie/](http://apt.llvm.org/jessie/) the output is:

lldb version 3.9.1 ( revision )
SBBreakpoint: id = 1, name = 'main', module = a.out, locations = 1
SBProcess: pid = 0, state = launching, threads = 0, executable = a.out

It is not the same output, and the fact that the process is "launching" rather
than "stopped" makes the rest of the script from
[http://lldb.llvm.org/python-reference.html](http://lldb.llvm.org/python-reference.html) useless.