pstack.sh 改进版本

#!/bin/bash
if (( $# < 1 )) ; then
echo "usage: `basename $0` pid" 1>&2
exit 1
fi
if [[ ! -r /proc/$1 ]] ; then
echo "Process $1 not found." 1>&2
exit 1
fi
(gdb -quiet -nx /proc/$1/exe -p $1 <<EOF
define my_dump_all_stack
x
\$pc
bt
end
thread apply all my_dump_all_stack
EOF
) | sed -n -e 's/^(gdb) //' -e '/^#/p' -e '/^Thread/p' -e's/^0x/#* 0x/p'

相关文章:

  • 2021-10-12
  • 2021-11-15
  • 2021-10-06
  • 2021-11-17
  • 2021-09-04
  • 2021-12-12
  • 2021-06-30
猜你喜欢
  • 2021-09-18
  • 2022-12-23
  • 2021-09-27
  • 2021-08-08
  • 2022-12-23
  • 2021-08-06
  • 2021-10-26
相关资源
相似解决方案