Skip to content

Commit 90c0557

Browse files
committed
ci: backend: windows: DONTMERGE: crash reporting.
1 parent 3887967 commit 90c0557

File tree

3 files changed

+42
-8
lines changed

3 files changed

+42
-8
lines changed

.cirrus.yml

+10
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ task:
228228
memory: 4G
229229
env:
230230
PROVE_FLAGS: -j10
231+
CIRRUS_WORKING_DIR: "c:\\cirrus"
231232
# Avoid re-installing over and over
232233
NO_TEMP_INSTALL: 1
233234
TIMEOUT_CMD: timeout -k60s 30m
@@ -241,6 +242,7 @@ task:
241242
TEMP_CONFIG: ${CIRRUS_WORKING_DIR}\ci\worker_dio.conf
242243
test_script:
243244
- powershell -Command get-psdrive -psprovider filesystem
245+
- ps: Get-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug'
244246
- set
245247

246248
configure_script:
@@ -284,6 +286,14 @@ task:
284286
- timeout -k60s 30m perl src/tools/msvc/vcregress.pl bincheck
285287
upgradecheck_script:
286288
- timeout -k60s 30m perl src/tools/msvc/vcregress.pl upgradecheck
289+
290+
always:
291+
cat_dumps_script:
292+
- cat crashlog.txt || true
293+
dump_artifacts:
294+
path: "crashlog.txt"
295+
type: text/plain
296+
287297
on_failure:
288298
log_artifacts:
289299
path: "**/**.log"

ci/WindowsDockerfile

+21-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,31 @@
1+
# escape=`
2+
13
FROM cirrusci/windowsservercore:visualstudio2019
24

35
SHELL ["powershell", "-NoLogo", "-NoProfile", "-Command"]
46

5-
RUN powershell -NoLogo -NoProfile -Command \
6-
choco install -y --no-progress strawberryperl ; \
7-
choco install -y --no-progress winflexbison diffutils ; \
8-
Rename-Item -Path c:\ProgramData\chocolatey\bin\win_flex.exe flex.exe ; \
9-
Rename-Item -Path c:\ProgramData\chocolatey\bin\win_bison.exe bison.exe ; \
10-
Remove-Item C:\ProgramData\chocolatey\logs\*.* -Force -Recurse ; \
11-
Remove-Item C:\Users\ContainerAdministrator\AppData\Local\Temp\*.* -Force -Recurse
7+
# Install commandline debugger and log all crashes to c:\cirrus\crashlog.txt
8+
RUN choco install -y --no-progress windows-sdk-10-version-2004-windbg ; `
9+
Remove-Item C:\ProgramData\chocolatey\logs\*.* -Force -Recurse ; `
10+
Remove-Item C:\Users\ContainerAdministrator\AppData\Local\Temp\*.* -Force -Recurse ; `
11+
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug' -Name 'Debugger' -Value '\"C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe\" -p %ld -e %ld -g -kqm -c \".lines -e; .symfix+ ;.logappend c:\cirrus\crashlog.txt ; !peb; ~*kP ; .logclose ; q \"' ; `
12+
New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug' -Name 'Auto' -Value 1 -PropertyType DWord ; `
13+
Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug' -Name Debugger
1214

1315
SHELL ["cmd", "/s", "/c"]
16+
RUN setx path /m "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64;%PATH%"
17+
18+
19+
SHELL ["powershell", "-NoLogo", "-NoProfile", "-Command"]
20+
21+
RUN choco install -y --no-progress strawberryperl ; `
22+
choco install -y --no-progress winflexbison diffutils ; `
23+
Rename-Item -Path c:\ProgramData\chocolatey\bin\win_flex.exe flex.exe ; `
24+
Rename-Item -Path c:\ProgramData\chocolatey\bin\win_bison.exe bison.exe ; `
25+
Remove-Item C:\ProgramData\chocolatey\logs\*.* -Force -Recurse ; `
26+
Remove-Item C:\Users\ContainerAdministrator\AppData\Local\Temp\*.* -Force -Recurse
1427

1528
# Adding VS path to vcvarsall.bat so user of container doesn't need to know the full path
1629
# Ordered so strawberry perl wins over git perl
30+
SHELL ["cmd", "/s", "/c"]
1731
RUN setx path /m "C:\strawberry\perl\bin;C:\Program Files\Git\usr\bin;c:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build;%PATH%"

src/backend/main/main.c

+11-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
#include <sys/param.h>
2727
#endif
2828

29+
#if defined(_MSC_VER)
30+
#include <crtdbg.h>
31+
#endif
32+
2933
#if defined(_M_AMD64) && _MSC_VER == 1800
3034
#include <math.h>
3135
#include <versionhelpers.h>
@@ -239,7 +243,13 @@ startup_hacks(const char *progname)
239243
}
240244

241245
/* In case of general protection fault, don't show GUI popup box */
242-
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
246+
SetErrorMode(SEM_FAILCRITICALERRORS /* | SEM_NOGPFAULTERRORBOX */);
247+
248+
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
249+
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
250+
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
251+
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
252+
_set_abort_behavior(_CALL_REPORTFAULT | _WRITE_ABORT_MSG, _CALL_REPORTFAULT | _WRITE_ABORT_MSG);
243253

244254
#if defined(_M_AMD64) && _MSC_VER == 1800
245255

0 commit comments

Comments
 (0)