As a complementary part of the module debugging story, here is a proposal to 
list the imported modules in the debug info. This patch is not about 
efficiency, but rather enables a cool debugging feature:

Record the clang modules imported by the current compile unit in the debug 
info. This allows a module-aware debugger (such as LLDB) to @import all modules 
visible in the current context before evaluating an expression, thus making 
available all declarations in the current context (that originate from a 
module) and not just the ones that were actually used by the program.

This implementation uses existing DWARF mechanisms as much as possible by 
emitting a DW_TAG_imported_module that references a DW_TAG_module, which 
contains the information necessary for the debugger to rebuild the module. This 
is similar to how C++ using declarations are encoded in DWARF, with the 
difference that we're importing a module instead of a namespace.
The information stored for a module includes the umbrella directory, any config 
macros passed in via the command line that affect the module, and the filename 
of the raw .pcm file. Why include all these parameters when we have the .pcm 
file? Apart from module chache volatility, there is no guarantee that the 
debugger was linked against the same version of clang that generated the .pcm, 
so it may need to regenerate the module while importing it.

Let me know what you think!
-- adrian


Attachment: 0001-Record-the-clang-modules-imported-by-the-current-com.patch
Description: Binary data

Attachment: 0002-Introduce-DIModule-a-wrapper-for-DW_TAG_module-to-em.patch
Description: Binary data

_______________________________________________
lldb-dev mailing list
lldb-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to