Skip to content

debug

debug #421

Workflow file for this run

name: Build
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Cache Tools
id: cache-tools
uses: actions/cache@v3
with:
path: C:\Tools
key: tools-${{ runner.os }}-${{ hashFiles('.github\workflows\build.yml') }}
- if: ${{ steps.cache-tools.outputs.cache-hit != 'true' }}
name: Setup Tools
run: |
curl.exe --location --create-dirs -oC:\TEMP\widberg-windows-x86_64-a651e95e126117fa5d1323834c3aa9b18561d325.zip https://nightly.link/widberg/llvm-project-widberg-extensions/workflows/widberg-build/main/widberg-windows-x86_64-a1f97cb828ba68b5e13a73cf1fb5911456574f82.zip
7z.exe x C:\TEMP\widberg-windows-x86_64-a651e95e126117fa5d1323834c3aa9b18561d325.zip -aoa -oC:\Tools\llvm-widberg
curl.exe --location --create-dirs -oC:\TEMP\DXSDK_Aug08.exe https://archive.org/download/dxsdk_aug08/DXSDK_Aug08.exe
7z.exe x C:\TEMP\DXSDK_Aug08.exe -aoa -oC:\Tools\DXSDK_Aug08 DXSDK/Include DXSDK/Lib
- name: Build (with minilua crash capture)
id: build
continue-on-error: true
shell: powershell
run: |
$ErrorActionPreference = "Stop"
New-Item -ItemType Directory -Force "$env:GITHUB_WORKSPACE\dumps" | Out-Null
$procdumpExe = "$env:RUNNER_TEMP\procdump\procdump64.exe"
if (-not (Test-Path $procdumpExe)) {
Invoke-WebRequest https://download.sysinternals.com/files/Procdump.zip -OutFile "$env:RUNNER_TEMP\Procdump.zip"
Expand-Archive "$env:RUNNER_TEMP\Procdump.zip" -DestinationPath "$env:RUNNER_TEMP\procdump" -Force
}
$buildScript = @'
for /f "delims=" %%i in ('"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath') do set VS_PATH=%%i
call "%VS_PATH%\VC\Auxiliary\Build\vcvarsall.bat" x86
cmake -B build -GNinja -DLLVM_WIDBERG="C:\Tools\llvm-widberg" -DDXSDK_DIR=C:\Tools\DXSDK_Aug08\DXSDK
cmake --build build -v
'@
$buildScriptPath = Join-Path $env:RUNNER_TEMP "build_fmtk.cmd"
Set-Content -Path $buildScriptPath -Value $buildScript -Encoding Ascii
$procdump = Start-Process `
-FilePath $procdumpExe `
-ArgumentList "-accepteula -e -t -ma -x `"$env:GITHUB_WORKSPACE\dumps`" -w minilua.exe" `
-PassThru
Start-Sleep -Seconds 1
try {
& cmd.exe /c "`"$buildScriptPath`""
$buildExit = $LASTEXITCODE
} finally {
if ($procdump -and -not $procdump.HasExited) {
Stop-Process -Id $procdump.Id -Force -ErrorAction SilentlyContinue
}
}
exit $buildExit
- name: Print minilua stack trace
if: steps.build.outcome == 'failure'
shell: powershell
run: |
$dumpsDir = "$env:GITHUB_WORKSPACE\dumps"
$dmp = Get-ChildItem $dumpsDir -Filter *.dmp -ErrorAction SilentlyContinue |
Sort-Object LastWriteTime -Descending |
Select-Object -First 1
$cdb = "C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\cdb.exe"
if (-not (Test-Path $cdb)) {
$cdb = "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe"
}
if (-not (Test-Path $cdb)) {
Write-Host "::warning::cdb.exe not found in Windows Kits debugger paths."
exit 0
}
$env:_NT_SYMBOL_PATH = "srv*C:\symbols*https://msdl.microsoft.com/download/symbols;$env:GITHUB_WORKSPACE\build\dependencies\LuaJIT\src\host\cmake\minilua"
if ($dmp) {
Write-Host "Analyzing dump: $($dmp.FullName)"
& $cdb -z $dmp.FullName -c ".symfix; .reload; !analyze -v; .ecxr; kb; kv; q"
exit 0
}
Write-Host "::warning::No dump captured from minilua.exe; rerunning minilua under cdb."
$minilua = "$env:GITHUB_WORKSPACE\build\dependencies\LuaJIT\src\host\cmake\minilua\minilua.exe"
$genversion = "$env:GITHUB_WORKSPACE\dependencies\LuaJIT\src\host\genversion.lua"
$rolling = "$env:GITHUB_WORKSPACE\dependencies\LuaJIT\src\luajit_rolling.h"
$relver = "$env:GITHUB_WORKSPACE\build\dependencies\LuaJIT\src\luajit_relver.txt"
$luajith = "$env:GITHUB_WORKSPACE\build\dependencies\LuaJIT\src\luajit.h"
if (-not (Test-Path $minilua)) {
Write-Host "::warning::minilua.exe not found at $minilua"
exit 0
}
if (-not (Test-Path $genversion) -or -not (Test-Path $rolling)) {
Write-Host "::warning::LuaJIT genversion inputs not found."
exit 0
}
New-Item -ItemType Directory -Force (Split-Path -Parent $relver) | Out-Null
if (-not (Test-Path $relver)) {
Set-Content -Path $relver -Value "ROLLING" -Encoding Ascii
}
& $cdb -o -G -g -c ".symfix; .reload; sxe av; g; .echo ==== exception context ====; .ecxr; kb; kv; !analyze -v; q" `
$minilua $genversion $rolling $relver $luajith
- name: Upload minilua dumps
if: always()
uses: actions/upload-artifact@v4
with:
name: minilua-dumps
path: ${{ github.workspace }}\dumps\*.dmp
if-no-files-found: ignore
- name: Fail job if build failed
if: steps.build.outcome == 'failure'
shell: powershell
run: exit 1