[all-commits] [llvm/llvm-project] 99b7b4: [lldb][import-std-module] Do some basic file check...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Thu Jan 21 03:33:28 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 99b7b41edf4fbc2d6e52bc4524c956e8f69042d9
      https://github.com/llvm/llvm-project/commit/99b7b41edf4fbc2d6e52bc4524c956e8f69042d9
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2021-01-21 (Thu, 21 Jan 2021)

  Changed paths:
    M lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.h
    M lldb/test/API/commands/expression/import-std-module/empty-module/root/usr/include/c++/v1/algorithm
    A lldb/test/API/commands/expression/import-std-module/empty-module/root/usr/include/c++/v1/vector
    R lldb/test/API/commands/expression/import-std-module/empty-module/root/usr/include/libc_header.h
    A lldb/test/API/commands/expression/import-std-module/empty-module/root/usr/include/stdio.h
    M lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/root/usr/include/c++/v1/vector
    R lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/root/usr/include/libc_header.h
    A lldb/test/API/commands/expression/import-std-module/forward_decl_from_module/root/usr/include/stdio.h
    A lldb/test/API/commands/expression/import-std-module/missing-module-sources/Makefile
    A lldb/test/API/commands/expression/import-std-module/missing-module-sources/TestStdModuleSourcesMissing.py
    A lldb/test/API/commands/expression/import-std-module/missing-module-sources/main.cpp
    A lldb/test/API/commands/expression/import-std-module/missing-module-sources/root/usr/include/c++/v1/module.modulemap
    A lldb/test/API/commands/expression/import-std-module/missing-module-sources/root/usr/include/c++/v1/vector
    A lldb/test/API/commands/expression/import-std-module/missing-module-sources/root/usr/include/stdio.h
    M lldb/test/API/commands/expression/import-std-module/sysroot/root/usr/include/c++/v1/algorithm
    A lldb/test/API/commands/expression/import-std-module/sysroot/root/usr/include/c++/v1/vector
    R lldb/test/API/commands/expression/import-std-module/sysroot/root/usr/include/libc_header.h
    A lldb/test/API/commands/expression/import-std-module/sysroot/root/usr/include/stdio.h
    M lldb/unittests/Expression/CppModuleConfigurationTest.cpp

  Log Message:
  -----------
  [lldb][import-std-module] Do some basic file checks before trying to import a module

Currently when LLDB has enough data in the debug information to import the `std` module,
it will just try to import it. However when debugging libraries where the sources aren't
available anymore, importing the module will generate a confusing diagnostic that
the module couldn't be built.

For the fallback mode (where we retry failed expressions with the loaded module), this
will cause the second expression to fail with a module built error instead of the
actual parsing issue in the user expression.

This patch adds checks that ensures that we at least have any source files in the found
include paths before we try to import the module. This prevents the module from being
loaded in the situation described above which means we don't emit the bogus 'can't
import module' diagnostic and also don't waste any time retrying the expression in the
fallback mode.

For the unit tests I did some refactoring as they now require a VFS with the files in it
and not just the paths. The Python test just builds a binary with a fake C++ module,
then deletes the module before debugging.

Fixes rdar://73264458

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D95096




More information about the All-commits mailing list