Re: [PATCH] call cp_lookup_symbol_namespace recursively to search symbols in C++ base classes

Tom Tromey
2010-11-02T20:31:24Z

>>>>> ">" == Liu, Lei <lei.liu2@windriver.com> writes:

>> This patch is trying to fix a bug in gdb. The problem is found in
>> following C++ test case.

Thanks.

This looks pretty reasonable overall. In order for it to go in, we
would need a couple things:

* Copyright assignment forms filed with the FSF. If you don't have this
already, one of us can get you started.

* A test case -- the one you have is fine, it just needs to be in the
form used by our test suite.

>> 2010-11-02 Lei Liu <lei.liu2@windriver.com>

>> * cp-namespace.c (cp_lookup_symbol_namespace): Recursively call
>> itself to search C++ base classes.

It isn't 100% clear to me that cp_lookup_symbol_namespace is the right
function. That file is kind of spaghetti-ish right now :(

>> + scope_sym = lookup_symbol (scope, NULL, VAR_DOMAIN, NULL);
>> + if (scope_sym == NULL)
>> + return NULL;
>> +
>> + scope_type = SYMBOL_TYPE(scope_sym);
>> + if (scope_type == NULL)
>> + return NULL;

I think lookup_typename is better here.

>> + if (TYPE_CODE (scope_type) == TYPE_CODE_STRUCT)

I think you should call check_typedef on scope_type before this check.

thanks,
Tom