Thread window is empty - multithreading

I am debugging console application, it has several threads running. Then why Thread Window is empty in VS 2010? I do not see any thread listed here, even main thread is not here. Do I need to enable something?

Seen in HansPassant's comment above: This is normal, please try to set a breakpoint or utilize Debug + Break All.

Related

Modifying the conditions of all breakpoints in Visual Studio 2015+

I am debugging a large application, with multiple threads going through the parts I am interested in. I would like to use breakpoints to follow just one of these threads.
In order to do this I am using the breakpoint Filter condition, ThreadId=#. However when stopping and starting the solution, the ThreadId of the thread I would like to follow changes. I currently need to change all of my breakpoint conditions manually by right clicking them in the Breakpoint window, selecting Settings, then changing the ThreadId condition to point to the right thread.
Is there a way to automate this process?
EDIT: For my application, the best way to resolve this was to set Conditional breakpoints monitoring a particular variable which was consistent in the thread I wanted to follow, rather than filtering by thread ID.
If you mean that you want to change the Filter condition breakpoint automatically, it would have a limitation for it.
We could set it using two ways:
(1)Using the breakpoint windows as yours.
(2) Hover over the breakpoint to bring up the breakpoint’s toolbar and click the “Settings…” icon.

Debugging Multithreaded C++ program in Visual Studio 2008

I am debugging a multi-threaded program in Visual Studio 2008.
When I break in the main thread, what is the status of the other threads in the process ?
They keep executing or they break as well ?
What happens to them when I do a F10/F11 in the main thread ?
How should I proceed if I need to check which thread has changed a particular variable ?
If the debugger breaks into the process (for example via Breakpoints or "Break All"), then all threads a get suspended.
If the press F10 or F11, then a new "temporary" breakpoint is added to the next line and the process is started (resumed) again. Therefore all threads runt (for a very short time), until the breakpoint is hit.
If you need to detect how is changing a variable, you can set a "Data-Breakpoint". For a reference see What are data breakpoints?
Also take a look at the documentation: How to: Set a Data Breakpoint
Also please be aware, that you can see the list of threads by opening the "Threads"-Window (Debug|Windows|Threads)!

intellij - not stopping on all breakpoints in multithreaded code

I am trying to run the following code with break points as follows:
new Thread(new Runnable() {
#Override
public void run() {
System.out.println("Starting"); //breakpoint here
}
}).start();
int i = 10;
i++; //breakpoint here
when this code runs ONLY the i++ breakpoint is hit... If I remove that one, the other thread's breakpoint would be hit correctly. Why is this weird behaviour occuring?
This is documented in http://www.jetbrains.com/idea/webhelp/breakpoints-2.html:
There are certain cases when IntelliJ IDEA will not stop at a breakpoint. Consider the following situation:
Two breakpoints are set at the different methods of a class, and there suspend policy is set to All.
When one of the breakpoints is hit, some step actions are performed.
If at the time of stepping another thread hits the second breakpoint, IntelliJ IDEA will not stop there.
I copied your code example and recreated the situation.
Sure enough, like it says in the documentation, after stopping at the i++ breakpoint, if I hit F8 (step over) the program doesn't stop on the other breakpoint. But if I hit F9 (resume) the program does stop again on the other breakpoint.
I just had this problem and for the sake of others that run into this, here is the reason for this behavior and how to change it.
As Doron pointed out, there is documentation concerning this. However, the IMPORTANT thing to notice is that by default, all threads in the JVM are suspended when a breakpoint is reached.
What you are expecting (and what I was expecting) is that only the thread with the breakpoint is suspended.
This isn't what you want, nor is it what I wanted.
To change this behavior (and provide the desired behavior).
1) Create a breakpoint by left clicking in margin.
2) Press ctrl+shift+F8 (to bring up the breakpoint menu).
3) Select your breakpoint. You will see options for it.
4) Make sure "Suspend" is checked and "Thread" radio option is selected.
5) Click the "Make default" button.
Now, when you run, you'll see that breakpoints in different threads are hit.
Because the other thread is scheduled to run in the background, and when the OS thread scheduler decides to run it, it will run. When you do have a breakpoint in it, it will be hit.
It won't have started necessarily when you just run through the code, so the breakpoint at i++ is hit immediately.

No Thread Window Visual Studio 2010 Ultimate

Does anyone know what the problem here? There is no Thread Window in Debug menu.
I am using full VS2010 (Ultimate SP1).
The Threads window option only becomes available while actually Debugging a process.
Choose "Start Debugging", then go back to the same menu, and Threads (as well as many other options) will appear.
You need to be debugging in order to have the option show up in the menu:
I marked a thread as a duplicate of this one but the author was also looking for the Tasks window. Adding this answer to be clear that it is under the same menu option in newer versions of Visual Studio.
As per the answer, you need to be in debug mode for this option to show up.

Multithreaded debugger for Eclipse

Is there any multithreaded debugging option in Eclipse so that I can see the breakpoints of all threads when the event occurs.
If not is there any multithreaded debugging tool?
Thanks
Click on your breakpoint in the Breakpoints view, select "suspend VM" from the menu. When that's hit the whole VM will suspend, not just the thread.
About downvotes:
Before you downvote that answer, let me clarify that I was replying to a question related to Eclipse + EPIC and multi-threaded debugging. With the time they decided to rephrase the question and my answer, that was correct, got out of context! So watch out from the policies of this site!
UDPATE: Finally solved :)
I'll get back to you as soon as I get something else in this topic.
Sorry to say, currently EPIC doesn't suport multithreaded programs. It's stated in their user guide, unless there's anything new that's the official statment.
EPIC does not currently include support for debugging multi-threaded programs.
Here you have the reference
The alternative, Padre I have no experience, but you may want to give a try.
UPDATE:
I know is an older post, but is worth for any future problems. I found the way to debug perl programs with threads.
In my case,
Eclipse 3.7
EPIC Plugin 0.6.42
ActivePerl 5.14.2 Build 1402 (64bits)
We are not yet there, the ActivePerl requires a trick.
Following the instructions of this bug.
One of the comments mention to replace in Cwd.pm module the single commas with curly brackets ... more precisely
In C:\Perl64\lib\Cwd.pm
the line 758 has the following code
if (eval 'defined &DynaLoader::boot_DynaLoader') {
just replace it with the following
if (eval { defined &DynaLoader::boot_DynaLoader; }) {
In my case I can debug multithreaded perl scripts and break inside the thread even with detach.
Hope it helps, happy debugging.

Resources