2
0

debug 771 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. # /proc/sys/kernel/core_pattern should be core.%p.%E
  3. COREPID=$1
  4. COREFILES=`ls -1 *core.$COREPID* 2>/dev/null | wc -l`
  5. COREFILE=`ls -1 *core.$COREPID* 2>/dev/null | head -n 1`
  6. if [ $COREFILES -gt 1 ]; then
  7. echo "Multiple files, using $COREFILE"
  8. fi
  9. if [ $COREFILES -eq 0 ]; then
  10. SERVICENAME=$1
  11. COREFILES=`ls -1 core.*.*$SERVICENAME 2>/dev/null | wc -l`
  12. COREFILE=`ls -1 core.*.*$SERVICENAME 2>/dev/null | head -n 1`
  13. if [ $COREFILES -gt 1 ]; then
  14. echo "Multiple files, using $COREFILE"
  15. fi
  16. fi
  17. if [ $COREFILES -eq 0 ]; then
  18. echo "Core file for $1 not found"
  19. exit 1
  20. fi
  21. echo "Using $COREFILE"
  22. EXECPATH=${COREFILE#*!}
  23. EXECPATH=`echo $EXECPATH | sed -e 's/!/\//g'`
  24. echo $EXECPATH
  25. echo ""
  26. echo ""
  27. gdb --core $COREFILE /$EXECPATH