<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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: Connecting to remote server leaves the process in unloaded state"
   href="https://llvm.org/bugs/show_bug.cgi?id=24384">24384</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Python API: Connecting to remote server leaves the process in unloaded state
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.7
          </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@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>john.ch.fr@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Tested using the svn revision 244212 (3.8.0).
Everything works fine in lldb's CLI. The issue is only with the Python API.
After getting connected, the process is left in "unloaded" state.
The same thing happened with the stable 3.6.2 release too.

=== server output ===

$ lldb-server g :1234 target/debug/des
using the default platform: host
Launched 'target/debug/des' as process 22203...
lldb-server-local_buildListening to port 1234 for a connection from
localhost...
Connection established.

=== python try 1 ===

<span class="quote">>>> import lldb
>>> d = lldb.SBDebugger.Create()
>>> t = d.CreateTargetWithFileAndArch(None, None)
>>> l = lldb.SBListener()
>>> e = lldb.SBError()
>>> p = t.ConnectRemote(l, "connect://localhost:1234", None, e)
>>> s = lldb.SBStream()
>>> p.GetDescription(s)</span >
True
<span class="quote">>>> print s.GetData()</span >
SBProcess: pid = 22203, state = unloaded, threads = 1, executable = des

=== try 2: using command interpretter ===

<span class="quote">>>> import lldb
>>> d = lldb.SBDebugger.Create()
>>> ci = d.GetCommandInterpreter()
>>> cro = lldb.SBCommandReturnObject()
>>> ci.HandleCommand('gdb-remote 1234', cro)</span >
1
<span class="quote">>>> ci.HandleCommand('process status', cro)</span >
1
<span class="quote">>>> print cro.GetOutput()</span >
Process 16338 unloaded
* thread #1: tid = 16338, 0x00007f6764d99d80, name = 'des', stop reason =
signal SIGSTOP
    frame #0: 0x00007f6764d99d80
->  0x7f6764d99d80: movq   %rsp, %rdi
    0x7f6764d99d83: callq  0x7f6764d9db10
    0x7f6764d99d88: movq   %rax, %r12
    0x7f6764d99d8b: movl   0x220ec7(%rip), %eax

<span class="quote">>>> ci.HandleCommand('process continue', cro)</span >
6
<span class="quote">>>> print cro.GetError()</span >
error: Process must be launched.

<span class="quote">>>> ci.HandleCommand('process launch', cro)</span >
There is a running process, kill it and restart?: [Y/n] n
6</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>