This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] PR cli/21688: Fix multi-line/inline command differentiation
On Friday, June 30 2017, Pedro Alves wrote:
> On 06/29/2017 11:21 PM, Sergio Durigan Junior wrote:
>> +/* Return true if NAME is the only command between COMMAND_START and
>> + COMMAND_END. This is useful when we want to know whether the
>> + command is inline (i.e., has arguments like 'python command1') or
>> + is the start of a multi-line command block. */
>> +
>> +static bool
>> +command_name_equals_not_inline (const char *command_start,
>> + const char *command_end,
>> + const char *name)
>> +{
>> + return (command_end - command_start == strlen (name)
>> + && startswith (command_start, name));
>> +}
>
> ...
>
>> - else if (command_name_equals (cmd, "python"))
>> + else if (command_name_equals_not_inline (p_start, p_end, "python"))
>> {
>
> Does this handle command aliases? It doesn't look like it.
Hm, no, it doesn't. I guess that the best approach would be to make
sure that lookup_cmd_1 advances the **text pointer past all the
whitespace chars after it matches a command, and then we could use
Simon's idea and check for *cmd_name != '\0'.
I'll prepare a patch here and do some testings.
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/