[all-commits] [llvm/llvm-project] a03dc8: [lldb] Add basic -flimit-debug-info support to exp...

Pavel Labath via All-commits all-commits at lists.llvm.org
Wed Jul 1 05:50:35 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a03dc8c9fa8e9c5cf44448fac1a9ad0fdad7df41
      https://github.com/llvm/llvm-project/commit/a03dc8c9fa8e9c5cf44448fac1a9ad0fdad7df41
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2020-07-01 (Wed, 01 Jul 2020)

  Changed paths:
    M lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangASTMetadata.h
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    A lldb/test/API/functionalities/limit-debug-info/Makefile
    A lldb/test/API/functionalities/limit-debug-info/TestLimitDebugInfo.py
    A lldb/test/API/functionalities/limit-debug-info/foo.cpp
    A lldb/test/API/functionalities/limit-debug-info/main.cpp
    A lldb/test/API/functionalities/limit-debug-info/one.cpp
    A lldb/test/API/functionalities/limit-debug-info/onetwo.h
    A lldb/test/API/functionalities/limit-debug-info/two.cpp

  Log Message:
  -----------
  [lldb] Add basic -flimit-debug-info support to expression evaluator

Summary:
This patch adds support for evaluation of expressions referring to types
which were compiled in -flimit-debug-info (a.k.a -fno-standalone-debug)
in clang. In this mode it's possible that the debug information needed
to fully describe a c++ type is not present in a single shared library
-- for example debug info for a base class or a member of a type can
only be found in another shared library.  This situation is not
currently handled well within lldb as we are limited to searching within
a single shared library (lldb_private::Module) when searching for the
definition of these types.

The way that this patch gets around this limitation is by doing the
search at a later stage -- during the construction of the expression ast
context. This works by having the parser (currently SymbolFileDWARF, but
a similar approach is probably needed for PDBs too) mark a type as
"forcefully completed". What this means is that the parser has marked
the type as "complete" in the module ast context (as this is necessary
to e.g. derive classes from it), but its definition is not really there.
This is done via a new field on the ClangASTMetadata struct.

Later, when we are importing such a type into the expression ast, we
check this flag. If the flag is set, we try to find a better definition
for the type in other shared libraries. We do this by initiating a
new lookup for the "forcefully completed" classes, which then imports the
type from a module with a full definition.

This patch only implements this handling for base classes, but other
cases (members, array element types, etc.). The changes for that should
be fairly simple and mostly revolve around marking these types as
"forcefully completed" at an approriate time -- the importing logic is
generic already.

Another aspect, which is also not handled by this patch is viewing these
types via the "frame variable" command. This does not use the AST
importer and so it will need to handle these types on its own -- that
will be the subject of another patch.

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




More information about the All-commits mailing list