pstack shell脚本
2015-05-21 10:11
736 查看
pstack查看进程堆栈信息,比较有用,记录下来
#!/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 backtrace="bt" if [[ -d /proc/$1/task ]] then if [[ `ls /proc/$1/task 2>/dev/null | wc -l` > 1 ]] then backtrace="thread apply all bt" fi ; elif [[ -f /proc/$1/maps ]] then if grep -e libpthread /proc/$1/maps > /dev/null 2>&1 then backtrace="thread apply all bt" fi fi GDB=gdb $GDB -quiet -nx /proc/$1/exe -p $1 <<<"$backtrace" | sed -n \ -e 's/^(gdb) //' \ -e '/^#/p' \ -e '/^Thread/p'
相关文章推荐
- Saltstack+Shell自动化分发脚本 推荐
- Saltstack+Shell自动化分发脚本
- 2.8-saltstack远程执行shell脚本
- Shell 脚本 学习
- 两个简单的shell脚本(关于启动和服务)
- 03- Shell脚本学习--字符串和数组
- Shell 脚本 100 例《一》
- C函数调用shell脚本
- shell脚本中局部变量local
- Shell脚本的条件控制和循环语句
- Shell脚本之crontab定时任务
- shell 脚本总结
- shell脚本调用C语言之字符串切分函数——strtok
- Shell脚本基础知识
- Windows Shell编程-第十二章.脚本Shell对象
- 通过 Shell 和 Expect 脚本实现对 IBM 刀片服务器高级管理模块固件的大量升级
- Shell脚本统计文件行数的8种方法
- 06- Shell脚本学习--其它
- linux C程序中获取shell脚本输出
- 用Shell脚本实现自动化完成属于自己的微型Linux!(一)