namespace A { int variablex = 1; } int main (void) { int variabley = 2; using namespace A; return 0; /* break-here */ } ------------------------------------------------------------------------------- (gdb) p variablex $1 = 1 (gdb) p variabley $2 = 2 But when I type (gdb) p vari<tab> it autocompletes to: (gdb) p variabley without any trace of "variablex" being also available. I am not completely sure it is the right behavior but I believe so.
The problem is that in symtab.c:completion_list_add_name(), qualified names show up as "A::variablex" and the first test is a trivial reject of strcmp(..., ...) that matches the beginning of the symname with the beginning of the target, thereby comparing the target to the qualifier and failing. Trivial to fix by skipping past the qualifier in the symname. Two questions: 1. Should skipping the qualifier be the default behaviour? Or should doing that be some kind of option? 2. Are multiple qualifiers like "A::B::variablex" possible?
The question is whether symtab.c:completion_list_add_name looks at current import statements (using namespace A). To add support for something like that would require duplicating a lot of the code that currently does namespace lookup in completion_list_add_name. IMO the right thing to do is to modify the lookup_* functions to optionally return a list of all matching names so that the code can be reused. The same thing applies to the lookup procedure performed during overload resolution. Seems like a lot of work but it is the right thing to do.