Skip to content

Commit

Permalink
Add docs for #[collapse_debuginfo] attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Feb 13, 2024
1 parent 8227666 commit 0bf5d4e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/attributes/debugger.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,26 @@ When the crate's debug executable is passed into GDB[^rust-gdb], `print bob` wil
[Natvis documentation]: https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects
[pretty printing documentation]: https://sourceware.org/gdb/onlinedocs/gdb/Pretty-Printing.html
[_MetaListNameValueStr_]: ../attributes.md#meta-item-attribute-syntax

## The `collapse_debuginfo` attribute

This attribute controls whether code locations from this macro definition are collapsed into a
single location associated with the macro's call site, when generating debuginfo for code calling
this macro.

The attribute uses the [_MetaListIdents_] syntax to specify its inputs, and can only be applied to
macro definitions.

Accepted options:
- `#[collapse_debuginfo(yes)]` - code locations in debuginfo are collapsed.
- `#[collapse_debuginfo(no)]` - code locations in debuginfo are not collapsed.
- `#[collapse_debuginfo(external)]` - code locations in debuginfo are collapsed only if the macro
comes from a different crate.

The `external` behavior is the default for macros that don't have this attribute, unless they are
built-in macros. For built-in macros the default is `yes`.

Both the default collapsing behavior and `#[collapse_debuginfo]` attributes can be overridden from
command line using the `-C collapse-macro-debuginfo` option.

[_MetaListIdents_]: ../attributes.md#meta-item-attribute-syntax

0 comments on commit 0bf5d4e

Please sign in to comment.