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 5/7] Handle notification for all-stop.


On 10/23/2012 12:26 PM, Yao Qi wrote:

> In all-stop mode, notification packet will be parsed/handled in
> 'remote_wait_as', 

AFAICS, handle_notification is called from both getpkt_or_notif_sane_1
and putpkt_binary.  Please explain _why_ we need to change
remote_wait_as.

> so we define that all notifications have a prefix 'N'.  

Hmm.  I don't follow.  How does "define that all notifications have
a prefix 'N'" follow from notifications being parsed by
remote_wait_as?  What's the real rationale for forcing an 'N' prefix?
We have "Stop" today, which doesn't start with N, and also
notifications are defined to start with '%'.  So what's with this 'N'?

> We parse rsp packet, and enqueue notification if it
> is found.  These queued notifications will be processed before
> resuming inferior (in remote_resume).

> 
> gdb:
> 
> 2012-10-23  Yao Qi  <yao@codesourcery.com>
> 
> 	* remote.c (remote_wait_as): Call 'getpkt_or_notif_sane' instead
> 	of 'getpkt_sane'.
> 	Call 'handle_notification'.
> ---
>  gdb/remote.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/gdb/remote.c b/gdb/remote.c
> index a72b364..7e9b373 100644
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -5708,7 +5708,7 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options)
>  	 _never_ wait for ever -> test on target_is_async_p().
>  	 However, before we do that we need to ensure that the caller
>  	 knows how to take the target into/out of async mode.  */
> -      ret = getpkt_sane (&rs->buf, &rs->buf_size, wait_forever_enabled_p);
> +      ret = getpkt_or_notif_sane (&rs->buf, &rs->buf_size, wait_forever_enabled_p);
>        if (!target_is_async_p ())
>  	signal (SIGINT, ofunc);
>      }
> @@ -5754,6 +5754,11 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options)
>        rs->waiting_for_stop_reply = 1;
>  
>        break;
> +    case 'N':
> +      handle_notification (rs->buf);
> +      /* The target didn't really stop; keep waiting.  */
> +      rs->waiting_for_stop_reply = 1;
> +      break;
>      case '\0':
>        if (last_sent_signal != GDB_SIGNAL_0)
>  	{
> 


-- 
Pedro Alves


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