I am running pstack to find function stack for my application running on two machines (both RHEL)
In one of my machine it is working as expected
[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 ()
However in other machine it is just printing name of the threads
[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)):
I have looked for a way to resolve this but haven't had much success. Only significant information I found was here
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.
On doing nm on /lib64/libpthread.so.0 on both the machines, the only debug related field I could find was "__pthread_debug", however it is present in both.
Will appreciate help.
__pthread_threads_debugand you say you found__pthread_debug. They’re not the same. Please do not respond in comments; edit your question to make it clearer and more complete.__pthread_threads_debugmust be defined forpstackto work correctly (to dump thread information), and__pthread_threads_debugisn’t defined on either machine, then it’s a mystery why the first machine is working. I guess I was being a little snarky; I apologize. But I’m serious. P.S. It would be nice if you would identify the source of that “For thread information to be dumped” statement.