[Dwarf-Discuss] name lookup w/ using directives

Michael Eager eager at eagercon.com
Thu Aug 21 13:20:20 PDT 2008

Kendrick Wong wrote:
> Jason wrote:
>  > The DWARF has the same nesting information as the source code; the
>  > consumer can use the same algorithm as the compiler.  I don't think we
>  > want to encode standard lookup rules in the debugging information;
>  > better to put that in one place in the debugger rather expand the
>  > debugging information for every occurrence of a using-declaration.
> I still have some reservation about building dependencies on the C++ 
> language rules into DWARF.  All of the other TAGs that I am aware of, 
> are language independent, so a DWARF consumer don't have to worry about 
> the language and still be able to interpret the DWARF data correctly.

There are no dependencies on language rules in DWARF.  DWARF simply
describes the mapping between the source and the object code.

There are dependencies on language rules in debuggers.

TAGs are not necessarily language independent.  For example, all languages
which support structured data (eg, struct in C/C++ or record in Pascal)
may have data described by a DW_TAG_structure_type TAG.  But the details
of how this is interpreted by a debugger can depend on the language.
Clearly, finding the definition for a symbol in Pascal will be different
from that in Java, for example, when there is a "with" statement.

> The DW_TAG_imported_module seems to break this rule.  For Fortran, the 
> namespace is imported immediately.  For C++, the namespace is imported 
> at a later time, not to mention all the other intricacies regarding 
> common enclosing scope.  From this point of view, I really think C++ 
> using directive needs a different tag.

Other than saying "this is a Fortran imported namespace" or "this is
a C++ imported namespace", what would the difference be?  The language
is already known from the CU TAG.

Michael Eager	 eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

More information about the Dwarf-Discuss mailing list