Skip to content

Commit 27c1664

Browse files
Respond to PR feedback.
1 parent 0a67d40 commit 27c1664

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

text/0000-debugger-visualizer.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ As an example, consider a crate `foo` with this directory structure:
221221
Where `main.rs` contains:
222222

223223
```rust
224+
#[debugger_visualizer(natvis_file = "../Foo.natvis")]
225+
224226
/// A rectangle in first quadrant
225227
struct FancyRect {
226228
pub x: f32,
@@ -287,7 +289,11 @@ the crate metadata if the target is an `rlib`. If the target is an executable, t
287289
`.debug_gdb_scripts` section will include a reference to the pretty printer specified.
288290

289291
To provide pretty printers, developers create a file with the `.py` file
290-
extension.
292+
extension and reference it via the `#[debugger_visualizer]` attribute as follows:
293+
294+
```rust
295+
#[debugger_visualizer(gdb_script_file = "../foo.py")]
296+
```
291297

292298
# Reference-level explanation
293299
[reference-level-explanation]: #reference-level-explanation
@@ -311,13 +317,13 @@ For example, to specify that a `.natvis` file should be included in the binary
311317
being built, the following attribute should be added to the Rust source:
312318

313319
```rust
314-
#![debugger_visualizer(natvis_file = "../foo.natvis")]
320+
#[debugger_visualizer(natvis_file = "../foo.natvis")]
315321
```
316322

317323
The same can be done to specify a GDB python debugger script:
318324

319325
```rust
320-
#![debugger_visualizer(gdb_script_file = "../foo.py")]
326+
#[debugger_visualizer(gdb_script_file = "../foo.py")]
321327
```
322328

323329
Depending on the Rust target, the correct debugger visualizer will be selected and embedded
@@ -330,14 +336,14 @@ embedded for each crate. When generating the final binary, the contents of the
330336
visualizer file will be extracted from the crate metadata and written to a new file
331337
in the target directory under a new `visualizer` directory.
332338

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

340-
In the case of GDB pretty printer, `#![debugger_visualizer(gdb_script_file = "../foo.py")]`
346+
In the case of GDB pretty printer, `#[debugger_visualizer(gdb_script_file = "../foo.py")]`
341347
the compiler will ensure that the set of pretty printers specified will be added to the
342348
`.debug_gdb_scripts` section of the `ELF` generated. The `.debug_gdb_scripts` section
343349
takes a list of null-terminated entries which specify scripts to load within GDB. The

0 commit comments

Comments
 (0)