mirror of
https://github.com/jkdansereau/goldeneye-pc-port.git
synced 2026-10-23 15:52:42 +02:00
tools_pc/debug.ps1: fix DLL-not-found on launch from a plain shell
The exe links MSYS2 mingw64 DLLs (SDL2, libgcc, libstdc++, libwinpthread, zlib). Run from a normal PowerShell those aren't on PATH, so gdb reported "During startup program exited with code 0xc0000135" and nothing ran. Prepend the mingw64 bin dir (derived from -Gdb) to PATH before launching. Also relax ErrorActionPreference around the gdb call so its stderr progress lines don't raise NativeCommandError noise mid-run. Claude-Session: https://claude.ai/code/session_01UpTM1AcBRJuTetoZNcCD5V
This commit is contained in:
1 parent
e69d7b58a9
commit
5baa53eb61
1 file changed
+14
@@ -30,6 +30,15 @@ $ErrorActionPreference = "Stop"
|
||||
$exe = "build-pc\ge007.x86_64.exe"
|
||||
if (-not (Test-Path $Gdb)) { throw "gdb not found at $Gdb (pass -Gdb <path>)" }
|
||||
|
||||
# The exe links MSYS2 mingw64 DLLs (SDL2, libgcc, libstdc++, libwinpthread,
|
||||
# zlib). Run from a plain PowerShell those aren't on PATH and the game dies at
|
||||
# startup with 0xc0000135 (DLL not found) -- gdb reports "During startup program
|
||||
# exited with code 0xc0000135". Prepend the mingw64 bin dir so it resolves.
|
||||
$MingwBin = Split-Path $Gdb
|
||||
if ((Test-Path $MingwBin) -and (($env:PATH -split ';') -notcontains $MingwBin)) {
|
||||
$env:PATH = "$MingwBin;$env:PATH"
|
||||
}
|
||||
|
||||
if (-not $NoBuild) {
|
||||
Write-Host "building (bash build-pc.sh ntsc-final) - pass -NoBuild to skip" -ForegroundColor DarkGray
|
||||
& "C:\msys64\usr\bin\bash.exe" -lc "cd '$($PWD -replace '\\','/')' && export PATH=/c/msys64/mingw64/bin:`$PATH && ./build-pc.sh ntsc-final"
|
||||
@@ -64,7 +73,12 @@ $gdbArgs = @(
|
||||
) + $GameArgs
|
||||
|
||||
Write-Host "launching under gdb - play until it crashes, output -> gdb.txt" -ForegroundColor Green
|
||||
# gdb writes progress to stderr; with ErrorActionPreference=Stop + 2>&1 that
|
||||
# raises NativeCommandError noise mid-run. Relax it just for the launch.
|
||||
$prevEAP = $ErrorActionPreference
|
||||
$ErrorActionPreference = "Continue"
|
||||
& $Gdb @gdbArgs 2>&1 | Tee-Object -FilePath gdb.txt | Out-Null
|
||||
$ErrorActionPreference = $prevEAP
|
||||
|
||||
Write-Host "`n===================== RESULT =====================" -ForegroundColor Yellow
|
||||
$fatal = Select-String -Path gdb.txt -Pattern "FATAL|Unknown GBI|assertion|abort\(\)" | Select-Object -First 5
|
||||
|
||||
Reference in new issue
Block a user