<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 - "error: this file does not represent a loadable dylib" when loading libsosplugin.so plugin from Python"
   href="https://bugs.llvm.org/show_bug.cgi?id=36540">36540</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"error: this file does not represent a loadable dylib" when loading libsosplugin.so plugin from Python
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>4.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>evgeny@loop54.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm trying to run the following Python script on Ubuntu 16.04.4 x64:

import lldb
import sys

pid = int(sys.argv[1])
print("Attaching to process %d using %s" % (pid,
lldb.SBDebugger.GetVersionString()))

debugger = lldb.SBDebugger.Create()
target = debugger.CreateTarget('')

error = lldb.SBError()
process = target.AttachToProcessWithID(debugger.GetListener(), pid, error)
if not error.Success():
        raise Exception("Failed to attach")

sos_path = "/opt/dotnet/shared/Microsoft.NETCore.App/2.0.5/libsosplugin.so"
debugger.HandleCommand("plugin load %s" % sos_path)


It gives an error:

$ python loadsostest.py 2036
Attaching to process 2036 using lldb version 4.0.0
error: this file does not represent a loadable dylib


However, I can load the same plugin successfully from the command line:

lldb-4.0 -o "plugin load
/opt/dotnet/shared/Microsoft.NETCore.App/2.0.5/libsosplugin.so" -p 2036

(lldb) process attach --pid 2036
Process 2036 stopped
...
Executable module set to "/opt/dotnet/dotnet".
Architecture set to: x86_64-pc-linux.
(lldb) plugin load
/opt/dotnet/shared/Microsoft.NETCore.App/2.0.5/libsosplugin.so
LLDB version: 'lldb version 4.0.0'(lldb)</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>