Put a breakpoint on "run" method of the new thread. That would halt execution once the thread starts.
In addition to Erik Kaju's answer. If you are debugging CDT (this might be applicable for Java as well, I am not sure about that) then
- Put a breakpoint on run() method (or its equivalent). Or any point at which you are sure that the required threads and the not-required thread (the ones which will be removed by the filter) both are running.
- 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. So this breakpoint will only be hit for that particular thread.
The drawback is this procedure has to be repeated for every debug session. If anyone can provide short cut for it then that would be nice.
In addition to Shamit Verma's answer:
When dealing with debugging multi-threaded Java applications, it is better not to use standard breakpoints that suspend just the thread where the breakpoint is set. Defining a standard breakpoint in your application, will only break the related thread. The other threads will be still running. In eclipse debugger for some reason will cause the debugger to skip breakpoints if other threads already started.
The solution for debugging Java:
Define a breakpoint in desired thread (@ Run() method i expect..), right click at the breakpoint -> breakpoint properties.
In breakpoint properties dialog tick "Suspend VM" instead of "Suspend thread".
If you do like this your entire VM will be suspended in case of a breakpoint is reached.
In C/C++ CDT, use set scheduler-locking on :
As @Employed Russian says in answer-to-other-question, the GDB command:
set scheduler-locking on
will cause other C/C++ threads to remain suspended while allowing the current thread to step. This command can be executed in Eclipse/CDT Debug by suspending program execution and opening the 'Debugger Console' perspective and typing: set scheduler-locking on It can later be returned to normal with: set scheduler-locking off
See GDB documentation for more information on scheduler-locking and non-stop mode, which allows other threads to run while stopping a single thread.
- Debugging multiple threads in eclipse
- Multiple threads debugging in Eclipse
- Eclipse CDT multithreaded debugging not-optimal - how does one run threads exclusively?
- Is it possible to debug multiple threads in eclipse in different windows?
- Debugging with Eclipse using multiple windows
- Multiple IDE debugging in Eclipse
- Debugging multiple variables with same name in Eclipse
- git : multiple master HEAD threads in Eclipse
- Debugging broadly multithreaded programs with Eclipse CDT: Finding threads
- Debugging multiple hadoop jvms with Eclipse
- Open multiple Eclipse workspaces on the Mac
- Viewing complete strings while debugging in Eclipse
- Any tips on how to organize Eclipse environment on multiple monitors?
- Combining multiple @SuppressWarnings annotations - Eclipse Indigo
- Multiple contexts with the same path error running web service in Eclipse using Tomcat
- Modify/view static variables while debugging in Eclipse
- Variables not showing while debugging in Eclipse
- Remote debugging Tomcat with Eclipse
- How to execute some function in eclipse while debugging a java program?
- JBoss debugging in Eclipse
- Moving the instruction pointer while debugging Java in Eclipse
- Android app crashes with SIGABRT Signal 6 only while Eclipse debugging
- Device going offline randomly (and appearing multiple times as offline) in Eclipse - fixes?
- eclipse multiple text selection like sublime text 2
- Multiple Git repositories for each Eclipse project or one Git repository
- Eclipse multiple tab rows
- Android NDK debugging in Eclipse - how to stop segfaults/SIGILL that only occur when stepping in native code
- How to skip a statement in Eclipse during debugging
- is it possible to edit code while debugging in visual studio, like in eclipse (java)
- Eclipse file search finds the same file multiple times
More Query from same tag
- phonegap doesn't generate platforms/android subdirectory?
- Unable to Undo Hijack with IBM Clear Case Eclipse Plugin 7.6.2 and Clear Case 18.104.22.168
- GWT - Refreshing changes with 'Development Mode' with Maven
- DataBinding to database for swt table
- Can EGit revert a merge commit?
- Inspecting Integer variable within an if statement gives Null Pointer in Eclipse
- consuming web service from android eclipse using edittext and button
- Finding references of MyClass.toString() in Eclipse while ignoring Object.toString()
- OpenHab build failed with Maven
- What is the point of ArrayLists?
- I am new to java, and have a school assignment i need assistance for
- Eclipse errors in CakePHP 3.x vendor folder
- Eclipse not recognizing my android phone - says target unknown
- Mac Eclipse not resolving C++ lib functions in NDK
- Java: Do-While loop
- Read PATH variable using Java (in Eclipse on Mac OS X) differs from shell
- Any tool for database testing (TDD) for Eclipse?
- Tomcat fails to start from Eclipse with JVM Launcher exception
- How to get all file Present in plugin
- Thread.sleep() proving superior to implicitlyWait
- dimens.xml -> R not generating
- Python Code running in windows, can I bypass part of it using "if not win32"
- Eclipse RCP java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
- Possible Android project depends of other (non library) Android project?
- XText2 adoption and migration
- Adding a newly created Maven SNAPSHOT into another project
- Eclipse - glassfish can't start because org.xml.sax.SAXParseException;
- Android: How to Debug an OpenGL-ES app
- Display captured image
- % after message suggestions in eclipse or sts