Closed
Description
I tried this:
$ cat hello.rs
fn main() {
println!("Hello world!");
}
$ rustc -g hello.rs
$ ./hello
Hello world!
$ lldb hello
(lldb) target create "hello"
Current executable set to 'hello' (x86_64).
(lldb) source list
(lldb)
(lldb) b 2
error: No selected frame to use to find the default file.
error: No file supplied and no default file available.
I expected LLDB to actually be able to associate an executable compiled with debugging information to be able to list source code and set breakpoints. Compare GDB's support on the same machine (gdb 7.11 built from homebrew and self-signed for debugging privileges):
$ gdb hello
GNU gdb (GDB) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin15.4.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hello...Reading symbols from /Users/matt/hello.dSYM/Contents/Resources/DWARF/hello...done.
done.
(gdb) l
1 fn main() {
2 println!("Hello world!");
3 }
(gdb) b 2
Breakpoint 1 at 0x1000013e8: file hello.rs, line 2.
LLDB seems functional otherwise, with sources compiled with Clang
$ clang++ -g hello.cpp
$ lldb a.out
(lldb) target create "a.out"
Current executable set to 'a.out' (x86_64).
(lldb) source list
3 int main() {
4 std::cout << "Hello, World!!" << std::endl;
5
6 return 0;
7 }
(lldb)
If anyone's curious, the rust-lldb wrapper does nothing to alleviate this (nor is it intended to AFAIK):
$ rust-lldb hello
(lldb) command source -s 0 '/tmp/rust-lldb-commands.r9S6q9'
Executing commands in '/tmp/rust-lldb-commands.r9S6q9'.
(lldb) command script import "/usr/local/Cellar/rust/1.8.0/lib/rustlib/etc/lldb_rust_formatters.py"
(lldb) type summary add --no-value --python-function lldb_rust_formatters.print_val -x ".*" --category Rust
(lldb) type category enable Rust
(lldb) target create "hello"
Current executable set to 'hello' (x86_64).
(lldb) source list
(lldb) b 2
error: No selected frame to use to find the default file.
error: No file supplied and no default file available.
(lldb)
Meta
$ lldb -v
lldb-350.0.21.9
$ uname -a
Darwin mycomp 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
$ rustc --version --verbose
rustc 1.8.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-apple-darwin
release: 1.8.0
This rust was installed from Homebrew. This issue also occurred with 1.7.0.