Skip to content

Commit 12b2f1c

Browse files
committed
add manual windows crash to test symbolication in sentry
1 parent a44f0c1 commit 12b2f1c

3 files changed

Lines changed: 52 additions & 2 deletions

File tree

.github/workflows/build.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
pull_request:
77
branches: [main, master]
88
workflow_dispatch:
9+
inputs:
10+
sentry_crash_test:
11+
description: "After building, run --sentry-crash-test to send a real crash to Sentry (verifies symbolication)"
12+
type: boolean
13+
default: false
914

1015
jobs:
1116
build-linux:
@@ -65,6 +70,16 @@ jobs:
6570
# uploaded still matches the binary that ships and crashes.
6671
strip build/src/texturelab/texturelab
6772
73+
- name: Sentry crash test (manual)
74+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.sentry_crash_test == 'true' }}
75+
run: |
76+
export QT_QPA_PLATFORM=offscreen
77+
# Crashes before the main window opens; crashpad_handler (copied next to
78+
# the binary at build time) uploads the minidump via the built-in DSN.
79+
build/src/texturelab/texturelab --sentry-crash-test || true
80+
echo "waiting for crashpad to upload the minidump..."
81+
sleep 25
82+
6883
- name: Install LinuxDeploy
6984
uses: miurahr/install-linuxdeploy-action@v1
7085
with:
@@ -132,7 +147,7 @@ jobs:
132147
cache: true
133148

134149
- name: Configure CMake
135-
run: cmake -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -DSENTRY_BACKEND=crashpad -DTEXTURELAB_SENTRY_DSN="${{ secrets.SENTRY_DSN }}" -DCMAKE_CXX_FLAGS_RELEASE="/MD /O2 /Ob2 /DNDEBUG /Zi" -DCMAKE_EXE_LINKER_FLAGS_RELEASE="/INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF"
150+
run: cmake -B build -G "Visual Studio 17 2022" -A x64 -DSENTRY_BACKEND=crashpad -DTEXTURELAB_SENTRY_DSN="${{ secrets.SENTRY_DSN }}"
136151

137152
- name: Build
138153
run: cmake --build build --target texturelab --config Release --parallel
@@ -145,6 +160,13 @@ jobs:
145160
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
146161
run: |
147162
Invoke-WebRequest -Uri "https://github.com/getsentry/sentry-cli/releases/latest/download/sentry-cli-Windows-x86_64.exe" -OutFile "sentry-cli.exe"
163+
$exe = "build\src\texturelab\Release\texturelab.exe"
164+
$pdb = "build\src\texturelab\Release\texturelab.pdb"
165+
if (-not (Test-Path $pdb)) { Write-Error "texturelab.pdb not found — build produced no debug info; Sentry cannot symbolicate."; exit 1 }
166+
# Log the Debug IDs. The exe's Debug ID (from its CodeView record) MUST
167+
# be non-null and match the pdb, or crash minidumps stay unsymbolicated.
168+
Write-Host "== exe Debug ID =="; .\sentry-cli.exe debug-files check $exe
169+
Write-Host "== pdb Debug ID =="; .\sentry-cli.exe debug-files check $pdb
148170
.\sentry-cli.exe debug-files upload --include-sources "build\src\texturelab\Release\"
149171
150172
- name: Deploy Qt dependencies
@@ -160,6 +182,20 @@ jobs:
160182
) | Where-Object { Test-Path $_ } | Select-Object -First 1
161183
if ($handler) { Copy-Item $handler deploy\ } else { Write-Warning "crashpad_handler.exe not found, skipping" }
162184
185+
- name: Sentry crash test (manual)
186+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.sentry_crash_test == 'true' }}
187+
shell: pwsh
188+
run: |
189+
$env:QT_QPA_PLATFORM = "offscreen"
190+
# Run the deployed bundle (Qt DLLs + crashpad_handler.exe alongside the
191+
# exe). Crashes before the main window; crashpad uploads the minidump
192+
# via the built-in DSN. Debug IDs match the PDB uploaded above.
193+
$p = Start-Process -FilePath "deploy\texturelab.exe" -ArgumentList "--sentry-crash-test" -PassThru
194+
if (-not $p.WaitForExit(60000)) { $p.Kill(); Write-Warning "timed out waiting for crash" }
195+
else { Write-Host "app exited with code $($p.ExitCode) (crash expected)" }
196+
Write-Host "waiting for crashpad to upload the minidump..."
197+
Start-Sleep -Seconds 25
198+
163199
- name: Upload Windows artifact
164200
uses: actions/upload-artifact@v4
165201
with:

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ compile_commands.json
1010
CTestTestfile.cmake
1111
_deps
1212

13-
build/
13+
build/
14+
build-sentry-test/
15+
16+
# Secrets — Sentry auth token, org/project slugs
17+
.env

src/texturelab/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,16 @@ add_custom_target(texturelab_version
288288
add_dependencies(texturelab texturelab_version)
289289
target_include_directories(texturelab PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
290290

291+
# MSVC: deterministically emit a PDB and embed a CodeView record in the exe, in
292+
# every config (incl. Release). Without the CodeView record the shipped exe has
293+
# no debug_id, so Sentry cannot match any PDB to a crash minidump ("Unknown
294+
# function" frames). Attaching to the target is reliable; injecting /Zi + /DEBUG
295+
# via CMAKE_*_FLAGS_RELEASE on the command line was not (VS generator + Qt).
296+
if(MSVC)
297+
target_compile_options(texturelab PRIVATE /Zi)
298+
target_link_options(texturelab PRIVATE /DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO)
299+
endif()
300+
291301
# Copy crashpad_handler next to the executable so handler_path resolves at runtime
292302
if(TARGET crashpad_handler)
293303
add_custom_command(TARGET texturelab POST_BUILD

0 commit comments

Comments
 (0)