From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8127 invoked by alias); 23 Oct 2015 15:30:25 -0000 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 Received: (qmail 8112 invoked by uid 89); 23 Oct 2015 15:30:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f47.google.com Received: from mail-pa0-f47.google.com (HELO mail-pa0-f47.google.com) (209.85.220.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 23 Oct 2015 15:30:23 +0000 Received: by pasz6 with SMTP id z6so121135671pas.2 for ; Fri, 23 Oct 2015 08:30:21 -0700 (PDT) X-Received: by 10.66.90.165 with SMTP id bx5mr5507611pab.87.1445614221835; Fri, 23 Oct 2015 08:30:21 -0700 (PDT) Received: from E107787-LIN (gcc2-power8.osuosl.org. [140.211.9.43]) by smtp.gmail.com with ESMTPSA id fb1sm19631395pab.9.2015.10.23.08.30.18 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 23 Oct 2015 08:30:21 -0700 (PDT) From: Yao Qi To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 02/18] Remote all-stop-on-top-of-non-stop References: <1444836486-25679-1-git-send-email-palves@redhat.com> <1444836486-25679-3-git-send-email-palves@redhat.com> Date: Sat, 24 Oct 2015 22:39:00 -0000 In-Reply-To: <1444836486-25679-3-git-send-email-palves@redhat.com> (Pedro Alves's message of "Wed, 14 Oct 2015 16:27:50 +0100") Message-ID: <86vb9x1u2h.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg00503.txt.bz2 Pedro Alves writes: > @@ -2636,8 +2633,37 @@ attach_command_post_wait (char *args, int from_tty= , int async_exec) > target_post_attach (ptid_get_pid (inferior_ptid)); >=20=20 > post_create_inferior (¤t_target, from_tty); > +} > + > +/* What to do after the first program stops after attaching. */ > +enum attach_post_wait_mode > +{ > + /* Do nothing. Leaves threads as they are. */ > + ATTACH_POST_WAIT_NOTHING, > + > + /* Re-resume threads that are marked running. */ > + ATTACH_POST_WAIT_RESUME, > + > + /* Stop all threads. */ > + ATTACH_POST_WAIT_STOP, > +}; > + > +/* Called after we've attached to a process and we've seen it stop for > + the first time. If ASYNC_EXEC is true, re-resume threads that > + should be running. Else if ATTACH, */ > + Comments are not complete. > + > + /* Now go over all threads that are stopped, and print their current > + frame. If all-stop, then if there's a signalled thread, pick > + that as current. */ Is it the code you described in the last paragraph of the commit log? > + ALL_NON_EXITED_THREADS (thread) > + { > + struct target_waitstatus *ws; > + > + if (first =3D=3D NULL) > + first =3D thread; > + > + if (!non_stop) > + set_running (thread->ptid, 0); > + else if (thread->state !=3D THREAD_STOPPED) > + continue; > + > + ws =3D &thread->suspend.waitstatus; > + > + if (selected =3D=3D NULL > + && thread->suspend.waitstatus_pending_p) > + selected =3D thread; > + > + if (lowest =3D=3D NULL || thread->num < lowest->num) > + lowest =3D thread; > + > + if (non_stop) > + print_one_stopped_thread (thread); > + } > + > + /* In all-stop, we only print the status of one thread, and leave > + others with their status pending. */ > + if (!non_stop) > + { > + thread =3D selected; > + if (thread =3D=3D NULL) > + thread =3D lowest; > + if (thread =3D=3D NULL) > + thread =3D first; Looks lowest can't be NULL, so first isn't used. > + > + print_one_stopped_thread (thread); > + } > + > + /* For "info program". */ > + thread =3D inferior_thread (); > + if (thread->state =3D=3D THREAD_STOPPED) > + set_last_target_status (inferior_ptid, thread->suspend.waitstatus); > } >=20=20 > static void > @@ -3826,7 +3942,7 @@ remote_start_remote (int from_tty, struct target_op= s *target, int extended_p) > @@ -12936,11 +13040,15 @@ remote_async (struct target_ops *ops, int enabl= e) > event loop to process them. */ > if (!QUEUE_is_empty (stop_reply_p, stop_reply_queue)) > mark_async_event_handler (remote_async_inferior_event_token); > + if (target_is_non_stop_p ()) > + mark_async_event_handler (rs->notif_state->get_pending_events_token); I don't understand why do we need to mark the pending event token. Previously, we only need to do so when GDB sees a notification. > } > else > { > serial_async (rs->remote_desc, NULL, NULL); > clear_async_event_handler (remote_async_inferior_event_token); > + if (target_is_non_stop_p ()) > + clear_async_event_handler (rs->notif_state->get_pending_events_token); > } > } >=20=20 --=20 Yao (=E9=BD=90=E5=B0=A7)