Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backtrace contains function names with MIR, but not on MSVC. #32384

Closed
eddyb opened this issue Mar 21, 2016 · 4 comments
Closed

Backtrace contains function names with MIR, but not on MSVC. #32384

eddyb opened this issue Mar 21, 2016 · 4 comments
Labels
A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. O-windows-msvc Toolchain: MSVC, Operating system: Windows

Comments

@eddyb
Copy link
Member

eddyb commented Mar 21, 2016

From http://buildbot.rust-lang.org/builders/auto-win-msvc-64-opt-mir/builds/9/steps/test/logs/stdio:

thread '<main>' panicked at 'explicit panic', C:/bot/slave/auto-win-msvc-64-opt-mir/build/src/test/run-pass/backtrace.rs:23
stack backtrace:
   0:      0x7feeb726289 - sys::backtrace::Cleanup.Drop::drop::h9efecea147e63d6fECu
   1:      0x7feeb73da2e - panicking::Location<'a>::line::h0bafe181f48d2793YZz
   2:      0x7feeb73ce05 - panicking::set_hook::h43cadfa78fcc3418FWz
   3:      0x7feeb6d569c - sys_common::unwind::begin_unwind_inner::h944552b52ab4b9efoyt
   4:        0x13ffe1129 - __ImageBase
   5:        0x13ffe1089 - __ImageBase
   6:        0x13ffe347f - __ImageBase
   7:      0x7feeb73bba9 - rt::lang_start::h6c718470b597915boSz
   8:      0x7feeb7210d8 - sys_common::unwind::inner_try::hcf25cf847275bec0qvt
   9:      0x7feeb73b920 - rt::lang_start::h6c718470b597915boSz
  10:        0x13ffe7a02 - __tmainCRTStartup
                        at f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:626
  11:         0x771e652c - BaseThreadInitThunk

Instead of the actual function names, we get __ImageBase - which suggests internal functions don't get symbols on MSVC without debuginfo, but what part of debuginfo does it need? cc @michaelwoerister

The test also passes on linux w/ MIR - http://buildbot.rust-lang.org/builders/auto-linux-64-opt-mir/builds/10/steps/test/logs/stdio contains:

test [run-pass] run-pass/backtrace.rs ... ok

This is blocking gating on the auto-win-msvc-64-opt-mir. cc @alexcrichton

@eddyb eddyb added A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html O-windows-msvc Toolchain: MSVC, Operating system: Windows labels Mar 21, 2016
@retep998
Copy link
Member

which suggests internal functions don't get symbols on MSVC without debuginfo

The function address -> symbol name information is in the .pdb produced by the linker. When Rust does not emit debug info it still tells the linker to emit a .pdb, but since the object files don't have any debug info, the only symbol names they have are for symbols that are publicly visible to other object files. Thus symbols internal to object files don't get resolved in backtraces..

@eddyb
Copy link
Member Author

eddyb commented Mar 21, 2016

From @retep998 (aka WindowsBunny) on IRC:

<eddyb> WindowsBunny: so you're telling me if I don't have debuginfo for an instruction
<eddyb> it can't be resolved back to a function?
<WindowsBunny> yep
<WindowsBunny> eddyb: The names of functions internal to an object file aren't stored anywhere
<WindowsBunny> there is nothing for the linker to dig up to shove into the .pdb

So it seems we can't do anything about this other than to make it not use MIR on MSVC.

@eddyb eddyb added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Mar 21, 2016
@eddyb
Copy link
Member Author

eddyb commented Mar 21, 2016

The fix should be to add, at the top of the test:

#![feature(rustc_attrs)]

And before each of fn foo and fn double:

// FIXME #31005 MIR missing debuginfo currently.
#[cfg_attr(target_env = "msvc", rustc_no_mir)]

I can't test it myself as I have no MSVC setup currently and I don't want to waste buildbot time.

@alexcrichton
Copy link
Member

Yeah this test just required debuginfo on MSVC for now, seems fine to disable MIR temporarily while we sort out that story for this test specifically.

eddyb added a commit to eddyb/rust that referenced this issue Mar 23, 2016
Annotate run-pass/backtrace with #[rustc_no_mir] on MSVC.

Fixes rust-lang#32384 by not using MIR on MSVC for the functions in the path of the backtrace.
This is the known blocker for the MSVC MIR builder, hopefully the only one overall.
r? @alexcrichton Confirmed to work on a nightly, by @retep998.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. O-windows-msvc Toolchain: MSVC, Operating system: Windows
Projects
None yet
Development

No branches or pull requests

3 participants