Skip to content

Commit daa91f5

Browse files
limbonautbruno-garciaandreiborza
authored
feat: Godot debug symbols guide (#12843)
* feat: Godot debug symbols guide * Fixes * Small correction * Expand prerequisites * Corrections * Apply suggestions from code review Co-authored-by: Bruno Garcia <[email protected]> * Sentry CLI instructions => tab component * Apply suggestions from code review Co-authored-by: Andrei <[email protected]> * Update docs/platforms/godot/configuration/stack-traces.mdx Co-authored-by: Bruno Garcia <[email protected]> * Update docs/platforms/godot/configuration/stack-traces.mdx Co-authored-by: Bruno Garcia <[email protected]> * Update docs/platforms/godot/configuration/stack-traces.mdx * Apply suggestions from code review --------- Co-authored-by: Bruno Garcia <[email protected]> Co-authored-by: Andrei <[email protected]>
1 parent 5141af6 commit daa91f5

File tree

3 files changed

+175
-0
lines changed

3 files changed

+175
-0
lines changed
36.5 KB
Loading
42.3 KB
Loading
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
---
2+
title: Readable Stack Traces
3+
description: "Learn how to get traces with line numbers and file paths in Sentry with SDK for Godot Engine."
4+
---
5+
6+
[The official Godot Engine builds only provide templates without debug information files](https://github.com/godotengine/godot-proposals/issues/1342). This guide covers how to create such templates and use them to export your project with full debug information available in Sentry.
7+
8+
Debug information files allow Sentry to extract stack traces and provide additional information from crash reports. In order to get stack traces that contain function names, line numbers and file paths, Sentry needs to have these debug information files available when processing the crash dumps. For that, you need to export your Godot project using an export template that contains debug information.
9+
10+
## Prerequisites
11+
12+
To get debug information, we need to compile export templates with debug symbols produced. You'll need Git, SCons build tool, Python, and a C++ compiler for your target platform installed.
13+
14+
Ensure you have a compatible C++ compiler. On Windows, for instance, you can use [Visual Studio Community 2022](https://visualstudio.microsoft.com/) with the C++ workload installed, GCC on Linux and Clang on macOS.
15+
16+
Here are a few ways to install the **SCons** build tool:
17+
18+
```PowerShell {tabTitle:Windows}
19+
# If you have `scoop` installed:
20+
scoop install scons
21+
```
22+
23+
```bash {tabTitle:macOS}
24+
# If you have Homebrew installed:
25+
brew install scons
26+
```
27+
28+
```bash {tabTitle:Arch Linux}
29+
pacman -S scons
30+
```
31+
32+
```bash {tabTitle:Ubuntu/Debian}
33+
sudo apt install scons
34+
```
35+
36+
```bash {tabTitle:Using Python}
37+
# Install with existing Python installation:
38+
python -m pip install scons
39+
40+
# Upgrade:
41+
python -m pip install --upgrade scons
42+
```
43+
44+
<Alert>
45+
46+
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.
47+
48+
</Alert>
49+
50+
## Getting Godot Source
51+
52+
Start in a terminal with Git available. Clone Godot Engine repository and switch to your [preferred version tag](https://github.com/godotengine/godot/releases) (or branch):
53+
```bash
54+
git clone https://github.com/godotengine/godot
55+
cd godot
56+
git checkout 4.4-stable
57+
```
58+
59+
## Compiling Templates
60+
61+
To compile the Godot release export template with debug symbols, run the following command:
62+
63+
```bash
64+
scons platform=windows target=template_release production=yes debug_symbols=yes separate_debug_symbols=yes
65+
```
66+
67+
<Expandable title="Options explained">
68+
69+
- `platform`: target platform (e.g., "windows", "linux", or "macos")
70+
- `target`: compilation target (e.g., "editor" or "template_release")
71+
- `production`: sets build defaults for production use
72+
- `debug_symbols`: includes debugging symbols in the build
73+
- `separate_debug_symbols`: extracts symbols into a separate file
74+
75+
For more information, run: `scons --help`
76+
77+
</Expandable>
78+
79+
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.
80+
81+
<Alert>
82+
83+
Learn more about debug formats in [Debug Information Files](/platforms/native/data-management/debug-files/).
84+
85+
</Alert>
86+
87+
## Exporting Project
88+
89+
Now you can export your project using your custom template. In the Godot **Export** dialog window, follow these steps:
90+
91+
1. Select or add an export preset.
92+
2. Enable the **Advanced Options** toggle.
93+
3. In the **Options** tab, under **Custom Template -> Release**, assign your custom template executable file.
94+
95+
This will configure your project to use the custom export template with the debug symbols you compiled earlier.
96+
97+
![Export Dialog](./imgs/godot_export_dialog.png)
98+
99+
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.
100+
101+
<Alert>
102+
103+
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 but perform slower than a release build, therefore these are not advised when shipping the game for end users.
104+
105+
</Alert>
106+
107+
## Uploading Debug Symbols
108+
109+
In order to get readable stack traces in Sentry, you also need to upload your debug symbols. The easiest way to do it is by using [Sentry CLI](https://docs.sentry.io/cli/). This tool allows you to upload the necessary debug information, making the stack traces useful for debugging.
110+
111+
<Expandable title="Installing Sentry CLI">
112+
113+
```PowerShell {tabTitle:Windows}
114+
# On Windows, if you have `scoop` installed:
115+
scoop install sentry-cli
116+
```
117+
118+
```bash {tabTitle:macOS}
119+
# On macOS, if you have Homebrew installed:
120+
brew install getsentry/tools/sentry-cli
121+
```
122+
123+
```bash {tabTitle:Arch Linux}
124+
pacman -S sentry-cli
125+
```
126+
127+
```npm {tabTitle:npm}
128+
npm install @sentry/cli
129+
```
130+
131+
For other methods, refer to [Sentry CLI Installation](/cli/installation/).
132+
133+
</Expandable>
134+
135+
Log in to Sentry via the CLI by running the following command:
136+
137+
```bash
138+
sentry-cli login
139+
```
140+
141+
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.
142+
143+
To upload debug symbols to Sentry using `sentry-cli`, run the following command:
144+
145+
```bash
146+
sentry-cli debug-files upload --org ___ORG_SLUG___ --project ___PROJECT_SLUG___ ./bin
147+
```
148+
149+
This will upload the files with debug information from the `./bin` directory to Sentry.
150+
151+
Example output:
152+
153+
```PowerShell
154+
$ sentry-cli debug-files upload --org my-sentry-org --project my-game ./bin
155+
> Found 4 debug information files
156+
> Prepared debug information files for upload
157+
> Uploading completed in 7.429s
158+
> Uploaded 4 missing debug information files
159+
> File upload complete:
160+
161+
UPLOADED 88b87add-d362-406c-b3b7-9f019072a7e0-1 (godot.windows.template_release.x86_64.console.exe; x86_64 executable)
162+
UPLOADED 88b87add-d362-406c-b3b7-9f019072a7e0-1 (godot.windows.template_release.x86_64.console.pdb; x86_64 debug companion)
163+
UPLOADED 07c660ac-3f72-4c75-8aca-1378240cc949-1 (godot.windows.template_release.x86_64.pdb; x86_64 debug companion)
164+
UPLOADED 07c660ac-3f72-4c75-8aca-1378240cc949-1 (godot.windows.template_release.x86_64.exe; x86_64 executable)
165+
```
166+
167+
<Alert>
168+
169+
For more information, refer to [Sentry CLI](/cli/) documentation.
170+
171+
</Alert>
172+
173+
Congratulations! You're all set up. Your exported project should now produce symbolicated stack traces in Sentry.
174+
175+
![Symbolicated Issue](./imgs/symbolicated_issue.png)

0 commit comments

Comments
 (0)