Adds documentation to cover spanview output
Documents the feature introduced in #76074.
This commit is contained in:
parent
2924b6962d
commit
b737f79192
|
|
@ -260,6 +260,24 @@ $ dot -T pdf maybe_init_suffix.dot > maybe_init_suffix.pdf
|
|||
$ firefox maybe_init_suffix.pdf # Or your favorite pdf viewer
|
||||
```
|
||||
|
||||
## Viewing Spanview output (.html files)
|
||||
[viewing-spanview-output]: #viewing-spanview-output
|
||||
|
||||
In addition to [graphviz output](#formatting-graphviz-output), MIR debugging
|
||||
flags include an option to generate a MIR representation called `Spanview` that
|
||||
uses HTML to highlight code regions in the original source code and display
|
||||
compiler metadata associated with each region.
|
||||
[`-Zdump-mir-spanview`](./mir/debugging.md), for example, highlights spans
|
||||
associated with each MIR `Statement`, `Terminator`, and/or `BasicBlock`.
|
||||
|
||||
These `.html` files use CSS features to dynamically expand spans obscured by
|
||||
overlapping spans, and native tooltips (based on the HTML `title` attribute) to
|
||||
reveal the actual MIR elements, as text.
|
||||
|
||||
To view these files, simply use a modern browser, or a CSS-capable HTML preview
|
||||
feature in a modern IDE. (The default HTML preview pane in *VS Code* is known to
|
||||
work, for instance.
|
||||
|
||||
## Narrowing (Bisecting) Regressions
|
||||
|
||||
The [cargo-bisect-rustc][bisect] tool can be used as a quick and easy way to
|
||||
|
|
|
|||
|
|
@ -1,8 +1,16 @@
|
|||
# MIR Debugging
|
||||
|
||||
The `-Zdump-mir` flag can be used to dump a text representation of the MIR. The
|
||||
`-Zdump-mir-graphviz` flag can be used to dump a `.dot` file that represents
|
||||
MIR as a control-flow graph.
|
||||
The `-Zdump-mir` flag can be used to dump a text representation of the MIR.
|
||||
The following optional flags, used in combination with `-Zdump-mir`, enable
|
||||
additional output formats, including:
|
||||
|
||||
* `-Zdump-mir-graphviz` - dumps a `.dot` file that represents MIR as a
|
||||
control-flow graph
|
||||
* `-Zdump-mir-spanview` - dumps an `.html` file that highlights the source
|
||||
spans associated with MIR elements (including mouse-over actions to reveal
|
||||
elements obscured by overlaps, and tooltips to view the MIR statements).
|
||||
This flag takes an optional value: `statement` (the default), `terminator`, or
|
||||
`block`, to generate span highlights with different levels of granulatity.
|
||||
|
||||
`-Zdump-mir=F` is a handy compiler options that will let you view the MIR for
|
||||
each function at each stage of compilation. `-Zdump-mir` takes a **filter** `F`
|
||||
|
|
|
|||
Loading…
Reference in New Issue