本文将记录pstack与/proc/[pid]/stack相关笔记。

1. Overview

pstack显示user-space stack,/proc/[pid]/stack显示kernel stack。

2. pstack

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ man pstack

NAME
gstack - print a stack trace of a running process

SYNOPSIS
gstack pid

DESCRIPTION
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, 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.

3. /proc/[pid]/stack

权威教程:man proc


参考资料:

  1. How to understand “/proc/[pid]/stack”?
  2. What is the difference between /proc/self/stack and output from pstack?