Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Yao Qi <yao@codesourcery.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH 1/6] new observer command_option_changed.
Date: Fri, 27 Jul 2012 17:56:00 -0000	[thread overview]
Message-ID: <87sjcday1q.fsf@fleche.redhat.com> (raw)
In-Reply-To: <1343402543-665-2-git-send-email-yao@codesourcery.com> (Yao Qi's	message of "Fri, 27 Jul 2012 23:22:18 +0800")

>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:

Yao>   1.  Move notifying 'command_option_changed' observer out of
Yao> do_setshow_command to its caller, execute_command, so that we can
Yao> get the full command line to send MI notification for multi-word
Yao> options.

Yao> +	  if (do_set_command (arg, from_tty, c) && c->notify_observer_p)
Yao> +	    {
Yao> +	      /* Skip 'set ' */
Yao> +	      int len = arg - orig - 4;
Yao> +	      char *option = xmalloc (len);
Yao> +
Yao> +	      memcpy (option, orig + 4, len - 1);
Yao> +	      option[len - 1] = 0;
Yao> +
Yao> +	      observer_notify_command_option_changed (option, arg);

What happens here if the user enters an abbreviation for the command?
For example, "set print ele 5" works fine -- but the observer should
still see "print elements" as the argument name.  I think the code above
will do the wrong thing.

do_set_command doesn't always just use the plain value of ARG to set the
parameter.  So, passing that to the observer can sometimes result in the
client being out of sync.  For example, tilde expansion won't be seen.

Likewise, I wonder about "maint" commands like "maint set profile".
Perhaps these could be automatically excluded; maybe based on
class_maintenance?

Tom


  reply	other threads:[~2012-07-27 17:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-27 15:23 [RCF 0/6 V2] MI notification of command option change Yao Qi
2012-07-27 15:23 ` [PATCH 3/6] notify in enum_cmd and scheduler-locking Yao Qi
2012-07-27 15:23 ` [PATCH 6/6] code indentation Yao Qi
2012-07-27 15:23 ` [PATCH 2/6] attach to command_option-changed observer Yao Qi
2012-07-27 17:20   ` Tom Tromey
2012-07-27 17:44   ` Tom Tromey
2012-07-27 15:23 ` [PATCH 5/6] notify in string_cmd and trace-notes Yao Qi
2012-07-27 15:23 ` [PATCH 4/6] notify in boolean_cmd and circular-trace-buffer Yao Qi
2012-07-27 15:23 ` [PATCH 1/6] new observer command_option_changed Yao Qi
2012-07-27 17:56   ` Tom Tromey [this message]
2012-07-27 17:07 ` [RCF 0/6 V2] MI notification of command option change Tom Tromey
  -- strict thread matches above, loose matches on Subject: below --
2012-07-24 16:11 [RFC 0/6] " Yao Qi
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
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

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=87sjcday1q.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.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