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
33 changes: 33 additions & 0 deletions docs/platforms/rust/common/source-context/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: Source Context
sidebar_order: 2400
description: "Learn about showing your source code as part of stack traces."
---

## Prerequisites

[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:
```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
objcopy --only-keep-debug target/release/app{,.d}
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.

Use Sentry CLI to upload debug information and source files:

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