Skip to content

Commit 0bf5d4e

Browse files
committed
Add docs for #[collapse_debuginfo] attribute
1 parent 8227666 commit 0bf5d4e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/attributes/debugger.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,26 @@ When the crate's debug executable is passed into GDB[^rust-gdb], `print bob` wil
139139
[Natvis documentation]: https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects
140140
[pretty printing documentation]: https://sourceware.org/gdb/onlinedocs/gdb/Pretty-Printing.html
141141
[_MetaListNameValueStr_]: ../attributes.md#meta-item-attribute-syntax
142+
143+
## The `collapse_debuginfo` attribute
144+
145+
This attribute controls whether code locations from this macro definition are collapsed into a
146+
single location associated with the macro's call site, when generating debuginfo for code calling
147+
this macro.
148+
149+
The attribute uses the [_MetaListIdents_] syntax to specify its inputs, and can only be applied to
150+
macro definitions.
151+
152+
Accepted options:
153+
- `#[collapse_debuginfo(yes)]` - code locations in debuginfo are collapsed.
154+
- `#[collapse_debuginfo(no)]` - code locations in debuginfo are not collapsed.
155+
- `#[collapse_debuginfo(external)]` - code locations in debuginfo are collapsed only if the macro
156+
comes from a different crate.
157+
158+
The `external` behavior is the default for macros that don't have this attribute, unless they are
159+
built-in macros. For built-in macros the default is `yes`.
160+
161+
Both the default collapsing behavior and `#[collapse_debuginfo]` attributes can be overridden from
162+
command line using the `-C collapse-macro-debuginfo` option.
163+
164+
[_MetaListIdents_]: ../attributes.md#meta-item-attribute-syntax

0 commit comments

Comments
 (0)