Stack

pstack 不列印堆棧輸出

  • May 22, 2018

我正在執行 pstack 來查找在兩台機器(都是 RHEL)上執行的應用程序的函式堆棧

在我的一台機器上,它按預期工作

[root@civ4cez191 bin]# pstack 22947
Thread 2 (Thread 0x7f63cbe7d700 (LWP 22949)):
#0  0x0000003c3640f0cd in pause () from /lib64/libpthread.so.0
#1  0x0000000000485a78 in _signalWaitThread(void*) ()
#2  0x0000003c36407aa1 in start_thread () from /lib64/libpthread.so.0
#3  0x0000003c360e8aad in clone () from /lib64/libc.so.6
Thread 1 (Thread 0x7f63d2d07700 (LWP 22947)):
#0  0x0000003c360e1523 in select () from /lib64/libc.so.6
#1  0x00000000004ccc36 in TFDSETSelect(void*, void*, int) ()
#2  0x00000000004cb50f in SvrInit1(unsigned int (*)(void*, void**), unsigned int (*)(void*, void*, void**, unsigned int*), void (*)(void*), unsigned int (*)(unsigned short, unsigned short), void (*)(unsigned short, unsigned short), void (*)(unsigned short, unsigned short), unsigned short, unsigned char, unsigned short, unsigned char) ()
#3  0x00000000004259f0 in main ()

但是在其他機器中它只是列印執行緒的名稱

[root@civ4cez194 bin]# pstack 12672
Thread 7 (Thread 0x7f01892e2700 (LWP 12674)):
Thread 6 (Thread 0x7f0188aa0700 (LWP 12743)):
Thread 5 (Thread 0x7f0188a1e700 (LWP 7090)):
Thread 4 (Thread 0x7f0188a5f700 (LWP 7127)):
Thread 3 (Thread 0x7f01889dd700 (LWP 7178)):
Thread 2 (Thread 0x7f0188ae1700 (LWP 7235)):
Thread 1 (Thread 0x7f0193ca0740 (LWP 12672)):

我一直在尋找解決此問題的方法,但沒有取得太大成功。我發現的唯一重要資訊在這裡

For thread information to be dumped, you have to use the debug-aware version of the LinuxThreads libpthread.so library.
(To check, run nm(1) on your pthreads library, and
make sure that the symbol "__pthread_threads_debug" is defined.) Threads are not supported with the newer NPTL libpthread.so library.

在兩台機器上對 /lib64/libpthread.so.0 執行 nm 時,我能找到的唯一與調試相關的欄位是“__pthread_debug”,但它在兩台機器上都存在。

將感謝幫助。

所以事實證明,由於回溯無法正常工作,設置中的 python 安裝存在問題,修復 python 安裝解決了問題。

引用自:https://unix.stackexchange.com/questions/444995