[lldb-dev] SymbolFile::FindGlobalVariables

Zachary Turner via lldb-dev lldb-dev at lists.llvm.org
Fri Mar 11 11:02:52 PST 2016


I'm trying to implement this function for PDB.  There are two overloads:

uint32_t
FindGlobalVariables (const ConstString &name, const CompilerDeclContext
*parent_decl_ctx, bool append, uint32_t max_matches, VariableList&
variables)

uint32_t
FindGlobalVariables(const RegularExpression& regex, bool append, uint32_t
max_matches, VariableList& variables)

I know how to implement the second overload, but not the first.  What is a
CompilerDeclContext?  Some comments in the DWARF implementation of the
function seem to imply it's related to namespaces, but there's a lot of
strange code that I don't understand.  What is the relationship between a
namespace and a symbol file?  And why does
`DeclContextMatchesThisSymbolFile` contain no code at all that accesses any
property of the symbol file?  It just checks if
decl_ctx->GetTypeSystem()->GetMinimumLanguage(nullptr)
== decl_ctx->GetTypeSystem(), which appears to have nothing to do with any
symbol file.

What user command or debugger operation results in FindGlobalVariables
getting called with this particular overload, and how does it build the
CompilerDeclContext?

On another note, why is the decl context stored as void* instead of having
an actual wrapper with an abstract interface such as ClangDeclContext /
JavaDeclContext, etc that all inherit from LanguageDeclContext, and pass
the LanguageDeclContext around instead of a void*?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20160311/cb3f9fb9/attachment.html>


More information about the lldb-dev mailing list