There are many threads created in my application. some of the threads name are visible in the gdb while i execute the command 'info threads', others are not displayed. How to get all the thread name itself instead of the hex value like 0xb7fe1424
4 Thread 0xb68ffb70 (LWP 18377) 0xb7fe1424 in __kernel_vsyscall ()
* 3 Thread 0xb7291b70 (LWP 18375) JKMainT (arg=0x0) at mylib.cpp:482
2 Thread 0xb7a92b70 (LWP 18374) 0xb7fe1424 in __kernel_vsyscall ()
1 Thread 0xb7a94730 (LWP 18371) 0xb7fe1424 in __kernel_vsyscall ()
Use the "info threads" command to see the IDs of currently known threads. The gdb thread debugging facility allows you to observe all threads while your program runs—but whenever gdb takes control, one thread in particular is always the focus of debugging. This thread is called the current thread .
The operating system's lightweight process (LWP) ID value for the thread. This ID is used in part for the OS to keep track of this thread for scheduling purposes. The GDB ID for the thread. This is the ID to use when specifying a specific thread in GDB commands.
If you upgrade to gdb 7.3 or later, "info thread" will show thread names; at least on native (not remote) Linux.
Threads don't have names by default - the JKMainT
string there is the name of the current function.
Try selecting one of the threads and viewing the backtrace - that might give you a good idea which thread it is. Otherwise, you could try prctl with PR_SET_NAME
if it's available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With