@@ -40,25 +40,6 @@ how to fix it, you could send a PR. :smile:
40
40
cargo run --bin miri tests/run-pass-fullmir/vecs.rs # Or whatever test you like.
41
41
```
42
42
43
- ## Debugging
44
-
45
- Since the heart of miri (the main interpreter engine) lives in rustc, tracing
46
- the interpreter requires a version of rustc compiled with tracing. To this
47
- end, you will have to compile your own rustc:
48
- ```
49
- git clone https://github.com/rust-lang/rust/ rustc
50
- cd rustc
51
- cp config.toml.example config.toml
52
- # Now edit `config.toml` and set `debug-assertions = true`
53
- ./x.py build src/rustc
54
- rustup toolchain link custom build/x86_64-unknown-linux-gnu/stage2
55
- ```
56
- The ` build ` step can take 30 to 60 minutes.
57
-
58
- Now, in the miri directory, you can ` rustup override set custom ` and re-build
59
- everything. Finally, if you now set ` RUST_LOG=rustc_mir::interpret=trace ` as
60
- environment variable, you will get detailed step-by-step tracing information.
61
-
62
43
## Running miri on your own project('s test suite)
63
44
64
45
Install miri as a cargo subcommand with ` cargo install --debug ` .
@@ -68,8 +49,8 @@ through miri.
68
49
69
50
## Running miri with full libstd
70
51
71
- Per default libstd does not contain the MIR of non-polymorphic functions. When
72
- miri hits a call to such a function, execution terminates. To fix this, it is
52
+ Per default libstd does not contain the MIR of non-polymorphic functions. When
53
+ miri hits a call to such a function, execution terminates. To fix this, it is
73
54
possible to compile libstd with full MIR:
74
55
75
56
``` sh
@@ -91,6 +72,37 @@ your toolchain changes (e.g., when you update the nightly).
91
72
You can also set ` -Zmiri-start-fn ` to make miri start evaluation with the
92
73
` start_fn ` lang item, instead of starting at the ` main ` function.
93
74
75
+ ## Development and Debugging
76
+
77
+ Since the heart of miri (the main interpreter engine) lives in rustc, working on
78
+ miri will often require using a locally built rustc. This includes getting a
79
+ trace of the execution, as distributed rustc has ` trace! ` disabled.
80
+
81
+ The first-time setup for a local rustc looks as follows:
82
+ ```
83
+ git clone https://github.com/rust-lang/rust/ rustc
84
+ cd rustc
85
+ cp config.toml.example config.toml
86
+ # Now edit `config.toml` and set `debug-assertions = true`
87
+ ./x.py build src/rustc
88
+ # You may have to change the architecture in the next command
89
+ rustup toolchain link custom build/x86_64-unknown-linux-gnu/stage2
90
+ # Now cd to your miri directory
91
+ rustup override set custom
92
+ ```
93
+ The ` build ` step can take 30 minutes and more.
94
+
95
+ Now you can ` cargo build ` miri, and you can ` cargo test --tests ` . (` --tests `
96
+ is needed to skip doctests because we have not built rustdoc for your custom
97
+ toolchain.) You can also set ` RUST_LOG=rustc_mir::interpret=trace ` as
98
+ environment variable to get a step-by-step trace.
99
+
100
+ If you changed something in rustc and want to re-build, run
101
+ ```
102
+ ./x.py build src/rustc --keep-stage 0
103
+ ```
104
+ This avoids rebuilding the entire stage 0, which can save a lot of time.
105
+
94
106
## Contributing and getting help
95
107
96
108
Check out the issues on this GitHub repository for some ideas. There's lots that
0 commit comments