File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
docs/platforms/rust/common/source-context Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 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+ We will strip the binary, extract the necessary debug information and upload it to Sentry along with the source code.
18+
19+ ## Upload debug information files and source code
20+
21+ Build the release binary, strip and extract debug information:
22+ ``` bash
23+ cargo build --release
24+ objcopy --only-keep-debug target/release/app{,.d}
25+ objcopy --strip-debug --strip-unneeded target/release/app
26+ objcopy --add-gnu-debuglink target/release/app{.d,}
27+ zip app-debug.zip target/release/app.d
28+ ```
29+
30+ Use Sentry CLI to create a source bundle:
31+
32+ ``` bash
33+ sentry-cli difutil bundle-sources target/release/app.d
34+ mv target/release/app.src.zip ./app.src.zip
35+ ```
36+
37+ Finally, use Sentry CLI to upload both debug information files and sources to Sentry:
38+ ``` bash
39+ sentry-cli upload-dif ./app-debug.zip ./app.src.zip
40+ ```
You can’t perform that action at this time.
0 commit comments