Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Cc: Tom Tromey <tromey@redhat.com>
Subject: Re: [PATCH 1/6] new observer command_option_changed.
Date: Wed, 25 Jul 2012 03:56:00 -0000	[thread overview]
Message-ID: <1452365.122ECxjKta@qiyao.dyndns.org> (raw)
In-Reply-To: <87394gopwj.fsf@fleche.redhat.com>

On Tuesday, July 24, 2012 02:38:52 PM Tom Tromey wrote:
> >>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:

Hi, Tom,
Thanks for the quick review.

> Yao> This patch is to add an extra field 'notify_observer_p' to identify
> Yao> the command will notify observer 'command_option_changed', and teach
> Yao> GDB to check the change of command option, and notify observer.
> 
> I read through the series to find out why this was needed.
> My understanding is that the idea is that options will be segregated
> into two kinds: those which report via the observer, and others; and
> that the decision is made in the gdb sources.
> 
> If that is accurate, I wonder if you could explain the rationale for it.
> Another possible design would be to report all option changes; or to let
> the MI client choose.

The general goal of my work is that "when the internal state of GDB is 
changed, and MI frontend and/or telnet session is not aware of the change, 
notify them to keep their display up to date".  For example, when user types 
command 'set $fp=0x1' in console, GDB should emit a MI notification to 
Eclipse, so that Eclipse can update its "register view" to show the latest 
value of $fp.  When user changes the option "set scheduler-locking step", and 
this change is interesting to Eclipse, GDB should emit a MI notification as 
well.

Not all the changes of GDB state are interesting to MI frontend.  As a subset 
of GDB state changes (other patch series in the future address other GDB state 
changes), not all the command option changes are interesting to MI frontend 
either, so it is not necessary to report all option changes.

> 
> The reason I ask is that making the decision statically seems tricky.
> When adding an option, what criteria do we use to decide?  How do we
> know what MI users want?  Or what if we want to add a Python hook

The criteria is "if Eclipse or other MI frontend needs to know the change of 
this command option, then we should report notification".  IMO, MI user should 
tell us what they want, and we can convert these commands from non-reporting 
to reporting.  Here is a list of commands that Marc Khouzam and I discussed 
offline, and we think they should be switched to reporting.  Note that this is 
not a full list, we may have other commands if needed.

   set circular-trace-buffer
   set disconnected-tracing
   set exec-direction
   set observer
   set may-insert-breakpoints (and the other may-*)
   set record
   set scheduler-locking
   set trace-notes (and other trace-*)
   set auto-solib-add

What do you mean by "add a Python hook"?  Is it something like "using an 
instance of gdb.Command to implement a new GDB CLI command"?  I know few on 
gdb python, but we may add extra parameter NOTIFY in 'Command.__init__', and 
notify command_option_changed observer somewhere.

> here -- maybe we would switch many more options over; but does switching
> an option from non-reporting to reporting cause issues for existing MI
> clients?  (I assume there is at least a bandwidth concern...)

AFAICS, the new MI notification "=option-changed" should not cause issues for 
existing MI clients.  In terms of bandwidth, every "=option-changed" is sent 
once user types command in console, user can't enter many commands at one 
moment (one command per second and ten commands at most, I think).  This 
notification should not occupy much bandwidth.

> What happens in the case where an option has a validation function that
> fails?  IIRC gdb has an internal design flaw here.
> 

If I understand you correctly, "validation function" means cli/cli-
setshow.c:parse_binary_operation and cli/cli-
setshow.c:parse_auto_binary_operation.  When validation fails, an error is 
thrown out, and observer is not called.

-- 
Yao (齐尧)


  reply	other threads:[~2012-07-25  3:56 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-24 16:11 [RFC 0/6] MI notification of command option change Yao Qi
2012-07-24 16:11 ` [PATCH 2/6] allow to suppress more mi notification Yao Qi
2012-07-24 20:40   ` Tom Tromey
2012-07-26 15:30   ` Pedro Alves
2012-07-27  2:57     ` Yao Qi
2012-07-27 13:27       ` Pedro Alves
2012-07-24 16:11 ` [PATCH 4/6] new add_setshow_enum_cmd_with_notif and scheduler-locking Yao Qi
2012-07-24 20:50   ` Tom Tromey
2012-07-26 15:41     ` Pedro Alves
2012-07-24 16:11 ` [PATCH 3/6] attach to command_option-changed observer Yao Qi
2012-07-24 17:10   ` Eli Zaretskii
2012-07-24 20:47   ` Tom Tromey
2012-07-26 12:47     ` Yao Qi
2012-07-26 13:59       ` Tom Tromey
2012-07-26 15:31   ` Pedro Alves
2012-07-24 16:11 ` [PATCH 6/6] new add_setshow_string_cmd_with_notif and trace-notes Yao Qi
2012-07-24 20:54   ` Tom Tromey
2012-07-24 16:11 ` [PATCH 1/6] new observer command_option_changed Yao Qi
2012-07-24 20:39   ` Tom Tromey
2012-07-25  3:56     ` Yao Qi [this message]
2012-07-25 14:44       ` Tom Tromey
2012-07-26 15:21         ` Pedro Alves
2012-07-25 14:32   ` Tom Tromey
2012-07-26  8:55     ` Yao Qi
2012-07-24 16:12 ` [PATCH 5/6] new add_setshow_boolean_cmd_with_notify and circular-trace-buffer Yao Qi
2012-07-24 20:53   ` Tom Tromey
2012-07-27 15:23 [RCF 0/6 V2] MI notification of command option change Yao Qi
2012-07-27 15:23 ` [PATCH 1/6] new observer command_option_changed Yao Qi
2012-07-27 17:56   ` Tom Tromey

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=1452365.122ECxjKta@qiyao.dyndns.org \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /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