In gdb when I gave command info th I got the output like:
(gdb) info th 5 Thread 0x7ffff3b54700 (LWP 1542) 0x00007ffff6705343 in poll () from /lib64/libc.so.6 4 Thread 0x7ffff2752700 (LWP 1544) 0x00007ffff670f163 in epoll_wait () from /lib64/libc.so.6 3 Thread 0x7ffff3153700 (LWP 1543) 0x00007ffff670f163 in epoll_wait () from /lib64/libc.so.6 2 Thread 0x7ffff4763700 (LWP 1541) 0x00007ffff69c7930 in sem_wait () from /lib64/libpthread.so.0 * 1 Thread 0x7ffff7fe17e0 (LWP 1520) 0x00007ffff66d2cdd in nanosleep () from /lib64/libc.so.6 I can conclude that there are 5 threads are running. But I can't get name of the function of the threads.
How can I get function name of the thread using gdb?
The thread 5 is paused its execution on poll(). But poll() is called by a function which is started by the thread. In my case I stated thread for set_up_socket_to_listen(). From where 'poll' is called. I want to print 'set_up_socket_to_listen'.
pthread_t l_thread; pthread_create(&l_thread, 0, (void *)&set_up_socket_to_listen, NULL); I want to print set_up_socket_to_listen name
poll()at this instant.