Skip to content

Commit

Permalink
Add line numbers to the backtrace in 9.1
Browse files Browse the repository at this point in the history
This should fix rust-lang#497.
  • Loading branch information
evuez committed Mar 28, 2017
1 parent a2c5687 commit 05b4402
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 21 deletions.
2 changes: 2 additions & 0 deletions second-edition/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 +320,5 @@ wouldn
writeln
WriteMessage
yyyy
libpanic
unix
54 changes: 33 additions & 21 deletions second-edition/src/ch09-01-unrecoverable-errors-with-panic.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,28 +115,40 @@ try that. Listing 9-1 shows the output:
$ RUST_BACKTRACE=1 cargo run
Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
Running `target/debug/panic`
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is
100', /stable-dist-rustc/build/src/libcollections/vec.rs:1395
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 100', /stable-dist-rustc/build/src/libcollections/vec.rs:1392
stack backtrace:
1: 0x10922522c -
std::sys::imp::backtrace::tracing::imp::write::h1204ab053b688140
2: 0x10922649e -
std::panicking::default_hook::{{closure}}::h1204ab053b688140
3: 0x109226140 - std::panicking::default_hook::h1204ab053b688140
4: 0x109226897 -
std::panicking::rust_panic_with_hook::h1204ab053b688140
5: 0x1092266f4 - std::panicking::begin_panic::h1204ab053b688140
6: 0x109226662 - std::panicking::begin_panic_fmt::h1204ab053b688140
7: 0x1092265c7 - rust_begin_unwind
8: 0x1092486f0 - core::panicking::panic_fmt::h1204ab053b688140
9: 0x109248668 -
core::panicking::panic_bounds_check::h1204ab053b688140
10: 0x1092205b5 - <collections::vec::Vec<T> as
core::ops::Index<usize>>::index::h1204ab053b688140
11: 0x10922066a - panic::main::h1204ab053b688140
12: 0x1092282ba - __rust_maybe_catch_panic
13: 0x109226b16 - std::rt::lang_start::h1204ab053b688140
14: 0x1092206e9 - main
1: 0x560ed90ec04c - std::sys::imp::backtrace::tracing::imp::write::hf33ae72d0baa11ed
at /stable-dist-rustc/build/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
2: 0x560ed90ee03e - std::panicking::default_hook::{{closure}}::h59672b733cc6a455
at /stable-dist-rustc/build/src/libstd/panicking.rs:351
3: 0x560ed90edc44 - std::panicking::default_hook::h1670459d2f3f8843
at /stable-dist-rustc/build/src/libstd/panicking.rs:367
4: 0x560ed90ee41b - std::panicking::rust_panic_with_hook::hcf0ddb069e7beee7
at /stable-dist-rustc/build/src/libstd/panicking.rs:555
5: 0x560ed90ee2b4 - std::panicking::begin_panic::hd6eb68e27bdf6140
at /stable-dist-rustc/build/src/libstd/panicking.rs:517
6: 0x560ed90ee1d9 - std::panicking::begin_panic_fmt::hfea5965948b877f8
at /stable-dist-rustc/build/src/libstd/panicking.rs:501
7: 0x560ed90ee167 - rust_begin_unwind
at /stable-dist-rustc/build/src/libstd/panicking.rs:477
8: 0x560ed911401d - core::panicking::panic_fmt::hc0f6d7b2c300cdd9
at /stable-dist-rustc/build/src/libcore/panicking.rs:69
9: 0x560ed9113fc8 - core::panicking::panic_bounds_check::h02a4af86d01b3e96
at /stable-dist-rustc/build/src/libcore/panicking.rs:56
10: 0x560ed90e71c5 - <collections::vec::Vec<T> as core::ops::Index<usize>>::index::h98deddf4e2a74c41
at /stable-dist-rustc/build/src/libcollections/vec.rs:1392
11: 0x560ed90e727a - panic::main::h5d6b77c20526bc35
at /home/you/projects/panic/src/main.rs:4
12: 0x560ed90f5d6a - __rust_maybe_catch_panic
at /stable-dist-rustc/build/src/libpanic_unwind/lib.rs:98
13: 0x560ed90ee926 - std::rt::lang_start::hd7c880a37a646e81
at /stable-dist-rustc/build/src/libstd/panicking.rs:436
at /stable-dist-rustc/build/src/libstd/panic.rs:361
at /stable-dist-rustc/build/src/libstd/rt.rs:57
14: 0x560ed90e7302 - main
15: 0x7f0d53f16400 - __libc_start_main
16: 0x560ed90e6659 - _start
17: 0x0 - <unknown>
```

<span class="caption">Listing 9-1: The backtrace generated by a call to
Expand Down

0 comments on commit 05b4402

Please sign in to comment.