gdb-kstack.sh 387 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. if [ $# -lt 1 ]; then
  3. echo "usage $0 host:port"
  4. echo " example: $0 localhost:1234"
  5. exit 1
  6. fi
  7. remote=$1
  8. (
  9. cat <<-EOF
  10. set arch i386:x86-64
  11. file sys/src/9/k10/9k8cpu.32bit
  12. target remote $remote
  13. set \$off = 0
  14. EOF
  15. for i in `seq 1 400`; do
  16. #echo 'p/a *(void(**)())((long*)$sp+$off)'
  17. echo 'info line **(void(**)())((long*)$sp+$off++)'
  18. done
  19. echo 'quit'
  20. ) | gdb