Community
Participate
Working Groups
Build Identifier: 20100917-0705 While debugging with gdb in non-stop mode, when a thread event is sent by gdb ([New Thread], [Thread exited], ...) the focus on the current thread is lost in the 'Debug view' (threads list window). It prevents users to do stepping (step into, step over, ...) in progams creating/closing threads very often. Reproducible: Always Steps to Reproduce: 1. to reproduce set a breakpoint in 'while (1)' loop of the main() function in the program below 2. when a thread event is sent by gdb the focus is lost on the main thread and it is not possible to execute one more step of the program's main thread by hitting step into (F5), step over (F6) #include <stdlib.h> #include <pthread.h> #include <unistd.h> #include <time.h> void * run2(void *ptr) { int *i = (int *)ptr; struct timespec sleepTime; struct timespec remainingSleepTime; sleepTime.tv_sec = *i + 5; sleepTime.tv_nsec = 0; nanosleep(&sleepTime, &remainingSleepTime); return NULL; } void * run1(void *ptr) { while (1) { const int nb = 2; pthread_t thread[nb] = { 0 }; for (int i = 0; i < nb; ++i) { pthread_create(&thread[i], NULL, run2, &i); } for (int i = 0; i < nb; ++i) { pthread_join(thread[i], NULL); } } return NULL; } void f1() { int i = 0; while (i < 5) { ++i; } } int main() { pthread_t thread = 0; pthread_create(&thread, NULL, run1, NULL); while (1) { f1(); } pthread_join(thread, NULL); exit(0); } I tried to debug cdt code but I was not able to understand the link between the thread event handling code (MIListThreadGroups.java, MIListThreadGroupsInfo.java, GDBProcesses_7_0.java, ...) and the 'Debug view' focus update.
Created attachment 186691 [details] test case
It's not just a nuisance in non-stop mode. It also happens in all-stop mode if hovering over expressions like "it->second" which makes gdb resume its inferior in -data-evaluate-expression.
I pushed a proposal to to gerrit: https://git.eclipse.org/r/#/c/8114/