#!/bin/sh
# DF-5475 — differential control: same debugger entry in DDB mode.
# Serial must show the ddb banner + db> prompt (trap entry works); the
# guest then sits at the db> prompt (serial is output-only) -> recover
# with:  dfbsd-qemu/vm.sh reset with-src
VM=../../../dfbsd-qemu/vm.sh
cd "$(dirname "$0")"

echo "[*] control: sysctl debug.enter_debugger=ddb  (expect ddb banner, then wedge at db> prompt)"
set +e
timeout 45 "$VM" run_root 'sysctl debug.enter_debugger=ddb; echo DDB_SYSCTL_RETURNED'
echo "CONTROL_RC=$?"
timeout 20 "$VM" run_root 'echo GUEST_ALIVE' && echo "GUEST_ANSWERS=yes" || echo "GUEST_ANSWERS=NO (paused at db>)"
