Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions docs/platforms/rust/common/source-context/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ description: "Learn about showing your source code as part of stack traces."

[Install](/cli/installation/) and [Configure](/cli/configuration/) Sentry CLI by providing an auth token, org and project.

Then, enable full debug information for your release build:
## Compile and create debug information files

### Linux

Enable full debug information for your release build:
```toml {filename:Cargo.toml}
[profiles.release]
debug = true
```

## Upload debug information files and source code

Build the release binary, extract debug information and strip it from the binary:
```bash
cargo build --release
Expand All @@ -24,10 +26,29 @@ objcopy --strip-debug --strip-unneeded target/release/app
objcopy --add-gnu-debuglink target/release/app{.d,}
```

If you don't want to strip the binary, you should disable the `debug-images` integration of the SDK, as otherwise you will run into the issue documented [here](https://github.com/getsentry/sentry-rust/issues/470#issuecomment-1472136215) which could cause duplicated frames to appear in your Sentry issues.
### macOS

Use a profile like the following for your release builds:
```toml {filename:Cargo.toml}
[profile.release]
debug = true
split-debuginfo = "packed"
strip = true
```

Build the release binary, debug information will be available in separate files and stripped from the binary automatically:
```bash
cargo build --release
```

## Upload debug information and source files

Use Sentry CLI to upload debug information and source files:

```bash
sentry-cli debug-files upload --include-sources .
```

## Troubleshooting

If you don't want to strip the binary, you should disable the `debug-images` integration of the SDK, as otherwise you will run into the issue documented [here](https://github.com/getsentry/sentry-rust/issues/470#issuecomment-1472136215) which could cause duplicated frames to appear in your Sentry issues.