Skip to content

Commit e506b82

Browse files
Debug
1 parent f10d572 commit e506b82

2 files changed

Lines changed: 57 additions & 1 deletion

File tree

.github/workflows/windows-check.yml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ jobs:
183183
$cfg = "${{env.WOLFSSH_BUILD_CONFIGURATION}}\${{env.BUILD_PLATFORM}}"
184184
$dll = Join-Path $env:ASAN_BIN_DIR "clang_rt.asan_dynamic-x86_64.dll"
185185
if (-not (Test-Path $dll)) { throw "ASAN runtime DLL not found: $dll" }
186+
# Fetch procdump so a hard crash (__fastfail / 0xC0000409 from /GS or a
187+
# CRT invalid-parameter abort) can be captured as a full dump. Such a
188+
# crash bypasses the ASan exit path and leaves no report of its own.
189+
Invoke-WebRequest -Uri "https://download.sysinternals.com/files/Procdump.zip" -OutFile procdump.zip
190+
Expand-Archive -Force procdump.zip -DestinationPath procdump
191+
$procdump = "procdump\procdump64.exe"
192+
New-Item -ItemType Directory -Force -Path dumps | Out-Null
186193
foreach ($t in @("api-test", "unit-test")) {
187194
$dir = "ide\winvs\$t\$cfg"
188195
# Static signal: confirm the binary really imports the ASan runtime, so
@@ -193,6 +200,41 @@ jobs:
193200
($deps -split "`n" | Select-String "asan").Line.Trim() | ForEach-Object { Write-Host " $_" }
194201
Copy-Item $dll $dir
195202
& "$dir\$t.exe"
196-
if ($LASTEXITCODE -ne 0) { throw "$t failed under ASAN (exit $LASTEXITCODE)" }
203+
$code = $LASTEXITCODE
204+
if ($code -ne 0) {
205+
# Re-run under procdump (attaches as a debugger, so it sees the
206+
# __fastfail) to capture a full dump next to the .pdb for offline
207+
# analysis. The diagnostic markers printed above already identify the
208+
# last test reached.
209+
Write-Host "$t exited $code; re-running under procdump to capture a crash dump"
210+
& $procdump -accepteula -ma -e -x dumps "$dir\$t.exe"
211+
Copy-Item "$dir\$t.pdb" dumps -ErrorAction SilentlyContinue
212+
Copy-Item "$dir\$t.exe" dumps -ErrorAction SilentlyContinue
213+
# Symbolicate the faulting stack here on the runner, where every PDB
214+
# (api-test, wolfssh, wolfssl) and the MS symbol server are reachable,
215+
# so the crash location lands directly in this log.
216+
$cdb = Get-ChildItem `
217+
"C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe", `
218+
"C:\Program Files\Windows Kits\10\Debuggers\x64\cdb.exe" `
219+
-ErrorAction SilentlyContinue | Select-Object -First 1
220+
$dmp = Get-ChildItem dumps\*.dmp -ErrorAction SilentlyContinue | Select-Object -First 1
221+
if ($cdb -and $dmp) {
222+
$sym = "srv*https://msdl.microsoft.com/download/symbols;$PWD\$dir;$PWD\ide\winvs\wolfssh\$cfg;$PWD\..\wolfssl\$cfg"
223+
Write-Host "==== cdb !analyze of $($dmp.Name) ===="
224+
& $cdb.FullName -z $dmp.FullName -y $sym -c ".ecxr; !analyze -v; kb; q"
225+
}
226+
else {
227+
Write-Host "cdb or dump not found; skipping on-runner analysis (cdb='$cdb' dmp='$dmp')"
228+
}
229+
throw "$t failed under ASAN (exit $code)"
230+
}
197231
}
198232
233+
- name: Upload crash dumps
234+
if: always()
235+
uses: actions/upload-artifact@v4
236+
with:
237+
name: windows-asan-crash-dumps
238+
path: wolfssh/dumps
239+
if-no-files-found: ignore
240+

tests/api.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3755,23 +3755,37 @@ int wolfSSH_ApiTest(int argc, char** argv)
37553755
#endif
37563756

37573757
/* SCP tests */
3758+
printf("== running test_wolfSSH_SCP_CB\n"); WFFLUSH(stdout);
37583759
test_wolfSSH_SCP_CB();
3760+
printf("== running test_wolfSSH_SCP_SendSymlinkReject\n"); WFFLUSH(stdout);
37593761
test_wolfSSH_SCP_SendSymlinkReject();
3762+
printf("== running test_wolfSSH_SCP_ReKey\n"); WFFLUSH(stdout);
37603763
test_wolfSSH_SCP_ReKey();
3764+
printf("== running test_wolfSSH_SCP_ReKey_NonBlock\n"); WFFLUSH(stdout);
37613765
test_wolfSSH_SCP_ReKey_NonBlock();
3766+
printf("== running test_wolfSSH_SCP_ReKey_ToServer\n"); WFFLUSH(stdout);
37623767
test_wolfSSH_SCP_ReKey_ToServer();
3768+
printf("== running test_wolfSSH_SCP_ReKey_ToServer_NonBlock\n"); WFFLUSH(stdout);
37633769
test_wolfSSH_SCP_ReKey_ToServer_NonBlock();
37643770

37653771
/* SFTP tests */
3772+
printf("== running test_wolfSSH_SFTP_SendReadPacket\n"); WFFLUSH(stdout);
37663773
test_wolfSSH_SFTP_SendReadPacket();
3774+
printf("== running test_wolfSSH_SFTP_PartialSend\n"); WFFLUSH(stdout);
37673775
test_wolfSSH_SFTP_PartialSend();
3776+
printf("== running test_wolfSSH_SFTP_ReKey\n"); WFFLUSH(stdout);
37683777
test_wolfSSH_SFTP_ReKey();
3778+
printf("== running test_wolfSSH_SFTP_ReKey_NonBlock\n"); WFFLUSH(stdout);
37693779
test_wolfSSH_SFTP_ReKey_NonBlock();
3780+
printf("== running test_wolfSSH_SFTP_Confinement\n"); WFFLUSH(stdout);
37703781
test_wolfSSH_SFTP_Confinement();
3782+
printf("== running test_wolfSSH_SFTP_SetDefaultPath\n"); WFFLUSH(stdout);
37713783
test_wolfSSH_SFTP_SetDefaultPath();
37723784

37733785
/* Either SCP or SFTP */
3786+
printf("== running test_wolfSSH_RealPath\n"); WFFLUSH(stdout);
37743787
test_wolfSSH_RealPath();
3788+
printf("== all api tests completed\n"); WFFLUSH(stdout);
37753789
AssertIntEQ(wolfSSH_Cleanup(), WS_SUCCESS);
37763790

37773791
return 0;

0 commit comments

Comments
 (0)