Skip to content

Commit 560ea6e

Browse files
authored
feat(rust): document how to set up source context (#13151)
* feat(rust): document how to set up source context * 404s * Update index.mdx * Update index.mdx
1 parent c35af5f commit 560ea6e

File tree

1 file changed

+33
-0
lines changed
  • docs/platforms/rust/common/source-context

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: Source Context
3+
sidebar_order: 2400
4+
description: "Learn about showing your source code as part of stack traces."
5+
---
6+
7+
## Prerequisites
8+
9+
[Install](/cli/installation/) and [Configure](/cli/configuration/) Sentry CLI by providing an auth token, org and project.
10+
11+
Then, enable full debug information for your release build:
12+
```toml {filename:Cargo.toml}
13+
[profiles.release]
14+
debug = true
15+
```
16+
17+
## Upload debug information files and source code
18+
19+
Build the release binary, extract debug information and strip it from the binary:
20+
```bash
21+
cargo build --release
22+
objcopy --only-keep-debug target/release/app{,.d}
23+
objcopy --strip-debug --strip-unneeded target/release/app
24+
objcopy --add-gnu-debuglink target/release/app{.d,}
25+
```
26+
27+
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.
28+
29+
Use Sentry CLI to upload debug information and source files:
30+
31+
```bash
32+
sentry-cli debug-files upload --include-sources .
33+
```

0 commit comments

Comments
 (0)