You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/building/bootstrapping/debugging-bootstrap.md
+58-32
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Debugging bootstrap
2
2
3
-
> FIXME: this page could be expanded
3
+
> FIXME: this section should be expanded
4
4
5
5
## `tracing` in bootstrap
6
6
@@ -10,21 +10,69 @@ Bootstrap has conditional [`tracing`][tracing] setup to provide structured loggi
10
10
11
11
### Enabling `tracing` output
12
12
13
-
Bootstrap will conditionally enable `tracing` output if the `BOOTSTRAP_TRACING` env var is set.
13
+
Bootstrap will conditionally build `tracing` support and enable `tracing` output if the `BOOTSTRAP_TRACING` env var is set.
14
14
15
-
Example usage:
15
+
#### Basic usage
16
+
17
+
Example basic usage[^just-trace]:
18
+
19
+
[^just-trace]: It is not recommend to use *just*`BOOTSTRAP_TRACING=TRACE` because that will dump *everything* at `TRACE` level, including logs intentionally gated behind custom targets as they are too verbose even for `TRACE` level by default.
1. You can specify the log **level**, e.g. `DEBUG` or `TRACE`.
63
+
2. You can also control the log **target**, e.g. `bootstrap` or `bootstrap::core::config` vs custom targets like `CONFIG_HANDLING`.
64
+
- Custom targets are used to limit what is output when `BOOTSTRAP_TRACING=bootstrap=TRACE` is used, as they can be too verbose even for `TRACE` level by default. Currently used custom targets:
65
+
-`CONFIG_HANDLING`
24
66
25
-
[^experimental]: This shows what's *possible* with the infra in an experimental implementation.
67
+
The `TRACE` filter will enable *all*`trace` level or less verbose level tracing output.
26
68
27
-
The env var `BOOTSTRAP_TRACING` accepts a [`tracing` env-filter][tracing-env-filter]. The `TRACE` filter will enable *all*`trace` level or less verbose level tracing output.
69
+
You can of course combine them (custom target logs are typically gated behind `TRACE` log level additionally):
@@ -73,28 +121,6 @@ For `#[instrument]`, it's recommended to:
73
121
- Explicitly pick an instrumentation name via `name = ".."` to distinguish between e.g. `run` of different steps.
74
122
- Take care to not cause diverging behavior via tracing, e.g. building extra things only when tracing infra is enabled.
75
123
76
-
### Enabling `tracing` bootstrap feature in rust-analyzer
124
+
### rust-analyzer integration?
77
125
78
-
You can adjust your `settings.json`'s `rust-analyzer.check.overrideCommand` and `rust-analyzer.cargo.buildScripts.overrideCommand` if you want to also enable `logging` cargo feature by default in your editor. This is mostly useful if you want proper r-a completions and such when working on bootstrap itself.
79
-
80
-
```json
81
-
"rust-analyzer.check.overrideCommand": [
82
-
"BOOTSTRAP_TRACING=1", // <- BOOTSTRAP_TRACING=1 won't enable tracing filter, but it will activate bootstrap's `tracing` feature
Unfortunately, because bootstrap is a `rust-analyzer.linkedProjects`, you can't ask r-a to check/build bootstrap itself with `tracing` feature enabled to get relevant completions, due to lack of support as described in <https://github.com/rust-lang/rust-analyzer/issues/8521>.
|`check-run-results`| Check run test binary `run-{pass,fail}` output snapshot |`ui`, `crashes`, `incremental` if `run-pass`| N/A |
97
-
|`error-pattern`| Check that output contains a specific string |`ui`, `crashes`, `incremental` if `run-pass`| String |
97
+
|`error-pattern`| Check that output contains a specific string |`ui`, `crashes`, `incremental` if `run-pass`| String |
98
98
|`regex-error-pattern`| Check that output contains a regex pattern |`ui`, `crashes`, `incremental` if `run-pass`| Regex |
99
99
|`check-stdout`| Check `stdout` against `error-pattern`s from running test binary[^check_stdout]|`ui`, `crashes`, `incremental`| N/A |
100
100
|`normalize-stderr-32bit`| Normalize actual stderr (for 32-bit platforms) with a rule `"<raw>" -> "<normalized>"` before comparing against snapshot |`ui`, `incremental`|`"<RAW>" -> "<NORMALIZED>"`, `<RAW>`/`<NORMALIZED>` is regex capture and replace syntax |
@@ -152,6 +152,8 @@ Some examples of `X` in `ignore-X` or `only-X`:
0 commit comments