@@ -221,6 +221,8 @@ As an example, consider a crate `foo` with this directory structure:
221
221
Where ` main.rs ` contains:
222
222
223
223
``` rust
224
+ #[debugger_visualizer(natvis_file = " ../Foo.natvis" )]
225
+
224
226
/// A rectangle in first quadrant
225
227
struct FancyRect {
226
228
pub x : f32 ,
@@ -287,7 +289,11 @@ the crate metadata if the target is an `rlib`. If the target is an executable, t
287
289
` .debug_gdb_scripts ` section will include a reference to the pretty printer specified.
288
290
289
291
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
+ ```
291
297
292
298
# Reference-level explanation
293
299
[ reference-level-explanation ] : #reference-level-explanation
@@ -311,13 +317,13 @@ For example, to specify that a `.natvis` file should be included in the binary
311
317
being built, the following attribute should be added to the Rust source:
312
318
313
319
``` rust
314
- #! [debugger_visualizer(natvis_file = " ../foo.natvis" )]
320
+ #[debugger_visualizer(natvis_file = " ../foo.natvis" )]
315
321
```
316
322
317
323
The same can be done to specify a GDB python debugger script:
318
324
319
325
``` rust
320
- #! [debugger_visualizer(gdb_script_file = " ../foo.py" )]
326
+ #[debugger_visualizer(gdb_script_file = " ../foo.py" )]
321
327
```
322
328
323
329
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
330
336
visualizer file will be extracted from the crate metadata and written to a new file
331
337
in the target directory under a new ` visualizer ` directory.
332
338
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")] `
334
340
the compiler will set the ` /NATVIS:{.natvis file} ` MSVC linker flag for each of the
335
341
Natvis files specified for the current crate as well as transitive dependencies if
336
342
using the MSVC toolchain. This linker flag ensures that the specified Natvis files
337
343
be embedded in the PDB generated for the binary being built. Any crate type that
338
344
would generate a PDB would have all applicable ` .natvis ` files embedded.
339
345
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")] `
341
347
the compiler will ensure that the set of pretty printers specified will be added to the
342
348
` .debug_gdb_scripts ` section of the ` ELF ` generated. The ` .debug_gdb_scripts ` section
343
349
takes a list of null-terminated entries which specify scripts to load within GDB. The
0 commit comments