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 1/6] new observer command_option_changed.


>>>>> "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


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