[Dwarf-Discuss] name lookup w/ using directives
Jason Merrill
jason@redhat.com
Wed Aug 20 16:31:18 GMT 2008
Kendrick Wong wrote:
> If a debugger use the same name lookup technique as in scenario A, it's
> going to find A::B::a, which is incorrect.
Yes, so the debugger needs to be smarter about C++ name lookup, and use
the same rules as the compiler: namely, an imported namespace isn't
searched until we search the common enclosing namespace of the imported
namespace and the current context.
In the first example, we look first in the DW_TAG_subprogram, and don't
find an 'a'. So we look in namespace C, and don't find an 'a'. So we
look in namespace A, and don't find an 'a'. Then we look in namespace
B, and find A::B::a.
In the second example, we look in func, and don't find an 'a'. So we
look in namespace C, and find A::C::a.
The DWARF gives the debugger all the information it needs, the debugger
just needs to understand how C++ name lookup works.
Jason
More information about the Dwarf-discuss
mailing list