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/3] new observer command_param_changed.


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

Yao> +static struct cmd_list_element *
Yao> +lookup_cmd_for_prefixlist (struct cmd_list_element **key,
Yao> +			   struct cmd_list_element *list)

It seems to me that this function relies on add_prefix_cmd being invoked
before any of the sub-commands are added.

But, I think this is not guaranteed by gdb's order-agnostic
initialization approach.  This, IIUC, is why the prefix list variables
are global rather than being stored in the prefix command itself.

If that is correct, then I think a different approach is needed.

Yao> +  if (notify_command_param_changed_p (option_changed, c))
Yao>      {
Yao> +      char name[64];

It is better not to have a statically-sized buffer.
This can easily be overrun by making new parameters from Python.

Yao> +	/* Assume that the number of command option is less than 6.  */
Yao> +	struct cmd_list_element *cmds[6];

Likewise.


The rest looks good.  Thanks for changing it to report all options.

Tom


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