Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silence gdb "switching to thread" output messages

I am currently debugging a multi-threaded application in Linux using gdb. I'm getting a lot of noise in the output and am wondering if there is anything I can do to silence it.
I'm getting a lot of these: "[Switching to Thread ~~ (LWP ~~)]" I have used the 'set print thread-events off', but that only seems to catch the start/stop of the thread.
Does anyone know of a way that I can get gdb to stop showing these Switching thread messages?

like image 778
Matt Freeman Avatar asked Sep 13 '25 17:09

Matt Freeman


2 Answers

I use gdb version 10.

set print thread-events off

Works for me. Links to the documentation.

like image 94
Candide Guevara Marino Avatar answered Sep 15 '25 07:09

Candide Guevara Marino


Does anyone know of a way that I can get gdb to stop showing these Switching thread messages?

There is no good way at present.

If you're desperate, one idea would be to write wrappers for commands like continue that work by redirecting output to /dev/null (and then undoing the redirection somewhere, like in a stop hook). This will cause you to miss any other gdb output as well though.

It's worth filing a gdb bug report about this.

like image 34
Tom Tromey Avatar answered Sep 15 '25 06:09

Tom Tromey