Hi Ulrich, On Thursday 14 August 2008 21:39:59, Ulrich Weigand wrote: > It seems to me that this implementation detail should not determine > user-visible behaviour in the way described above. Therefore, I'd suggest > to try to *always* prefer reporting events in the thread the user currently > "cares about" Agreed in principle, although that may create contention. But as you say, if the user is stepping a thread, your proposal seems less surprising. > -- this is actually simply the currently selected thread > (i.e. the current value of inferior_ptid). Disagreed. inferior_ptid will change if an event happens in another thread while you're stepping, but the core decides the event was not a good reason to stop. E.g., thread hopping. So, resetting the prefered thread here: > (linux_nat_resume): Set lp->preferred. .. is fallible. > The patch below implements this by adding a new member "preferred" to > "struct lwp_info", setting it according to the value of inferior_ptid > in linux_nat_resume, and using it (instead of the single-step flag) to > decide whether to prefer reporting events in this thread. I'd prefer to check if an lwp is stepping due to user request, by checking struct thread_info's data directly, intead of your "prefered" flag. We already have all the needed data in struct thread_info, although, because of context-switching, if the lwp matches inferior_ptid, you have to check the stepping state in the global vars; if it doesn't match inferior_ptid (which again, is not garanteed to be the last thread the user had selected), you get the stepping data directly from the thread_info list. I happen to be just preparing to submit the series that gets rid of context-switching, which gets rid of that special case. Unfortunatelly, currently, GDB doesn't always correctly clear the stepping state of all threads when proceeding (clear_proceed_status only clears the current thread), but I'm addressing that too in the series, see attached. Maybe the attached could be rebased against pristine head, and you could use it, although I would prefer to put the whole series in. For my series to go in, every target much register at least the main thread in GDB's thread tables, and as it happens, I think AIX is the only target I don't have covered, or that I know of no one covering. -- Pedro Alves