This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] PR python/16699: GDB Python command completion with overriden complete vs. completer class
- From: Tom Tromey <tromey at redhat dot com>
- To: Sergio Durigan Junior <sergiodj at redhat dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>, Phil Muldoon <pmuldoon at redhat dot com>
- Date: Thu, 10 Apr 2014 10:27:32 -0600
- Subject: Re: [PATCH] PR python/16699: GDB Python command completion with overriden complete vs. completer class
- Authentication-results: sourceware.org; auth=none
- References: <m3iorj3ud8 dot fsf at redhat dot com>
>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:
Sergio> This PR came from a Red Hat bug that was filed recently. I checked and
Sergio> it still exists on HEAD, so here's a proposed fix. Although this is
Sergio> marked as a Python backend bug, this is really about the completion
Sergio> mechanism used by GDB. Since this code reminds me of my first attempt
Sergio> to make a good noodle, it took me quite some time to fix it in a
Sergio> non-intrusive way.
Thanks, Sergio.
Sergio> +/* Python function called to determine the break characters of a
Sergio> + certain completer. We use dummy variables for the "text" and
Sergio> + "word" arguments for the completer, and call it. We're actually
Sergio> + only interested in knowing if the completer registered by the user
Sergio> + will return one of the integer codes (see COMPLETER_* symbols). */
Sergio> +
Sergio> +static void
Sergio> +cmdpy_completer_handle_brkchars (struct cmd_list_element *command)
Sergio> +{
IIUC this is calling the command's complete method with some dummy strings
to see what it will do.
I don't think this approach will work since in general the reason to
write a complete method is to be able to adapt to different arguments.
That is, there's no reason to expect that passing dummy arguments will
yield the same result.
I didn't look deeply into the problem but is there a way to "reparse"
the text when the complete method returns one of the enum values?
Tom