]> begriffs open source - meson-cross/blob - armv7m/gdb.sh.in
Scripts for choice of debuggers
[meson-cross] / armv7m / gdb.sh.in
1 #!/bin/sh -e
2
3 # Kill any existing OpenOCD instances to avoid port conflicts
4 pkill -9 openocd 2>/dev/null || true
5
6 @OCD@ -f @OCDCONF@ &
7 OPENOCD_PID=$!
8
9 cleanup() {
10         kill $OPENOCD_PID 2>/dev/null || true
11         # Give it a moment to exit
12         sleep 0.2
13         # Force kill if still running
14         kill -9 $OPENOCD_PID 2>/dev/null || true
15 }
16 trap cleanup EXIT
17
18 @GDB@ -x @GDBCONF@ "$1"