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 2/2] gdb: Rework command completion on 'tui reg'.


On 06/02/2015 11:11 AM, Andrew Burgess wrote:
> Thanks for the review.  I've reworked the patch to address all the
> issues raised.  Here's the new version.
> 

Thanks.  Sorry for the delay, I was away last week.

This version looks fine apart from a couple details.  Go ahead
and push with these fixed.

> gdb/ChangeLog:
> 
> 	* completer.c Add arch-utils.h include.

Missing colon.


> -/* Complete on a register or reggroup.  */
> +/* Bit-flags for selecting what the register and/or register-group
> +   completer should complete on.  */
>  
> -VEC (char_ptr) *
> -reg_or_group_completer (struct cmd_list_element *ignore,
> -			const char *text, const char *word)
> +enum reg_completer_targets
> +  {
> +    complete_register_names = 0x1,
> +    complete_reggroup_names = 0x2
> +  };
> +
> +/* Complete on a register names (when WITH_REGISTERS is true) and/or
> +   reggroup names (when WITH_REGGROUPS) is true.  One, or both of
> +   WITH_REGISTERS and WITH_REGGROUPS must be true.  */

The comment is stale wrt to the bit flags.

> +
> +static VEC (char_ptr) *
> +reg_or_group_completer_1 (struct cmd_list_element *ignore,
> +			  const char *text, const char *word,
> +			  enum reg_completer_targets targets)
>  {
>    VEC (char_ptr) *result = NULL;
>    size_t len = strlen (word);
>    struct gdbarch *gdbarch;
> -  struct reggroup *group;
>    const char *name;
> -  int i;
>  
>    if (!target_has_registers)
>      return result;

Unless I'm missing something, I think you need to remove
this check, otherwise completion doesn't really work when there's
no running program yet.

>  
> -  gdbarch = get_frame_arch (get_selected_frame (NULL));
> +  gdb_assert ((targets & (complete_register_names
> +			  | complete_reggroup_names)) != 0);
> +  gdbarch = get_current_arch ();
>  

> +following groups are avaiable on most targets:

typo "available".

Thanks,
Pedro Alves


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