打印一个正在运行的进程的调用栈。由于进程是由一组线程构成,gstack 会将这些线程的调用栈也打印出来。
# gstack `pidof main`
Thread 2 (Thread 0x7f5717fff700 (LWP 17794)):
#0 0x00007f57464b75bb in recv () from /lib64/libpthread.so.0
#1 0x00007f57472ca995 in thrift_socket_peek () from /lib64/libthrift_c_glib.so.0
#2 0x00007f57472cc468 in thrift_buffered_transport_peek () from /lib64/libthrift_c_glib.so.0
#3 0x00007f57472cf14b in thrift_simple_server_proc () from /lib64/libthrift_c_glib.so.0
#4 0x00007f57464b0dc5 in start_thread () from /lib64/libpthread.so.0
#5 0x00007f57458b621d in clone () from /lib64/libc.so.6
Thread 1 (Thread 0x7f57485adf00 (LWP 17381)):
#0 0x00007f57458b67f3 in epoll_wait () from /lib64/libc.so.6
#1 0x00007f5746b1c064 in nn_poller_wait () from /lib64/libnanomsg.so.5
#2 0x00007f5746afb9c1 in nn_worker_routine () from /lib64/libnanomsg.so.5
#3 0x00007f574865f7c2 in main ()