Skip to content

Commit 0a67d40

Browse files
Update attribute name. Remove extra whitespace.
1 parent 275a333 commit 0a67d40

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

text/0000-debugger-visualizer.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- Feature Name: `debugger-visualizer`
1+
- Feature Name: `debugger_visualizer`
22
- Start Date: 2021-11-01
33
- RFC PR: [rust-lang/rfcs#3191](https://github.com/rust-lang/rfcs/pull/3191)
44
- Rust Issue: [rust-lang/rust#0000](https://github.com/rust-lang/rust/issues/0000)
@@ -16,7 +16,7 @@ crates.
1616
Most, if not all, Rust developers will at some point have to debug an issue
1717
in their crate. Trying to view types as they are laid out in memory is not
1818
always the most telling. Furthermore when viewing types from external crates,
19-
the information is even harder to interpret.
19+
the information is even harder to interpret.
2020

2121
Many languages and debuggers enable developers to control how a type is
2222
displayed in a debugger. These are called "debugger visualizations" or "debugger
@@ -198,7 +198,7 @@ types, a description of how to display those types. This allows for some
198198
limited support for generic types.
199199

200200
Rust developers can add one or more `.natvis` files to their crate. Through
201-
the use of a new Rust attribute, `#[debugger-visualizer]`, the compiler will
201+
the use of a new Rust attribute, `#[debugger_visualizer]`, the compiler will
202202
encode the contents of the `.natvis` file in the crate metadata if the target
203203
is an `rlib`. If the target is a `dll` or `exe`, the `/NATVIS` MSVC linker flag is
204204
set for each `.natvis` file which will embed the Natvis visualizations into the PDB.
@@ -282,7 +282,7 @@ types, descibe how to display those types. (For writing a pretty printer, see: h
282282

283283
Rust developers can add one or more pretty printers to their crate. This is done
284284
in the Rust compiler via `.py` python scripts. Through the use of a new Rust attribute,
285-
`#[debugger-visualizer]`, the compiler will encode the contents of the `.py` file in
285+
`#[debugger_visualizer]`, the compiler will encode the contents of the `.py` file in
286286
the crate metadata if the target is an `rlib`. If the target is an executable, the
287287
`.debug_gdb_scripts` section will include a reference to the pretty printer specified.
288288

@@ -292,12 +292,12 @@ extension.
292292
# Reference-level explanation
293293
[reference-level-explanation]: #reference-level-explanation
294294

295-
In rustc, a new built-in attribute `#[debugger-visualizer]` will be added which
295+
In rustc, a new built-in attribute `#[debugger_visualizer]` will be added which
296296
instructs the compiler to take the specified file path for a debugger visualizer
297297
and add it to the current binary being built. The file path specified must be
298298
relative to the location of the attribute.
299299

300-
The `#[debugger-visualizer]` attribute will reserve multiple keys to be able to
300+
The `#[debugger_visualizer]` attribute will reserve multiple keys to be able to
301301
specify which type of visualizer is being applied. The following keys will be
302302
reserved as part of this RFC:
303303

@@ -311,33 +311,33 @@ For example, to specify that a `.natvis` file should be included in the binary
311311
being built, the following attribute should be added to the Rust source:
312312

313313
```rust
314-
#![debugger-visualizer(natvis_file = "../foo.natvis")]
314+
#![debugger_visualizer(natvis_file = "../foo.natvis")]
315315
```
316316

317317
The same can be done to specify a GDB python debugger script:
318318

319319
```rust
320-
#![debugger-visualizer(gdb_script_file = "../foo.py")]
320+
#![debugger_visualizer(gdb_script_file = "../foo.py")]
321321
```
322322

323323
Depending on the Rust target, the correct debugger visualizer will be selected and embedded
324324
in the output.
325325

326326
The Rust compiler will serialize the contents of the file specified via the
327-
`#[debugger-visualizer]` attribute and store it in the crate metadata. This attribute
327+
`#[debugger_visualizer]` attribute and store it in the crate metadata. This attribute
328328
can be used multiple times to allow for multiple debugger visualizer files to be
329329
embedded for each crate. When generating the final binary, the contents of the
330330
visualizer file will be extracted from the crate metadata and written to a new file
331331
in the target directory under a new `visualizer` directory.
332332

333-
In the case of a Natvis file, `#![debugger-visualizer(natvis_file = "../foo.natvis")]`
333+
In the case of a Natvis file, `#![debugger_visualizer(natvis_file = "../foo.natvis")]`
334334
the compiler will set the `/NATVIS:{.natvis file}` MSVC linker flag for each of the
335335
Natvis files specified for the current crate as well as transitive dependencies if
336336
using the MSVC toolchain. This linker flag ensures that the specified Natvis files
337337
be embedded in the PDB generated for the binary being built. Any crate type that
338338
would generate a PDB would have all applicable `.natvis` files embedded.
339339

340-
In the case of GDB pretty printer, `#![debugger-visualizer(gdb_script_file = "../foo.py")]`
340+
In the case of GDB pretty printer, `#![debugger_visualizer(gdb_script_file = "../foo.py")]`
341341
the compiler will ensure that the set of pretty printers specified will be added to the
342342
`.debug_gdb_scripts` section of the `ELF` generated. The `.debug_gdb_scripts` section
343343
takes a list of null-terminated entries which specify scripts to load within GDB. The
@@ -495,7 +495,7 @@ need be.
495495
The drawbacks for this option is that it seems a sub-optimal in terms of user
496496
experience. It requires the author to operate at a lower level of abstraction by
497497
having to use a more general attribute and annotating it to tackle a specific use
498-
case. Having a more targeted attribute, i.e. `#[debugger-visualizer]` allows for the
498+
case. Having a more targeted attribute, i.e. `#[debugger_visualizer]` allows for the
499499
author to simply specify which debugger visualizer file should be included and allow
500500
the compiler to select the right one under the covers.
501501

@@ -573,7 +573,7 @@ Debugger visualizer support for Rust could be improved upon by adding support fo
573573

574574
```rust
575575
/// A rectangle in first quadrant
576-
#[debugger-visualizer(
576+
#[debugger_visualizer(
577577
natvis(r#"
578578
<DisplayString>({x},{y}) + ({dx}, {dy})</DisplayString>
579579
<Item Name="LowerLeft">({x}, {y})</Item>

0 commit comments

Comments
 (0)