Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rust Backtrace on windows?

I am trying to run my project https://github.com/comit-network/create-comit-app/ (master branch) on windows (I usually code on unix systems).

It panics but I am not able to get a backtrace despite settings RUST_BACKTRACE=1 or even RUST_BACKTRACE=full.

I am compiling and running on the same machine.

Here is what I get:

C:/Users/dante/.cargo/bin/cargo.exe run --color=always --package create-comit-app --bin create-comit-app --no-default-features -- start-env
   Compiling create-comit-app v0.5.0 (C:\Users\dante\src\create-comit-app)
    Finished dev [unoptimized + debuginfo] target(s) in 25.36s
     Running `target\debug\create-comit-app.exe start-env`
Panic received, cleaning up...Panic received, cleaning up...thread panicked while processing panic. aborting.
error: process didn't exit successfully: `target\debug\create-comit-app.exe start-env` (exit code: 0xc000001d, STATUS_ILLEGAL_INSTRUCTION)

Process finished with exit code -1073741795 (0xC000001D)

After some research it seems that it should be possible to get a BACKTRACE on windows?

I am coding and running on the same machine:

Rust: 1.39.0
>rustc --version
rustc 1.39.0 (4560ea788 2019-11-04)
>rustup toolchain list
stable-x86_64-pc-windows-msvc (default)
nightly-2019-04-30-x86_64-pc-windows-msvc
1.35.0-x86_64-pc-windows-msvc
1.37.0-x86_64-pc-windows-msvc
1.38.0-x86_64-pc-windows-msvc
1.39.0-x86_64-pc-windows-msvc

Also it looks like I cannot debug with -msvc toolchain and can only debug with -gnu. Trying to install the gnu chain now.

Anyone with windows experience in Rust?

like image 922
Dante Avatar asked Dec 02 '19 00:12

Dante


2 Answers

When using cmd, it's

set RUST_BACKTRACE=1
set RUST_BACKTRACE=full

when using powershell, it's

$env:RUST_BACKTRACE=1
$env:RUST_BACKTRACE="full"

e.g.

$env:RUST_BACKTRACE=1; cargo run

How do I run 'cargo test' with RUST_BACKTRACE=1 on Windows?

about Environment Variables - PowerShell | Microsoft Docs

set - cmd | Microsoft Docs

like image 77
cc01cc Avatar answered Sep 17 '22 19:09

cc01cc


This works perfectly fine on windows -

$env:RUST_BACKTRACE=1; cargo run
like image 36
Stormbreaker Avatar answered Sep 18 '22 19:09

Stormbreaker