#!/bin/sh
# DF-3758 — evidence collector: the unconditional panic("tulip_rx_intr") on
# bus_dmamap_load_mbuf() failure in the RX-replenish path
# (sys/dev/netif/de/if_de.c:3134-3140) is compiled into the running guest
# kernel (driver `de' is in X86_64_GENERIC), but the guest has no DEC 2114x
# NIC, so the path cannot be executed here.  This script records:
#   1. the panic string present in /boot/kernel/kernel (code is live);
#   2. the source lines in /usr/src (running kernel's source copy);
#   3. driver attached instances (sysctl hw.de.*) = 0 -> not executable.
set -e
echo "== running kernel =============================================="
uname -a
echo
echo "== panic string inside /boot/kernel/kernel ====================="
strings /boot/kernel/kernel | grep -n "tulip_rx_intr" || echo "NOT FOUND"
echo
echo "== source: /usr/src/sys/dev/netif/de/if_de.c:3127-3145 ========="
sed -n '3127,3145p' /usr/src/sys/dev/netif/de/if_de.c
echo
echo "== driver compiled in / attached? ==============================="
echo -n "kldstat pci/if_de: "; kldstat -v | grep -c "pci/if_de"
echo -n "hw.de.* sysctl OIDs: "; sysctl -a 2>/dev/null | grep -c "^hw\.de\."
echo -n "DEC (0x1011) PCI devices: "; pciconf -l 2>/dev/null | grep -c "chip=0x..11" || true
echo
echo "CONCLUSION: panic path is present in the live kernel but unreachable:"
echo "no de(4) instance exists on this guest (no DEC 2114x hardware)."
