<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 --- - Unusable with LLVM_LINK_LLVM_DYLIB=ON"
   href="https://llvm.org/bugs/show_bug.cgi?id=24953">24953</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Unusable with LLVM_LINK_LLVM_DYLIB=ON
          </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@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>evangelos@foutrelis.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>Created <span class=""><a href="attachment.cgi?id=14941" name="attach_14941" title="GDB backtrace">attachment 14941</a> <a href="attachment.cgi?id=14941&action=edit" title="GDB backtrace">[details]</a></span>
GDB backtrace

The following is with LLVM/LLDB 3.7.0 with the LLVM_LINK_LLVM_DYLIB CMake
option backported and enabled. (The issue is reproducible on /trunk as well.)

Attempting to run a program under lldb results in a segfault as soon as the
'run' command is given. The crash occurs when
AssemblyParse_x86::instruction_length() calls LLVMDisasmInstruction() with a
NULL LLVMDisasmContextRef pointer (m_disasm_context).

m_disasm_context is initialized in AssemblyParse_x86's constructor to the
pointer returned by LLVMCreateDisasm(). The latter returns a nullptr because
TargetRegistry::lookupTarget() fails to find the target
(x86_64-unknown-linux-gnu) in the registry. The actual error reads "Unable to
find target for this triple (no targets are registered)".

Attached is a backtrace that shows where lldb crashes. Note that specifying
LLVM_LINK_LLVM_DYLIB=OFF (which I believe makes lldb link statically to LLVM)
results in a working 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>