LLDB does not display source for Rust program on FreeBSD 12

265 views Asked by At

When using LLDB to debug a simple Rust program, I am not shown the source code. It seems like the debug information can not be read. Here is a log of what I am trying to do. To double-check, I have also done a test with a small C++ program and its source displays fine.

There is no change when using stable Rust or when leaving out the [profile.dev] section of Cargo.toml.

The same thing works fine on an Arch Linux machine with LLDB 3.9.1 and stable Rust.

~/tsupdate_rust/target% lldb --version
lldb version 3.9.0 ( revision )
~/tsupdate_rust/target% rustc --version
rustc 1.16.0-nightly (468227129 2017-01-03)
~/tsupdate_rust/target% uname -a
FreeBSD trueos-7337.west-gmbh 12.0-CURRENT FreeBSD 12.0-CURRENT #11 8b9df91(drm-next-4.7): Sat Dec 24 15:17:28 UTC 2016     root@gauntlet:/usr/obj/usr/src/sys/GENERIC  amd64
~/tsupdate_rust/target% cargo build
    Finished debug [unoptimized + debuginfo] target(s) in 0.1 secs
~/tsupdate_rust/target% lldb debug/tsupdate test 7.10
(lldb) target create "debug/tsupdate"
Current executable set to 'debug/tsupdate' (x86_64).
(lldb) settings set -- target.run-args  "test" "7.10"
(lldb) b tsupdate::main
Breakpoint 1: where = tsupdate`tsupdate::main::h8bec70c0222b27b2 + 11, address = 0x00000000000a882b
(lldb) r
Process 7265 launching
Process 7265 launched: '/usr/home/ualt/tsupdate_rust/target/debug/tsupdate' (x86_64)
Process 7265 stopped
* thread #1: tid = 101113, 0x00000000010c982b tsupdate`tsupdate::main::h8bec70c0222b27b2 + 11, stop reason = breakpoint 1.1
    frame #0: 0x00000000010c982b tsupdate`tsupdate::main::h8bec70c0222b27b2 + 11
tsupdate`tsupdate::main::h8bec70c0222b27b2:
->  0x10c982b <+11>: movb   $0x0, -0x2e1(%rbp)
    0x10c9832 <+18>: movb   $0x0, -0x2de(%rbp)
    0x10c9839 <+25>: movb   $0x0, -0x2db(%rbp)
    0x10c9840 <+32>: movb   $0x0, -0x2d9(%rbp)
(lldb) image list
[  0] 01FC6739-0000-0000-0000-000000000000                    /usr/home/ualt/tsupdate_rust/target/debug/tsupdate
[  1] 1F9F33BA-0000-0000-0000-000000000000                    /lib/libthr.so.3
      /usr/lib/debug/lib/libthr.so.3.debug
[  2] C0DF7F3D-0000-0000-0000-000000000000                    /lib/libgcc_s.so.1
      /usr/lib/debug/lib/libgcc_s.so.1.debug
[  3] 53AD8C42-0000-0000-0000-000000000000                    /lib/libc.so.7
      /usr/lib/debug/lib/libc.so.7.debug
[  4] D9B23F51-0000-0000-0000-000000000000                    /libexec/ld-elf.so.1
      /usr/lib/debug/libexec/ld-elf.so.1.debug
(lldb) script lldb.target.module['/usr/home/ualt/tsupdate_rust/target/debug/tsupdate']
<lldb.SBModule; proxy of <Swig Object of type 'lldb::SBModule *' at 0x808f3d660> >
(lldb) script lldb.target.module['/usr/home/ualt/tsupdate_rust/target/debug/tsupdate'].GetNumCompileUnits()
60
(lldb) q
Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] y
~/tsupdate_rust/target% 
~/tsupdate_rust/target% cd ~/cpp
~/cpp% clang++ --version
clang version 3.9.0 (tags/RELEASE_390/final)
Target: x86_64-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/local/llvm39/bin
~/cpp% clang++ -g hello.cc 
~/cpp% lldb a.out
(lldb) target create "a.out"
Current executable set to 'a.out' (x86_64).
(lldb) b main
Breakpoint 1: where = a.out`main + 35 at hello.cc:4, address = 0x0000000000401083
(lldb) r
Process 7562 launching
Process 7562 launched: '/usr/home/ualt/cpp/a.out' (x86_64)
Process 7562 stopped
* thread #1: tid = 101114, 0x0000000000401083 a.out`main + 35 at hello.cc:4, stop reason = breakpoint 1.1
    frame #0: 0x0000000000401083 a.out`main + 35 at hello.cc:4
   1    #include <iostream>
   2   
   3    int main() {
-> 4      std::cout << "Hello !" << std::endl;
   5      return 0;
   6    }
   7   
(lldb) q
Quitting LLDB will kill one or more processes. Do you really want to proceed: [Y/n] 

Cargo.toml

[package]
name = "tsupdate"
version = "0.1.0"
authors = ["ualt"]

[dependencies]
regex = "^0.2.1"
yaml-rust = "^0.3.5"
docopt = "^0.6.86"
rustc-serialize = "^0.3.22"
hyper = { version = "0.9", default-features=false, features=[] }
md5 = "^0.3.2"

[profile.dev]
opt-level = 0
debug = true
lto = false
rpath = false
debug-assertions = true
codegen-units = 1
panic = 'unwind'
0

There are 0 answers