I have a lack of details while debugging a code produced by rustc with GDB. Help me to understand how to get more details while debugging.
Let's start.
$ rust-gdb ./hello_world
(gdb) directory /usr/local/src/rustc-1.4.0/src
Source directories searched: /usr/local/src/rustc-1.4.0/src:/usr/local/lib/rustlib/etc:$cdir:$cwd
(gdb) list
1 fn main() {
2 println!("Hello World!");
3 }
(gdb) b 2
Breakpoint 1 at 0x538c: file main.rs, line 2.
(gdb) run
Breakpoint 1, hello_world::main () at main.rs:2
2 println!("Hello World!");
(gdb) s
hello_world::fmt::Arguments<'a>::new_v1 (pieces=&[&str](len: 1) = {...},
args=&[core::fmt::ArgumentV1](len: 0)) at ../src/libcore/fmt/mod.rs:226
226 args: &'a [ArgumentV1<'a>]) -> Arguments<'a> {
There are no problems in previous log. It's just for understanding initial conditions. Note, there is successful step into the library code at "../src/libcore/fmt/mod.rs:226" which hints me that linked standard library was built with debug information.
(gdb) s
Hello World!
hello_world::main () at main.rs:3
3 }
First question. Why I doesn't stepped into all the code about printing (I'm talking about fn _print() from "/usr/local/src/rustc-1.4.0/src/libstd/io/stdio.rs:578") and instead came out to the line 3 of main.rs?
Seems like debug information available only for part of standard library. What I have to do to be able to step through the all standard library code?
(gdb) s
0x0000555555561965 in sys_common::unwind::try::try_fn::h4848098439110500489 ()
Second question. Why this code have no source information (like "../src/libcore/fmt/mod.rs:226" in the previous log)? How to make it available?
fn try_fn() located at "/usr/local/src/rustc-1.4.0/src/libstd/sys/common/unwind/mod.rs:162" but this information is missed.
... (skipped some similar lines)
(gdb) s
Single stepping until exit from function main,
which has no line number information.
__libc_start_main (main=0x555555559400 <main>, argc=1, argv=0x7fffffffdf68,
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
stack_end=0x7fffffffdf58) at libc-start.c:321
321 libc-start.c: No such file or directory.
Third question. How to find out which library source and it's version I have to install to be able to step into "libc-start.c:321"?