From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28011 invoked by alias); 25 Jun 2008 20:03:49 -0000 Received: (qmail 27999 invoked by uid 22791); 25 Jun 2008 20:03:48 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 25 Jun 2008 20:03:30 +0000 Received: (qmail 17080 invoked from network); 25 Jun 2008 20:03:28 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 25 Jun 2008 20:03:28 -0000 From: Pedro Alves To: Daniel Jacobowitz Subject: Re: [non-stop] 07/10 non-stop inferior control Date: Wed, 25 Jun 2008 20:20:00 -0000 User-Agent: KMail/1.9.9 Cc: gdb-patches@sourceware.org References: <200806152205.16824.pedro@codesourcery.com> <20080625194409.GF25575@caradoc.them.org> In-Reply-To: <20080625194409.GF25575@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200806252103.26988.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-06/txt/msg00452.txt.bz2 A Wednesday 25 June 2008 20:44:09, Daniel Jacobowitz wrote: > On Sun, Jun 15, 2008 at 10:05:16PM +0100, Pedro Alves wrote: > > It is also needed to have support to interrupt/suspend a simple > > thread so a new target_stop_ptid method was added to request > > the target to interrupt a single thread. > > How about adding a ptid argument to to_stop instead? I think the code > will be shared in most cases. > Sure, I'll do that. It was a way to not have to update all targets before review. :-) > > @@ -1810,11 +1847,16 @@ handle_inferior_event (struct execution_ > > && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED && > > ecs->new_thread_event) add_thread (ecs->ptid); > > > > - /* Mark all threads as not-executing. In non-stop, this should be > > - adjusted to only mark ecs->ptid. */ > > - if (ecs->ws.kind != TARGET_WAITKIND_IGNORE > > - && stop_soon != STOP_QUIETLY) > > - set_executing (pid_to_ptid (-1), 0); > > + if (ecs->ws.kind != TARGET_WAITKIND_IGNORE) > > + { > > + /* Mark the stopped threads accordingly. */ > > + if (!non_stop > > + || ecs->ws.kind == TARGET_WAITKIND_EXITED > > + || ecs->ws.kind == TARGET_WAITKIND_SIGNALLED) > > + set_executing (pid_to_ptid (-1), 0); > > + else > > + set_executing (ecs->ptid, 0); > > + } > > > > switch (ecs->ws.kind) > > { > > Are we going to miss the stop_soon check here? Indeed, I'll recheck carefully. It used to be needed, and the symptom was a nice internal_error. It isn't happening, which probably means I either fixed the real issue, or I missed something. :-) > > > - switch_to_thread (tp->ptid); > > + if (non_stop) > > + context_switch_to (tp->ptid); > > + else > > + switch_to_thread (tp->ptid); > > + > > Ow ow my head, I really wish we didn't need both of these. We'll > never keep track of which is which. Easy, It's always both, except when it's a temporary switch to another thread and back. :-) > Will we eventually be able to merge them? Oh, yeah. context_switch(_to) is a dying species. I'm working on getting rid of it. Then we'll only have switch_to_thread (which should go to, if/when we switch to have a frame cache per thread). stop_pc (the other job of switch_to_thread) isn't doing its job in some cases either, and we could remove it. Say: (sets stop_pc) p $pc = xxx thread 2 (sets stop_pc) thread 1 (sets stop_pc, but it's no longer the original...) We can switch to always using read_pc() (or equivalent). I have all-stop mode / linux mostly covered, now I'm making sure remote always has a thread, monitor targets will be easy, and win32-nat.c is also taken care of. Will need to convert non-stop too, but that'll take a bit. I prefer that this series goes in first, otherwise, we'll never get this done. Baby steps, please. :-) > > > - add_prefix_cmd ("thread", class_run, thread_command, _("\ > > + c = add_prefix_cmd ("thread", class_run, thread_command, _("\ > > Use this command to switch between threads.\n\ > > The new thread ID must be currently known."), > > &thread_cmd_list, "thread ", 1, &cmdlist); > > Indentation on that last line. > > Otherwise OK. Thanks a bunch. I'll get back once I resolve the issues you mentioned. -- Pedro Alves