我正在运行 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)):
我一直在寻找解决此问题的方法,但没有取得太大成功。我发现的唯一重要信息在这里
要转储线程信息,您必须使用 LinuxThreads libpthread.so 库的调试感知版本。
(要检查,请在 pthreads 库上运行 nm(1),并
确保定义了符号“__pthread_threads_debug”。)较新的 NPTL libpthread.so 库不支持线程。
在两台机器上对 /lib64/libpthread.so.0 执行 nm 时,我发现两者都有“__pthread_debug”。
将感谢帮助。