Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

backtrace: report real path to core / std source code #65

Open
japaric opened this issue Sep 17, 2020 · 2 comments
Open

backtrace: report real path to core / std source code #65

japaric opened this issue Sep 17, 2020 · 2 comments
Labels
difficulty: medium Somewhat difficult to solve priority: low Low priority for the Knurling team status: needs PR Issue just needs a Pull Request implementing the changes topic: backtrace type: enhancement Enhancement or feature request

Comments

@japaric
Copy link
Member

japaric commented Sep 17, 2020

if the rust-std component is installed.

currently we report the build machine paths:

   2: core::panicking::panic_fmt
        at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/libcore/panicking.rs:85
   3: core::panicking::panic
        at /rustc/04488afe34512aa4c33566eb16d8c912a3ae04f9/src/libcore/panicking.rs:50

but we could do what the standard library does and report the path to $(rustc --print sysroot)

  11: std::panicking::begin_panic
             at /home/japaric/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libstd/panicking.rs:456

the goal is to make VS code's "open file location in editor" work

@japaric japaric added the type: enhancement Enhancement or feature request label Sep 17, 2020
@japaric japaric added difficulty: medium Somewhat difficult to solve status: needs PR Issue just needs a Pull Request implementing the changes labels Nov 16, 2020
@Urhengulas Urhengulas added the priority: low Low priority for the Knurling team label Mar 1, 2021
@japaric japaric self-assigned this May 17, 2021
@japaric
Copy link
Member Author

japaric commented May 17, 2021

/rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/src/libcore/panicking.rs:92

it's not straightforward to map the git hash in this path to a local rust-src component (Rust source code)

It may be most accurate to change these paths into https://github.com/rust-lang/rust/blob/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/panicking.rs#L92 but this can't be opened in VS code.

The rust-docs component provides a file in $(rustc --print sysroot)/share/doc/rust/html/version_info.html with these contents:

<div id="versioninfo">
  <img src="https://www.rust-lang.org/logos/rust-logo-32x32-blk.png" width="32" height="32" alt="Rust logo"><br>
  <span class="white-sticker"><a href="https://www.rust-lang.org">Rust</a> 1.52.1</span><br>
  <a href="https://github.com/rust-lang/rust/commit/9bc8c42bb2f19e745a63f3445f1ac248fb015e53"
    class="hash white-sticker">9bc8c42bb</a>
</div>

The info therein can be used to check if any of the installed Rust toolchains has the same git hash as the one in the rust-std paths stored in the debuginfo.

@japaric
Copy link
Member Author

japaric commented May 17, 2021

On the other hand it seems that rustc debug info remapping sometimes works and automatically maps /rustc/ paths into local paths that point into the rust-src component as seen in #201 but I can't repro

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
difficulty: medium Somewhat difficult to solve priority: low Low priority for the Knurling team status: needs PR Issue just needs a Pull Request implementing the changes topic: backtrace type: enhancement Enhancement or feature request
Projects
None yet
Development

No branches or pull requests

2 participants