Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging with Eclipse using multiple windows

I usually run a dual-monitor setup, so I have two Eclipse windows open for the same workspace, displaying different files. When I'm debugging and a breakpoint is hit, Eclipse switches to the "Debug" perspective, but it also shows the file/line where the breakpoint is in both of my windows. This occurs even if the file containing the breakpoint was open in one window but not the other (before the breakpoint was hit).

This is really annoying.

How can I have Eclipse only show the file containing the breakpoint in one window? Ideally, it would choose which window based on where the file is open already. If it's not already open somewhere, I don't really care which window it pops up in.

like image 931
Matt Ball Avatar asked Feb 17 '10 20:02

Matt Ball


People also ask

How do I debug a multithreaded program in Eclipse?

Start debug session. When the breakpoint in run is hit, you can go to another breakpoint, enable that breakpoint if it was disabled. Then right click on the breakpoint -> go to Filters, now you can select the thread you want the breakpoint to be remain enabled for and you can uncheck the rest of the threads.

How do I debug multiple projects in Eclipse?

Put breakpoints in both projects and launch them in debug mode. Switch to "Debug" perspective and find "Debug" view there. You will see a list of active debug sessions with their respective call stacks. You can click on every debug step of every debug session and Eclipse will open that step in code editor.


4 Answers

You can create another workspace and in that workspace create a new project from the same src code (same files in file system) of the one in your current project in your current workspace. That would let you stop on one breakpoint without the other window stopping their too. Notice that after you make some code modifications in one project you'd have to refresh the other project for those changes to apply in it.

like image 157
kruvi Avatar answered Oct 05 '22 13:10

kruvi


Eclipse switches to the debug perspective for all windows the debug perspective has been opened once (i.e. the little icon on the right top corner is available). If you close that perspective (switch to another perspective is not sufficient), it won't switch to it anymore on that window.

At least, that's the behaviour I observed on Kepler (I know, that question is older but just came across, maybe it still helps someone).

like image 23
user1034081 Avatar answered Oct 05 '22 11:10

user1034081


This worked for me: In Window->Preferences->Run/Debug->Launching->Launch Configurations enable "Apply window working set(s)"

Personally I find this more efficient than creating two workspaces.

like image 31
pru4ever Avatar answered Oct 05 '22 11:10

pru4ever


Closing the Debug perspective (righ-click on the little icon on the right top corner) worked for me. I'm using Oxygen and I have the following settings in the Run/Debug Preferences:

  • Open the associated perspective when launching: Never
  • Open the associated perspective when an application suspends: Prompt
like image 20
Gep Avatar answered Oct 05 '22 12:10

Gep