From 481f36995a3deae707b5fdced4889005ee9eab97 Mon Sep 17 00:00:00 2001 From: Lorenzo Cian Date: Wed, 2 Apr 2025 19:11:12 +0200 Subject: [PATCH] feat(rust): document how to set up source context on macOS --- .../rust/common/source-context/index.mdx | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/platforms/rust/common/source-context/index.mdx b/docs/platforms/rust/common/source-context/index.mdx index 6e7a174975e09..7f6b0091153ec 100644 --- a/docs/platforms/rust/common/source-context/index.mdx +++ b/docs/platforms/rust/common/source-context/index.mdx @@ -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 @@ -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.