vscode icon indicating copy to clipboard operation
vscode copied to clipboard

VsCode doesn't indicate the "currently debugged thread" when multilple threads are stopped during debugging.

Open delmyers opened this issue 10 years ago • 11 comments

  • 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:

  1. 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);
}
  1. Set two breakpoints in the lines with comments "//set a breakpoint here"
  2. press F5 3~5 times
  3. 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.

delmyers avatar Mar 21 '16 17:03 delmyers

@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.

delmyers avatar Mar 21 '16 18:03 delmyers

PRs are always welcome! If not, I can also look into it for our April release.

isidorn avatar Mar 23 '16 07:03 isidorn

@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?

screen shot 2016-03-31 at 12 05 01

isidorn avatar Mar 31 '16 10:03 isidorn

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 avatar Apr 04 '16 22:04 delmyers

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 avatar Apr 05 '16 20:04 delmyers

@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 avatar Apr 05 '16 20:04 isidorn

@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 avatar Apr 08 '16 20:04 delmyers

@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?

isidorn avatar Apr 21 '16 08:04 isidorn

We are tracking issues for the C++ extension here: https://github.com/Microsoft/vscppsamples/issues

edumunoz avatar Apr 21 '16 19:04 edumunoz

@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 avatar Apr 29 '16 13:04 isidorn

@isidorn If it's duplicate just tag it as that

jrieken avatar Apr 29 '16 13:04 jrieken