|
| 1 | +--- |
| 2 | +title: Readable Stack Traces |
| 3 | +description: "Learn how to get readable stack traces in Sentry with Sentry SDK for Godot Engine." |
| 4 | +--- |
| 5 | + |
| 6 | +Debug information files allow Sentry to extract stack traces and provide additional information about crash reports. In order to get readable stack traces in Sentry when your game crashes, you need to export your project using an export template that includes debug symbols. For the official builds, Godot Engine only provides templates without debug information. This guide covers how to create such templates and use them to export your project with full debug information available in Sentry. |
| 7 | + |
| 8 | +To get debug information, we need to compile export templates with debug symbols included. You'll need **SCons** build tool, Python, and a C++ compiler for your target platform installed. |
| 9 | + |
| 10 | +<Alert> |
| 11 | + |
| 12 | +On Windows, for instance, you can use [Visual Studio Community 2022](https://visualstudio.microsoft.com/) with the C++ workload installed. |
| 13 | + |
| 14 | +For more information, refer to [Building from Source](https://docs.godotengine.org/en/stable/contributing/development/compiling/index.html) in the official Godot documentation. It provides detailed instructions for compiling Godot on different platforms and with different tools. This guide offers streamlined instructions tailored for our use case, and may omit some details you require. |
| 15 | + |
| 16 | +</Alert> |
| 17 | + |
| 18 | +## Getting Godot Source |
| 19 | + |
| 20 | +Start in a terminal with Git available. Clone Godot Engine repository and switch to your preferred version tag (or branch): |
| 21 | +```bash |
| 22 | +git clone https://github.com/godotengine/godot |
| 23 | +cd godot |
| 24 | +git checkout 4.3-stable |
| 25 | +``` |
| 26 | + |
| 27 | +## Compiling Templates |
| 28 | + |
| 29 | +To compile the Godot release export template with debug symbols, run the following command: |
| 30 | + |
| 31 | +```bash |
| 32 | +scons platform=windows target=template_release production=yes debug_symbols=yes separate_debug_symbols=yes |
| 33 | +``` |
| 34 | + |
| 35 | +<Expandable title="Options explained"> |
| 36 | + |
| 37 | +- `platform`: target platform (e.g., "windows", "linux", or "macos") |
| 38 | +- `target`: compilation target (e.g., "editor" or "template_release") |
| 39 | +- `production`: sets build defaults for production use |
| 40 | +- `debug_symbols`: includes debugging symbols in the build |
| 41 | +- `separate_debug_symbols`: extracts symbols into a separate file |
| 42 | + |
| 43 | +For more information, run: `scons --help` |
| 44 | + |
| 45 | +</Expandable> |
| 46 | + |
| 47 | +If all goes well, the export template files should appear as the result of the build process in the `bin/` directory inside the Godot source tree. When using MSVC on Windows, you will find `.exe` files alongside `.pdb` files, which contain debug information. |
| 48 | + |
| 49 | +<Alert> |
| 50 | + |
| 51 | +Learn more about debug formats in [Debug Information Files](/platforms/native/data-management/debug-files/). |
| 52 | + |
| 53 | +</Alert> |
| 54 | + |
| 55 | +## Exporting Project |
| 56 | + |
| 57 | +Now you can export your project using your custom template. In the Godot **Export** dialog window, follow these steps: |
| 58 | + |
| 59 | +1. Select or add an export preset. |
| 60 | +2. Enable the **Advanced Options** toggle. |
| 61 | +3. In the **Options** tab, under **Custom Template -> Release**, assign your custom template executable file. |
| 62 | + |
| 63 | +This will configure your project to use the custom export template with the debug symbols you compiled earlier. |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | +You should now be able to export your project using this template. Just make sure to uncheck `Export with Debug` in the **Export Project...** dialog, as you will need to compile and use the `template_debug` for that option. |
| 68 | + |
| 69 | +<Alert> |
| 70 | + |
| 71 | +If you need to `Export with Debug`, you can compile a debug template using the `target=template_debug` option. Debug templates enable debugging features in your export, such as breakpoints and debugger support. |
| 72 | + |
| 73 | +</Alert> |
| 74 | + |
| 75 | +## Uploading Debug Symbols |
| 76 | + |
| 77 | +In order to see readable stack traces in Sentry, you also need to upload your debug symbols. The easiest way to do it is by using Sentry CLI tools. These tools allow you to upload the necessary debug information, making the stack traces more readable and easier to debug. |
| 78 | + |
| 79 | +<Expandable title="Installing Sentry CLI"> |
| 80 | + |
| 81 | +On Windows, if you have `scoop` installed: |
| 82 | +```PowerShell |
| 83 | +scoop install sentry-cli |
| 84 | +``` |
| 85 | + |
| 86 | +On macOS, if you have Homebrew installed: |
| 87 | +```bash |
| 88 | +brew install getsentry/tools/sentry-cli |
| 89 | +``` |
| 90 | + |
| 91 | +On Arch Linux (btw): |
| 92 | +```bash |
| 93 | +pacman -S sentry-cli |
| 94 | +``` |
| 95 | + |
| 96 | +For other methods, refer to [Sentry CLI Installation](/cli/installation/). |
| 97 | + |
| 98 | +</Expandable> |
| 99 | + |
| 100 | +Log in to Sentry via the CLI by running the following command: |
| 101 | + |
| 102 | +```bash |
| 103 | +sentry-cli login |
| 104 | +``` |
| 105 | + |
| 106 | +It will prompt you to create an auth token in your web browser. Follow the instructions, generate the token, and then paste it into the command-line prompt when asked. |
| 107 | + |
| 108 | +To upload debug symbols to Sentry using `sentry-cli`, run the following command: |
| 109 | + |
| 110 | +```bash |
| 111 | +sentry-cli debug-files upload --org <YOUR_ORGANIZATION> --project <YOUR_PROJECT> ./bin |
| 112 | +``` |
| 113 | + |
| 114 | +Replace `<YOUR_ORGANIZATION>` and `<YOUR_PROJECT>` with your actual organization and project slugs or IDs. This will upload the files with debug information from the `./bin` directory to Sentry. |
| 115 | + |
| 116 | +Example output: |
| 117 | + |
| 118 | +```PowerShell |
| 119 | +$ sentry-cli debug-files upload --org sentry-sdks --project sentry-godot ./bin |
| 120 | +> Found 4 debug information files |
| 121 | +> Prepared debug information files for upload |
| 122 | +> Uploading completed in 7.429s |
| 123 | +> Uploaded 4 missing debug information files |
| 124 | +> File upload complete: |
| 125 | +
|
| 126 | + UPLOADED 88b87add-d362-406c-b3b7-9f019072a7e0-1 (godot.windows.template_release.x86_64.console.exe; x86_64 executable) |
| 127 | + UPLOADED 88b87add-d362-406c-b3b7-9f019072a7e0-1 (godot.windows.template_release.x86_64.console.pdb; x86_64 debug companion) |
| 128 | + UPLOADED 07c660ac-3f72-4c75-8aca-1378240cc949-1 (godot.windows.template_release.x86_64.pdb; x86_64 debug companion) |
| 129 | + UPLOADED 07c660ac-3f72-4c75-8aca-1378240cc949-1 (godot.windows.template_release.x86_64.exe; x86_64 executable) |
| 130 | +``` |
| 131 | + |
| 132 | +<Alert> |
| 133 | + |
| 134 | +For more information, refer to [Sentry CLI](/cli/) documentation. |
| 135 | + |
| 136 | +</Alert> |
| 137 | + |
| 138 | +Congratulations! You're all set up. Your exported project should now produce a readable stack trace in Sentry. |
| 139 | + |
| 140 | + |
0 commit comments