Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [RCF 0/4] A general notification in GDB RSP
Date: Fri, 24 Aug 2012 02:26:00 -0000	[thread overview]
Message-ID: <1345775139-13576-1-git-send-email-yao@codesourcery.com> (raw)

Hi,
We have more and more requirements that remote target wants to notify
GDB via RSP at any time during connection when some states are changed
in remote target.  However, GDB doesn't have such general notification
infrastructure.  This is what this patch set tries to add.

Nowadays, notification mechanism exists in GDB for '%Stop' only,
and works pretty good.  My rationale of this work is 'decouple
%Stop/vStopped from existing notification mechanism so that
notification mechanism can handle other types of notification.

First of all, let us look at how '%Stop' and 'vStopped' works,

    gdb           gdbserver
        <- %Stop         // [1] Send notification
       [after process other packets]
        -> vStopped      // [2] Ack this notification
        <- T05 thread:2  // [3] Reply
        -> vStopped      // [4] Continue to query
        <- OK            // [5] Done

We can generalize this protocol like this,

    gdb           gdbserver
        <- %NOTIF         // [1] Send notification
       [after process other packets]
        -> vACK           // [2] Ack this notification
        <- REPLY          // [3] Reply
        -> vACK           // [4] Continue to query
        <- OK             // [5] Done

For each type of notification, we only have to define three things,

   1) NOTIF, the key word of notification, for example, "Stop"
   2) ACK, the command GDB ack to this notification, "vStopped" for
example,
   3) REPLY, the format of reply to GDB.  GDBserver should be able to
send packet to comply with REPLY, and GDB is able parse the packet,
and identify the packet is REPLY or not.

Patch 1/4 is to create a general queue data structure which will not
only be used in patch 2/4 and 3/4, but also can be used in elsewhere
in GDB.
The patch 2/4 and 3/4 are to decouple %Stop and vStopped out of
existing notification, in order to make notification more general.
Patch 4/4 is to demonstrate how do we add a new type of notification
in the future, and test two types of notification work good
together.  As you can see, it is relatively simple.  Originally, I
intended to convert qTstatus to a new type of notification in patch
4/4 as an example (when tracing status is changed, GDBserver sends
notification), but it takes time to think about it, so I post this
version here to get feedbacks first.

All three patches are tested on x86_64-linux {native, gdbserver} x
{sync, async}.  No regression.

Note that the behaviour of notification in RSP is unchanged, that is
to say, patched GDB (w/ patch 2/4) works well with unpatched
GDBserver, and patched GDBserver (w/ patch 3/4) works well with
unpatched GDB.

it is different from Hui's patch 3/9 in 'autload breakpoint'
patch series,

  [RFC] Autoload-breakpoints new version [3/9] notification async
  http://sourceware.org/ml/gdb-patches/2012-08/msg00214.html

His patch is to teach GDB to handle notification at anytime, while
mine is not, but to allow to add other types of notification similar
to existing %Stop/vStopped on the same infrastructure.


             reply	other threads:[~2012-08-24  2:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-24  2:26 Yao Qi [this message]
2012-08-24  2:26 ` [PATCH 4/4] new notification "TEST" Yao Qi
2012-08-24  2:26 ` [PATCH 1/4] new gdb_queue.h in common/ Yao Qi
2012-08-24 18:44   ` dje
2012-08-24 18:49     ` Doug Evans
2012-08-29  9:42     ` Yao Qi
2012-09-04 21:03       ` dje
2012-09-07  2:47         ` Yao Qi
2012-09-10 20:47           ` dje
2012-09-12 14:24             ` Yao Qi
2012-09-13 15:55               ` dje
2012-09-14  2:38                 ` Yao Qi
2012-09-11 16:50         ` Tom Tromey
2012-08-24  2:26 ` [PATCH 3/4] de-couple %Stop from notification: gdbserver Yao Qi
2012-08-24  2:26 ` [PATCH 2/4] de-couple %Stop from notification: gdb Yao Qi
2012-08-24 16:52   ` Yao Qi
2012-08-24 19:00   ` dje
2012-08-30  6:40     ` Yao Qi
2012-08-24 17:53 ` [RCF 0/4] A general notification in GDB RSP Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1345775139-13576-1-git-send-email-yao@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox