Panic in a release or debug built on windows shows <unknown>

If I copy an exe built on windows with cargo build or cargo build --release and then copy just that exe to another windows machine, any panics result in:

stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: BaseThreadInitThunk
  16: RtlUserThreadStart
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I'm not explicitly stripping anything and I don't have any .cargo\config set.

Am I wrong to expect the backtrace to remember the call hierarchy by default? Must I do something special?

Thanks! :slight_smile:

Versions:

stable-x86_64-pc-windows-msvc (default)
rustc 1.42.0 (b8cedc004 2020-03-09)

On Windows, debug symbols (information used when generating backtraces to correlate stack frames with function names) are typically stored in a separate *.pdb file. If you copy the executable around you'll also need to copy the PDB file to get nice backtraces.

On linux this isn't normally an issue because debug symbols are embedded in the executable itself, which is one of the reasons people complain about Rust generating fat binaries.

Thanks Michael. I guess that is why my EXE is 1MB and my PDB file is 28MB :slight_smile:

1 Like

For those who find this - be aware of https://github.com/rust-lang/cargo/issues/2087 as well!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.