dump_crash 367 B

1234567891011121314151617
  1. #!/bin/sh
  2. prg=$(basename "$0")
  3. port="$1"
  4. if [ -z "$port" -o "$port" = "-h" ]
  5. then
  6. echo "usage: $0 <port>" >&2
  7. echo "Connect to <port> and dump the content of last crash using D21 to stdout" >&2
  8. exit 1
  9. fi
  10. set -e
  11. tmp=$(mktemp)
  12. trap "rm -f \"$tmp\"" EXIT
  13. echo D21 > "$tmp"
  14. printcore -v "$port" "$tmp" 2>&1 | \
  15. sed -ne '/^RECV: D21 /,/RECV: ok$/s/^RECV: //p'