This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] infrun: don't resume the inferior when we notice a new thread (new_thread_event).


On 05/28/2012 10:19 PM, Jan Kratochvil wrote:

> On Mon, 28 May 2012 22:46:23 +0200, Pedro Alves wrote:
>> If anyone as any idea why things are done in the current way, please
>> speak up.
> 
> Not much, just that linux-nat.c linux_handle_extended_wait has this code by
> you:
>           if (non_stop)
>             {
>               /* Add the new thread to GDB's lists as soon as possible
>                  so that:
>               if (!thread_db_attach_lwp (new_lp->ptid))
>                 {
>                   /* We're not using thread_db.  Add it to GDB's
>                      list.  */
>                   target_post_attach (GET_LWP (new_lp->ptid));
>                   add_thread (new_lp->ptid);
>                 }
> 


Yeah, I've mentioned before that I have second thoughts on that bit.
If the inferior spawns short-lived threads rapidly, doing this for all threads,
as opposed to refreshing the list on demand or when presenting a stop to user,
for example, slows down the debug, and generates a bunch of frontend refreshing
that is likely useless.

> And for !non_stop mode add_thread gets delayed till handle_inferior_event;
> which should not hurt.  If this add would be done unconditionally in
> linux-nat.c then this handle_inferior_event would never be reached.


Yeah, on GNU/Linux.  But it could in principle still be reached on
other targets.  I haven't audited all.

> But I do not see why to make that change, handle_inferior_event works.

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]