---
title: "Source Context"
description: "Learn about showing your source code as part of stack traces."
url: https://docs.sentry.io/platforms/rust/guides/actix-web/source-context/
---

# Source Context | Sentry for Actix Web

## [Prerequisites](https://docs.sentry.io/platforms/rust/guides/actix-web/source-context.md#prerequisites)

[Install](https://docs.sentry.io/cli/installation.md) and [Configure](https://docs.sentry.io/cli/configuration.md) Sentry CLI by providing an auth token, org and project.

## [Compile and create debug information files](https://docs.sentry.io/platforms/rust/guides/actix-web/source-context.md#compile-and-create-debug-information-files)

### [Linux](https://docs.sentry.io/platforms/rust/guides/actix-web/source-context.md#linux)

Enable full debug information for your release build:

`Cargo.toml`

```toml
[profile.release]
debug = true
```

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,}
```

### [macOS](https://docs.sentry.io/platforms/rust/guides/actix-web/source-context.md#macos)

Use a profile like the following for your release builds:

`Cargo.toml`

```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](https://docs.sentry.io/platforms/rust/guides/actix-web/source-context.md#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](https://docs.sentry.io/platforms/rust/guides/actix-web/source-context.md#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.
