Search code examples
debugginggdbreverse-engineeringexploit

In multi thread process, when "[Switching to Thread]" in gdb?


When I'm debugging multi thread process in gdb, I meet "[Switching to Thread ~~ (LWP ~~)]". When the thread is changing to other thread, and why? I guess switching can be occurred by interrupt such as breakpoints. Am I right?


Solution

  • Yes, this is gdb notifying you that gdb's notion of the selected thread has changed. This happens if there is some debugging event, like a signal or a breakpoint stop, in a thread other than the one you had last selected.