6

I'm debugging a multi-threaded Java application in IntelliJ. I want to suspend all threads on some breakpoint and resume only selected thread while I step-over the code. I can suspend all threads on a breakpoint, but when I step-over the code from one thread, others are also running. Is it possible to do so?

Thanks in advance for the help!

  • Hmm, if you set a breakpoint, then all threads should still stop there. Does that not work? – markspace May 23 '20 at 03:37
  • All threads are suspending when a thread reaches the breakpoint. But, when I step-over and analyze the code, the rest of the threads are also resuming. – Karthik Chennupati May 23 '20 at 03:39
  • OK, that's a bit odd, but I can see how it might happen. In my debugger (not Intelij unfortunately) there's a separate window that I can manually suspend and resume threads (and inspect their call stack). Can you do that on your system? Alternately, when debugging, can you launch only one thread? – markspace May 23 '20 at 03:42
  • I can see a window summarizing all the threads. https://ibb.co/x3VBwWR – Karthik Chennupati May 23 '20 at 03:48
  • You can try to set up the following [breakpoint settings](https://prnt.sc/sosqic) and select the necessary thread via the [debug tool window](https://prnt.sc/sosrij). – Egor Klepikov May 27 '20 at 13:53
  • @EgorKlepikov - Thanks for the help. But, doing so would suspend only one thread (the thread that reached the breakpoint). I want to be able to debug the thread that reached the breakpoint while others are suspended – Karthik Chennupati May 27 '20 at 16:51

1 Answers1

5

There's a setting exactly for this here: Preferences | Build, Execution, Deployment | Debugger | Stepping - Resume only the current thread

Egor
  • 2,474
  • 17
  • 19