This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/2] gdb: Rework command completion on 'tui reg'.
- From: Pedro Alves <palves at redhat dot com>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>, gdb-patches at sourceware dot org
- Date: Tue, 09 Jun 2015 17:45:02 +0100
- Subject: Re: [PATCH 2/2] gdb: Rework command completion on 'tui reg'.
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1432246159 dot git dot andrew dot burgess at embecosm dot com> <58e17eaffc56924038a839aa42e00a96dc1832b5 dot 1432246159 dot git dot andrew dot burgess at embecosm dot com> <55607DF7 dot 8040601 at redhat dot com> <20150602101111 dot GO17330 at embecosm dot com>
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