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] PR python/16699: GDB Python command completion with overriden complete vs. completer class


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


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