VsCode doesn't indicate the "currently debugged thread" when multilple threads are stopped during debugging.
- VSCode Version: 0.10.12-alpha
- OS Version: Ubuntu 14.04
- Debugging using Microsoft cpp debugger, but will happen in any "stop-all" style debugger.
Steps to Reproduce:
- Compile following C++ code
#include <iostream>
#include <cstdlib>
#include <pthread.h>
using namespace std;
#define NUM_THREADS 5
void *PrintHello(void *threadid)
long tid;
tid = (long)threadid; //set a breakpoint here
cout << "Hello World! Thread ID, " << tid << endl;
pthread_exit(NULL);
}
int main()
{
pthread_t threads[NUM_THREADS];
int rc;
int i;
for (i = 0; i < NUM_THREADS; i++) { //set a breakpoint here
cout << "main() : creating thread, " << i << endl;
rc = pthread_create(&threads[i], NULL,
PrintHello, (void *)i);
if (rc) {
cout << "Error:unable to create thread," << rc << endl;
exit(-1);
}
}
pthread_exit(NULL);
}
- Set two breakpoints in the lines with comments "//set a breakpoint here"
- press F5 3~5 times
- Notice, that if a breakpoint or step causes the threads to switch, the UI does not indicate which thread is currently stepping. Multiple callstacks may be displayed, which can be confusing.
@edumunoz @jacdavis @jrieken @weinand
We on the cpp debugger might be able to contribute a fix for this. It isn't an immediate necessity for us, but it is a little confusing for the user.
PRs are always welcome! If not, I can also look into it for our April release.
@delmyers if I understand correctly, you would like some more UI affordance to show the user which thread is currently stopped. If there are multiple threads, instead of showing 'Paused on breakpoint' we could say 'Breakpoint Thread {name}'. Or you had something else in mind?
Would you like to make a contribution for this or should we look into this?

Having something that says "Thread {name}" might work. Another option would be to have an arrow or special highlighting that indicates the current thread. Also, to auto expand the thread that is currently being debugged (e.g. the last one paused).
Sorry, @isidorn, I forgot to mention you in the last comment I added. Having something that says "Thread {name}" might work. Another option would be to have an arrow or special highlighting that indicates the current thread. Also, to auto expand the thread that is currently being debugged (e.g. the last one paused).
@delmyers you do not have to mention, I am always subscribed to issues I am interested in and I get notificatinos even if you do not mention me.
@isidorn Looking back over the comments, this isn't really about what thread is "currently stopped". This is about which thread is "currently being debugged." For example, you just hit a breakpoint on a particular thread, and are looking at the breakpoint, then the callstack should show you what thread the breakpoint was hit on. Or, you double-click on another callstack to go to source code, the callstack should show you the thread that you last double-clicked on. Does that make sense?
@delmyers now on every call stack changed we are expending the debugged thread and selecting the debugged stack frame in the call stack tree. Please try it out and let us know what you think.
On a side note, if I want to file a bug against a C++ extension I did not find a git hub repo but a mail address. Is that the process for filing bugs right now?
We are tracking issues for the C++ extension here: https://github.com/Microsoft/vscppsamples/issues
@jrieken you also filed a bug that the thread is not expanded on stoped. So giving to you to verify this, since it is in the end the same issue
@isidorn If it's duplicate just tag it as that