Files
goldeneye-pc-port/tools_pc/repro_gdb.sh
T
James Dansereau 73820a0c24 M-23: WS6 Facility playtest — D135/D137/D138/D139 (firefight, aim, freeze, unload)
First real human WS6 playthrough. Each crash is a subsystem the 21-level
boot sweep never exercises.

- D135 (propobj.c) bgTestHitOnObj: unported N64 GBI parser — raw 8-byte-Gfx
  byte/word indices desync on the PC 16-byte Gfx stream, walk off the DL.
  Ported #ifdef PORT to gdl->words.w0/.w1 shifts (mirrors pd_port bg.c:3635).
  Sub-fix: objHit:9717 div-by-0 — texnum recovery not portable, force -1.
- D137 (gunfire.c) gunDrawSight: s32 sp54 holds a Gfx*; 4-byte slot splices
  adjacent stack into the pointer -> wild DL write on right-mouse aim.
  #ifdef PORT: Gfx *sp54.
- D138 (snd.c) sndCreatePostEvent: parked audio never drains evtq->allocList,
  per-objTick positional-sound posts stall the main thread ("1 room from the
  end" freeze). #ifdef PORT no-op until audio lands (D77).
- D139 (cleanup_objects.c) cleanupObjects: read the propDef type via
  (u8)obj[0] — correct only big-endian (type = low byte of the header word).
  On LE that's extrascale -> walk never hits PROPDEF_END -> runs off the blob
  -> frees garbage -> stage-unload crash. #ifdef PORT uses pdef->type.
  UNVERIFIED (fast teardown test hit D140 first).

Open: D140 pause-menu watch-model NULL matrix; D118c aim-mode mouse-down
-> crouch. New harness tools_pc/repro_gdb.sh + build-pc/d136_cmds.txt.

-level_09 unregressed (91.65%). Docs: PCPortResearch §F D135-D140,
PORT-LEARNINGS §B/§C, HANDOFF M-23 + M-24 next-task.
2026-08-30 11:28:50 -04:00

48 lines
1.6 KiB
Bash

#!/bin/bash
# Repro harness: launch a level under gdb-attach, dump a full backtrace on the
# first access violation (0xc0000005 / SIGSEGV). Human plays; close nothing --
# gdb prints the trace and detaches when it faults.
#
# Usage: ./tools_pc/repro_gdb.sh <XX> e.g. ./tools_pc/repro_gdb.sh 34
set -e
cd "$(dirname "$0")/.."
export PATH="/c/msys64/mingw64/bin:$PATH"
LEVEL="${1:?usage: repro_gdb.sh <XX>}"
STAMP=$(date +%H%M%S)
LOG="build-pc/repro_L${LEVEL}_${STAMP}.log"
GDBLOG="build-pc/repro_L${LEVEL}_${STAMP}.gdb.txt"
export GE_PCDUMP="1-99999:30" # rolling frame dump -> ppm/ (last few = pre-crash)
cat > "build-pc/repro_cmds_${STAMP}.txt" <<'EOF'
set pagination off
set width 0
set confirm off
handle SIGSEGV stop print nopass
continue
echo \n\n=================== FAULT CAUGHT ===================\n
bt
echo \n--- frame 0 ---\n
frame 0
info args
info locals
echo \n--- full backtrace ---\n
bt full
echo \n--- registers ---\n
info registers rax rbx rcx rdx rsi rdi rbp rsp r8 r9 r10 r11
echo \n===================================================\n
detach
quit
EOF
echo "== launching -level_${LEVEL} (nohup); play a firefight to trigger the crash =="
nohup ./build-pc/ge007.x86_64.exe "-level_${LEVEL}" > "$LOG" 2>&1 &
BASHPID=$!
sleep 6
# winpid = 4th column of ps -p <bashpid>
WINPID=$(ps -p "$BASHPID" | awk 'NR==2{print $4}')
echo "== bash pid=$BASHPID winpid=$WINPID attaching gdb =="
echo "== game log: $LOG"
echo "== gdb log: $GDBLOG"
gdb -batch -x "build-pc/repro_cmds_${STAMP}.txt" -p "$WINPID" 2>&1 | tee "$GDBLOG"
echo "== done. crash log: ge007.crash.log ; pre-crash frames: ppm/ =="