linux 工具之 pstack/gstack
描述
gstack attaches to the active process named by the pid on the command line, and prints out an execution stack trace. If ELF symbols exist in the binary (usually the case unless you have run strip(1)), then symbolic addresses are printed as well.
If the process is part of a thread group, then gstack will print out a stack trace for each of the threads in the group.
功能
当我们的程序陷入死锁或者死循环时,通过该命令可以很方便的把程序堆栈 dump 下来,进一步分析就可以找到原因了,非常有用的一个工具。
示例
pstack pid >1.txt
评论