lldb is not starting an application

2020-07-14 09:00发布

问题:

this is my first experience in commandline mode of lldb. unsuccessful.

  1. installed minimal kit with clang, lld, lldb v5 (ubuntu 16.04)
  2. sample application built with clang.
  3. trying to start:

lldb applcation

>run

error: process launch failed: unable to locate lldb-server-5.0.0

so now the questions:

  1. why lldb tries to run a server? this is not a remote debugging.
  2. why lldb refers to 5.0.0 (and where to change this setting)? actually there was added symbolic links automiticaly with xxx-5.0 suffix to all llvm utilities, but not with xxx-5.0.0. would be reasonable if this refers to lldb-server itself, without suffixes.
  3. adding lldb-server-5.0.0 symlink doesn't solve the problem.

any idea how this should work?

by the way extra question - seems left/right/up/down arrows keys don't work in lldb console? instead of cursor moving it adds a codes

(lldb) ^[[D^[[A^[[C^[[B

回答1:

This is a known bug with LLDB 5.0, apparently related to the Debian packaging. The workaround is similar to the question linked in the comments, but not the same. (And yes, having this exact problem, I've confirmed the solution.)

An strace reveals the problem...

1887 26838 access("/usr/lib/llvm-5.0/bin/lldb-server-5.0.0", F_OK) = -1 ENOENT (No such file or directory)

That indicates exactly where that symlink is needed. Fixing it is as simple as a single terminal command...

$ sudo ln -s /usr/bin/lldb-server-5.0 /usr/lib/llvm-5.0/bin/lldb-server-5.0.0