run-gdb (502B)
1 #!/bin/sh 2 3 echo "Starting QEMU with GDB server (localhost:1234)..." 4 qemu-system-x86_64 -cdrom cowos.iso -m 512M -serial stdio -s -S & 5 QEMU_PID=$! 6 7 sleep 1 # just in case so we let it cook 8 9 if ! ps -p $QEMU_PID > /dev/null; then 10 echo "Error: QEMU failed to start." 11 exit 1 12 fi 13 14 echo "Launching GDB in TUI mode..." 15 gdb --tui \ 16 -ex "file ./kernel/bin/cowos" \ 17 -ex "target remote localhost:1234" \ 18 19 # kill QEMU when GDB exits 20 echo "GDB exited. Terminating QEMU..." 21 kill $QEMU_PID 2>/dev/null