Re: RFA: implement ambiguous linespec proposal

Doug Evans
2011-11-16T04:57:41Z

On Mon, Nov 14, 2011 at 1:10 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
>
> Tom> Here is a refresh of this patch.  This fixes the regressions noted by
> Tom> Jan, but also changes ovsrch.exp not to assume that namespace lookups
> Tom> are done.
>
> Here is the final revision.

While your patch didn't introduce the this, I'm wondering if you have
thoughts on this.

Single vs double quote handling in linespecs is, umm, odd.
[It's probably seems odder than it really is due to poor naming,
"quote" is just too ambiguous. At some point I'd like to enforce
"squote" and "dquote" instead of just "quote" when only one is meant.
:-)]

E.g.,

decode_line_internal has this:

is_quoted = (strchr (get_gdb_completer_quote_characters (),
**argptr) != NULL);

if (is_quoted) //xxx quoted? what kind of quoted?
{
end_quote = skip_quoted (*argptr);
if (*end_quote == '\0')
is_squote_enclosed = 1; //xxx
}

xxx: We're hardcoding knowledge that
get_gdb_completer_quote_characters (emphasis on the plural!) is
actually just the single quote '.

linespec.c:symtabs_from_filename has this:

/* It may have the ending quote right after the file name. */
if ((is_quote_enclosed && copy[p - *argptr - 1] == '"')
|| copy[p - *argptr - 1] == '\'')
copy[p - *argptr - 1] = 0;

Why is ' and " treated differently?
[I realize the comment for gdb_completer_quote_characters says why
*it* doesn't include dquote("), but I'd rather not use it if it makes
for clearer code.]