Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disable new thread/thread exited messages in gdb?

I'm debugging an application, and I get a lot of messages like this:

[New Thread 0x7fffde152700 (LWP 11142)] [Thread 0x7fffde152700 (LWP 11142) exited] [New Thread 0x7fff967fa700 (LWP 11143)] [Thread 0x7fff967fa700 (LWP 11143) exited] [New Thread 0x7fff967fa700 (LWP 11144)] [Thread 0x7fff967fa700 (LWP 11144) exited] [New Thread 0x7fff967fa700 (LWP 11145)] [Thread 0x7fff967fa700 (LWP 11145) exited] [New Thread 0x7fffde152700 (LWP 11146)] [Thread 0x7fffde152700 (LWP 11146) exited] [New Thread 0x7fffde152700 (LWP 11147)] [Thread 0x7fffde152700 (LWP 11147) exited] [New Thread 0x7fffde152700 (LWP 11148)] [Thread 0x7fffde152700 (LWP 11148) exited] [New Thread 0x7fffde152700 (LWP 11149)] [Thread 0x7fffde152700 (LWP 11149) exited] [New Thread 0x7fffde152700 (LWP 11150)] [Thread 0x7fffde152700 (LWP 11150) exited] [New Thread 0x7fffde152700 (LWP 11151)] [Thread 0x7fffde152700 (LWP 11151) exited] [New Thread 0x7fffde152700 (LWP 11152)] [Thread 0x7fffde152700 (LWP 11152) exited] [New Thread 0x7fffde152700 (LWP 11153)] [Thread 0x7fffde152700 (LWP 11153) exited] [New Thread 0x7fffde152700 (LWP 11154)] [Thread 0x7fffde152700 (LWP 11154) exited] [New Thread 0x7fff967fa700 (LWP 11155)] [Thread 0x7fff967fa700 (LWP 11155) exited] [New Thread 0x7fffde152700 (LWP 11156)] [Thread 0x7fffde152700 (LWP 11156) exited] [New Thread 0x7fffde152700 (LWP 11157)] [Thread 0x7fffde152700 (LWP 11157) exited] 

I'm almost never interested in this messages. They make it much harder to read the rest of the output. They can change the timing behaviour of the program, making it hard to reproduce and debug race hazards. How can I disable these messages?

like image 365
Matthew Avatar asked Jun 07 '12 18:06

Matthew


People also ask

Does GDB breakpoint stop all threads?

Whenever your program stops under GDB for any reason, all threads of execution stop, not just the current thread. This allows you to examine the overall state of the program, including switching between threads, without worrying that things may change underfoot.

What is new LWP in GDB?

LWP is an acronym and stands for Light Weight Process. It is in effect the thread ID of each newly spawned thread.

How to check thread info in GDB?

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.

Is GDB multithreaded?

GDB provides these facilities for debugging multithreaded programs: thread threadno , a command to switch between threads. info threads, a command to inquire about existing threads. thread apply [ threadno ] [ all ] args , a command to apply a command to a list of threads.


1 Answers

You can turn off thread events while running gdb:

set print thread-events off 
like image 140
Matthew Avatar answered Sep 25 '22 20:09

Matthew