[Linux][2010-12-31] pstack 命令
来源:互联网 发布:python官方文档pdf 编辑:程序博客网 时间:2024/06/08 01:07
1.安装
绝大数操作系统都系统pstack命令支持, 只有极少数会出现如下现象.
]# pstack
-bash: pstack: command not found
如果出现,请键入:]# yum install pstack
]# 为提示符, 不需要键入, 如果你不知道]# 是什么, 那你需要加油了哦! O(∩_∩)O哈哈~
键入后会出现如下信息,
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: centos.ustc.edu.cn
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package pstack.x86_64 0:1.2-7.2.2 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================================
Installing:
pstack x86_64 1.2-7.2.2 base 4.5 k
Transaction Summary
=========================================================================================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Total download size: 4.5 k
Is this ok [y/N]: y----------------------------------------------------------此处请键入y(如果上方版本信息 和你系统一直的话)
Downloading Packages:
pstack-1.2-7.2.2.x86_64.rpm | 4.5 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : pstack 1/1
Installed:
pstack.x86_64 0:1.2-7.2.2
Complete!
注意: yum install 将安装最新版本, 如果你不希望安装最新版本, 请google一下.
pstack为shall脚本, 也可直接复制运行, 我使用yum install的原因是, 方便省事. 不用google.
附带pstack源码:
]# cat `which pstack`
#!/bin/sh
if test $# -ne 1; then
echo "Usage: `basename $0 .sh` <process-id>" 1>&2
exit 1
fi
if test ! -r /proc/$1; then
echo "Process $1 not found." 1>&2
exit 1
fi
# GDB doesn't allow "thread apply all bt" when the process isn't
# threaded; need to peek at the process to determine if that or the
# simpler "bt" should be used.
backtrace="bt"
if test -d /proc/$1/task ; then
# Newer kernel; has a task/ directory.
if test `/bin/ls /proc/$1/task | /usr/bin/wc -l` -gt 1 2>/dev/null ; then
backtrace="thread apply all bt"
fi
elif test -f /proc/$1/maps ; then
# Older kernel; go by it loading libpthread.
if /bin/grep -e libpthread /proc/$1/maps > /dev/null 2>&1 ; then
backtrace="thread apply all bt"
fi
fi
GDB=${GDB:-/usr/bin/gdb}
if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
readnever=--readnever
else
readnever=
fi
# Run GDB, strip out unwanted noise.
$GDB --quiet $readnever -nx /proc/$1/exe $1 <<EOF 2>&1 |
set width 0
set height 0
set pagination no
$backtrace
EOF
/bin/sed -n /
-e 's/^/((gdb) /)*//' /
-e '/^#/p' /
-e '/^Thread/p'
若果有一些符号被 "屏蔽" "系统篡改" 请执行 cat `which pstack` 即可, `不是单引号哦!!!!!!!
- [Linux][2010-12-31] pstack 命令
- linux命令之pstack
- linux ps pstree pstack命令
- Linux命令 --- ps/pstack/pstree
- Linux strace、pstack 命令 使用详解
- Linux strace、pstack 命令 使用详解
- linux下的pstack和gstack命令
- Linux利器 strace |pstack
- AIX下好用的命令procstack hpux 对应的命令为pstack linux下为gstack
- 跟踪进程栈命令pstack
- Linux下多线程查看工具(pstree、ps、pstack),linux命令之-pstree使用说明
- pstack
- pstack
- pstack
- pstack
- pstack
- linux 下 du, df, top, free, pstack, su, sudo(sudo -, sudo -s), adduser, password命令介绍
- Linux下查看线程—pstack
- 【引用】UPS电源外配电池的计算方法
- C#中类及类型成员修饰符:public,private,protected,internal的区别
- 关于 extjs treepanel 复选框 选中 父节点 的问题
- 用E-SATA移动硬盘启动系统
- 我的WCF之旅(7):面向服务架构(SOA)和面向对象编程(OOP)的结合——如何实现Service Contract的继承
- [Linux][2010-12-31] pstack 命令
- 检查身份证信息是否合法
- // 反转一个字符串
- 不借助第三变量将两个变量值互换
- jvm的两款内存检测工具
- 正则
- 社会化网络(SNS)招聘的魅力和弊端
- 德安全专家破解手机GSM加密算法
- 将DataGirdView数据,导出EXCEL文件