Skip to content

Commit 41fe211

Browse files
committed
Add identifier syntax to attributes.debugger
1 parent e5acdc2 commit 41fe211

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/attributes/debugger.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
# Debugger attributes
22

3+
r[attributes.debugger]
4+
35
The following [attributes] are used for enhancing the debugging experience when using third-party debuggers like GDB or WinDbg.
46

57
## The `debugger_visualizer` attribute
68

9+
r[attributes.debugger.debugger_visualizer]
10+
11+
r[attributes.debugger.debugger_visualizer.general]
712
The *`debugger_visualizer` attribute* can be used to embed a debugger visualizer file into the debug information.
813
This enables an improved debugger experience for displaying values in the debugger.
14+
15+
r[attributes.debugger.debugger_visualizer.restriction]
916
It uses the [_MetaListNameValueStr_] syntax to specify its inputs, and must be specified as a crate attribute.
1017

1118
### Using `debugger_visualizer` with Natvis
1219

20+
r[attributes.debugger.debugger_visualizer.natvis]
21+
22+
r[attributes.debugger.debugger_visualizer.natvis-general]
1323
Natvis is an XML-based framework for Microsoft debuggers (such as Visual Studio and WinDbg) that uses declarative rules to customize the display of types.
1424
For detailed information on the Natvis format, refer to Microsoft's [Natvis documentation].
1525

26+
r[attributes.debugger.debugger_visualizer.natvis-restrictions]
1627
This attribute only supports embedding Natvis files on `-windows-msvc` targets.
1728

29+
r[attributes.debugger.debugger_visualizer.natvis-path]
1830
The path to the Natvis file is specified with the `natvis_file` key, which is a path relative to the crate source file:
1931

2032
<!-- ignore: requires external files, and msvc -->
@@ -72,6 +84,10 @@ When viewed under WinDbg, the `fancy_rect` variable would be shown as follows:
7284

7385
### Using `debugger_visualizer` with GDB
7486

87+
r[attributes.debugger.debugger_visualizer.gdb]
88+
89+
90+
r[attributes.debugger.debugger_visualizer.gdb-pretty]
7591
GDB supports the use of a structured Python script, called a *pretty printer*, that describes how a type should be visualized in the debugger view.
7692
For detailed information on pretty printers, refer to GDB's [pretty printing documentation].
7793

@@ -81,6 +97,7 @@ There are two ways to enable auto-loading embedded pretty printers:
8197
For more information, see GDB's [auto-loading documentation].
8298
1. Create a file named `gdbinit` under `$HOME/.config/gdb` (you may need to create the directory if it doesn't already exist). Add the following line to that file: `add-auto-load-safe-path path/to/binary`.
8399

100+
r[attributes.debugger.debugger_visualizer.gdb-path]
84101
These scripts are embedded using the `gdb_script_file` key, which is a path relative to the crate source file.
85102

86103
<!-- ignore: requires external files -->
@@ -142,16 +159,23 @@ When the crate's debug executable is passed into GDB[^rust-gdb], `print bob` wil
142159

143160
## The `collapse_debuginfo` attribute
144161

162+
r[attributes.debugger.collapse_debuginfo]
163+
164+
165+
r[attributes.debugger.collapse_debuginfo.general]
145166
The *`collapse_debuginfo` [attribute]* controls whether code locations from a macro definition are collapsed into a single location associated with the macro's call site,
146167
when generating debuginfo for code calling this macro.
147168

169+
r[attributes.debugger.collapse_debuginfo.syntax]
148170
The attribute uses the [_MetaListIdents_] syntax to specify its inputs, and can only be applied to macro definitions.
149171

172+
r[attributes.debugger.collapse_debuginfo.options]
150173
Accepted options:
151174
- `#[collapse_debuginfo(yes)]` --- code locations in debuginfo are collapsed.
152175
- `#[collapse_debuginfo(no)]` --- code locations in debuginfo are not collapsed.
153176
- `#[collapse_debuginfo(external)]` --- code locations in debuginfo are collapsed only if the macro comes from a different crate.
154177

178+
r[attributes.debugger.collapse_debuginfo.default]
155179
The `external` behavior is the default for macros that don't have this attribute, unless they are built-in macros.
156180
For built-in macros the default is `yes`.
157181

0 commit comments

Comments
 (0)