[Lldb-commits] [PATCH] D61606: Add support for importing general C++ modules into the LLDB expression evaluator

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon May 6 12:19:49 PDT 2019


teemperor created this revision.
teemperor added reviewers: aprantl, shafik.
teemperor added a project: C++ modules in LLDB.
Herald added subscribers: lldb-commits, jdoerfert, abidh, mgrang.
Herald added a project: LLDB.

This patch adds basic support for importing C++ modules in general into the LLDB expression evaluator. It mostly reuses
the code we already use for the std module prototype for building/importing the modules, but is using a different logic
for querying the modules from the executable. The current functionality is limited - like the first std module patch - to
only reading module information but not merging or substituting debug information.

Unlike the std module prototype, this feature now requires that we compile with `-gmodules`, as this is the only way we
have all modules (even modules that were just imported but not actually used) in the debug information. Without this,
we run into frequent build errors as soon as some module includes another module without actually using it. This leads
to the situation where Clang will not emit the module in the debug information (as it's unused), but LLDB will fail to
compile the C++ module as it still needs the include paths of the unused module. This is why we now have a
`GetAllUsedModules` that works similar to `GetImportedModules` but actually creates a complete list of all modules we
have used in a given compilation unit. This allows LLDB to fully reconstruct the original include directories.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D61606

Files:
  lldb/include/lldb/Symbol/CompileUnit.h
  lldb/include/lldb/Symbol/SourceModule.h
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/include/lldb/Symbol/SymbolVendor.h
  lldb/include/lldb/Target/Target.h
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/functions/Makefile
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/functions/TestFunctionImportCxxModules.py
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/functions/foo.h
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/functions/main.cpp
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/functions/module.modulemap
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/macro/Makefile
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/macro/TestMacroImportCxxModules.py
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/macro/foo.h
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/macro/main.cpp
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/macro/module.modulemap
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/multiple-include-dirs/Makefile
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/multiple-include-dirs/TestMultiIncDirImportCxxModules.py
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/multiple-include-dirs/foo.h
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/multiple-include-dirs/inc1/a.h
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/multiple-include-dirs/inc1/module.modulemap
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/multiple-include-dirs/inc2/b.h
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/multiple-include-dirs/inc2/module.modulemap
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/multiple-include-dirs/main.cpp
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/multiple-include-dirs/module.modulemap
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/templates/Makefile
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/templates/TestTemplateImportCxxModules.py
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/templates/foo.h
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/templates/main.cpp
  lldb/packages/Python/lldbsuite/test/expression_command/import-c++-modules/templates/module.modulemap
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
  lldb/source/Symbol/CompileUnit.cpp
  lldb/source/Symbol/SymbolVendor.cpp
  lldb/source/Target/Target.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61606.198322.patch
Type: text/x-patch
Size: 33582 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190506/25f5490b/attachment-0001.bin>


More information about the lldb-commits mailing list