[lldb-dev] [Bug 50269] New: lldb cannot connect to debugserver using python API

via lldb-dev lldb-dev at lists.llvm.org
Fri May 7 22:16:37 PDT 2021


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

            Bug ID: 50269
           Summary: lldb cannot connect to debugserver using python API
           Product: lldb
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: nisargjhaveri at gmail.com
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

The following set of commands work fine and in the lldb cli, the same set of
commands fails with `error: the platform is not currently connected` when run
from python using the `debugger.GetCommandInterpreter().HandleCommand`


lldb CLI (works):

```
(lldb) platform select remote-macosx
(lldb) target create ~/Projects/vscode-lldb/build/debuggee/debuggee
(lldb) process connect connect://127.0.0.1:1234
(lldb) process launch 
Process 64302 launched:
'/Users/nisarg/Projects/vscode-lldb/build/debuggee/debuggee' (x86_64)
...
```

Python (error: the platform is not currently connected):
-------
>>> import sys; sys.path.append('/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Resources/Python3')
>>> from lldb import *
>>> debugger = SBDebugger.Create()
>>> inter = debugger.GetCommandInterpreter()
>>> res = SBCommandReturnObject()
>>> commands = ['platform select remote-macosx', >'target create /Users/nisarg/Projects/vscode-lldb/build/debuggee/debuggee', 'process connect connect://127.0.0.1:1234', 'process launch']
>>> for command in commands: inter.HandleCommand(command, res); print(command); print(res.Succeeded()); print(res.GetOutput(), "\n", res.GetError())
... 
2
platform select remote-macosx
True
  Platform: remote-macosx
 Connected: no


1
target create /Users/nisarg/Projects/vscode-lldb/build/debuggee/debuggee
True
Current executable set to
'/Users/nisarg/Projects/vscode-lldb/build/debuggee/debuggee' (x86_64).


1
process connect connect://127.0.0.1:1234
True


There is a running process, kill it and restart?: [Y/n] y
6
process launch
False

 error: the platform is not currently connected
-------


I'm starting the debugserver using the following command in both the case.
```
$ debugserver 127.0.0.1:1234
```

I'm using the lldb bundled with Xcode 12.4.

Expected behavior: the same set of commands should result in the same outcome
whether run in cli or via python api.

I tried directly using python apis to connect and launch the process, but
couldn't figure out that either. It was giving the same error as platform not
connected. Also after connecting, the process status becomes unloaded and not
connected.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20210508/0e4c89dd/attachment.html>


More information about the lldb-dev mailing list