LLDB  mainline
Public Member Functions | Protected Attributes | Private Types | Private Member Functions | List of all members
lldb_private::CompileUnit Class Reference

A class that describes a compilation unit. More...

#include "lldb/Symbol/CompileUnit.h"

Inheritance diagram for lldb_private::CompileUnit:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::CompileUnit:
Collaboration graph
[legend]

Public Member Functions

 CompileUnit (const lldb::ModuleSP &module_sp, void *user_data, const char *pathname, lldb::user_id_t uid, lldb::LanguageType language, lldb_private::LazyBool is_optimized)
 Construct with a module, path, UID and language. More...
 
 CompileUnit (const lldb::ModuleSP &module_sp, void *user_data, const FileSpec &file_spec, lldb::user_id_t uid, lldb::LanguageType language, lldb_private::LazyBool is_optimized)
 Construct with a module, file spec, UID and language. More...
 
void AddFunction (lldb::FunctionSP &function_sp)
 Add a function to this compile unit. More...
 
void CalculateSymbolContext (SymbolContext *sc) override
 Reconstruct the object's symbol context into sc. More...
 
lldb::ModuleSP CalculateSymbolContextModule () override
 
CompileUnitCalculateSymbolContextCompileUnit () override
 
void DumpSymbolContext (Stream *s) override
 Dump the object's symbol context to the stream s. More...
 
lldb::LanguageType GetLanguage ()
 
void SetLanguage (lldb::LanguageType language)
 
void GetDescription (Stream *s, lldb::DescriptionLevel level) const
 
void ForeachFunction (llvm::function_ref< bool(const lldb::FunctionSP &)> lambda) const
 Apply a lambda to each function in this compile unit. More...
 
lldb::FunctionSP FindFunction (llvm::function_ref< bool(const lldb::FunctionSP &)> matching_lambda)
 Find a function in the compile unit based on the predicate matching_lambda. More...
 
void Dump (Stream *s, bool show_context) const
 Dump the compile unit contents to the stream s. More...
 
uint32_t FindLineEntry (uint32_t start_idx, uint32_t line, const FileSpec *file_spec_ptr, bool exact, LineEntry *line_entry)
 Find the line entry by line and optional inlined file spec. More...
 
const FileSpecGetPrimaryFile () const
 Return the primary source file associated with this compile unit. More...
 
LineTableGetLineTable ()
 Get the line table for the compile unit. More...
 
DebugMacrosGetDebugMacros ()
 
virtual bool ForEachExternalModule (llvm::DenseSet< lldb_private::SymbolFile *> &visited_symbol_files, llvm::function_ref< bool(Module &)> lambda)
 Apply a lambda to each external lldb::Module referenced by this compilation unit. More...
 
const FileSpecList & GetSupportFiles ()
 Get the compile unit's support file list. More...
 
const std::vector< SourceModule > & GetImportedModules ()
 Get the compile unit's imported module list. More...
 
void * GetUserData () const
 Get the SymbolFile plug-in user data. More...
 
lldb::VariableListSP GetVariableList (bool can_create)
 Get the variable list for a compile unit. More...
 
lldb::FunctionSP FindFunctionByUID (lldb::user_id_t uid)
 Finds a function by user ID. More...
 
void SetLineTable (LineTable *line_table)
 Set the line table for the compile unit. More...
 
void SetSupportFiles (const FileSpecList &support_files)
 
void SetDebugMacros (const DebugMacrosSP &debug_macros)
 
void SetVariableList (lldb::VariableListSP &variable_list_sp)
 Set accessor for the variable list. More...
 
void ResolveSymbolContext (const FileSpec &file_spec, uint32_t line, bool check_inlines, bool exact, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list)
 Resolve symbol contexts by file and line. More...
 
bool GetIsOptimized ()
 Get whether compiler optimizations were enabled for this compile unit. More...
 
size_t GetNumFunctions () const
 Returns the number of functions in this compile unit. More...
 
- Public Member Functions inherited from lldb_private::ModuleChild
 ModuleChild (const lldb::ModuleSP &module_sp)
 Construct with owning module. More...
 
 ~ModuleChild ()
 Destructor. More...
 
const ModuleChildoperator= (const ModuleChild &rhs)
 Assignment operator. More...
 
lldb::ModuleSP GetModule () const
 Get const accessor for the module pointer. More...
 
void SetModule (const lldb::ModuleSP &module_sp)
 Set accessor for the module pointer. More...
 
- Public Member Functions inherited from lldb_private::UserID
 UserID (lldb::user_id_t uid=LLDB_INVALID_UID)
 Construct with optional user ID. More...
 
 ~UserID ()
 Destructor. More...
 
void Clear ()
 Clears the object state. More...
 
lldb::user_id_t GetID () const
 Get accessor for the user ID. More...
 
void SetID (lldb::user_id_t uid)
 Set accessor for the user ID. More...
 
- Public Member Functions inherited from lldb_private::SymbolContextScope
virtual ~SymbolContextScope ()=default
 
virtual FunctionCalculateSymbolContextFunction ()
 
virtual BlockCalculateSymbolContextBlock ()
 
virtual SymbolCalculateSymbolContextSymbol ()
 

Protected Attributes

void * m_user_data
 User data for the SymbolFile parser to store information into. More...
 
lldb::LanguageType m_language
 The programming language enumeration value. More...
 
Flags m_flags
 Compile unit flags that help with partial parsing. More...
 
llvm::DenseMap< lldb::user_id_t, lldb::FunctionSP > m_functions_by_uid
 Maps UIDs to functions. More...
 
std::vector< SourceModulem_imported_modules
 All modules, including the current module, imported by this compile unit. More...
 
FileSpec m_file_spec
 The primary file associated with this compile unit. More...
 
FileSpecList m_support_files
 Files associated with this compile unit's line table and declarations. More...
 
std::unique_ptr< LineTablem_line_table_up
 Line table that will get parsed on demand. More...
 
DebugMacrosSP m_debug_macros_sp
 Debug macros that will get parsed on demand. More...
 
lldb::VariableListSP m_variables
 Global and static variable list that will get parsed on demand. More...
 
lldb_private::LazyBool m_is_optimized
 eLazyBoolYes if this compile unit was compiled with optimization. More...
 
- Protected Attributes inherited from lldb_private::ModuleChild
lldb::ModuleWP m_module_wp
 The Module that owns the object that inherits from this class. More...
 
- Protected Attributes inherited from lldb_private::UserID
lldb::user_id_t m_uid
 The user ID that uniquely identifies an object. More...
 

Private Types

enum  {
  flagsParsedAllFunctions, flagsParsedVariables, flagsParsedSupportFiles = (1u << 2), flagsParsedLineTable,
  flagsParsedLanguage = (1u << 4), flagsParsedImportedModules, flagsParsedDebugMacros
}
 

Private Member Functions

 CompileUnit (const CompileUnit &)=delete
 
const CompileUnitoperator= (const CompileUnit &)=delete
 

Detailed Description

A class that describes a compilation unit.

A representation of a compilation unit, or compiled source file. The UserID of the compile unit is specified by the SymbolFile plug-in and can have any value as long as the value is unique within the Module that owns this compile units.

Each compile unit has a list of functions, global and static variables, support file list (include files and inlined source files), and a line table.

Definition at line 37 of file CompileUnit.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
flagsParsedAllFunctions 

Have we already parsed all our functions.

flagsParsedVariables 

Have we already parsed globals and statics?

flagsParsedSupportFiles 

Have we already parsed the support files for this compile unit?

flagsParsedLineTable 

Have we parsed the line table already?

flagsParsedLanguage 

Have we parsed the language already?

flagsParsedImportedModules 

Have we parsed the imported modules already?

flagsParsedDebugMacros 

Have we parsed the debug macros already?

Definition at line 434 of file CompileUnit.h.

Constructor & Destructor Documentation

◆ CompileUnit() [1/3]

CompileUnit::CompileUnit ( const lldb::ModuleSP &  module_sp,
void *  user_data,
const char *  pathname,
lldb::user_id_t  uid,
lldb::LanguageType  language,
lldb_private::LazyBool  is_optimized 
)

Construct with a module, path, UID and language.

Initialize the compile unit given the owning module, a path to convert into a FileSpec, the SymbolFile plug-in supplied uid, and the source language type.

Parameters
[in]module_spThe parent module that owns this compile unit. This value must be a valid pointer value.
[in]user_dataUser data where the SymbolFile parser can store data.
[in]pathnameThe path to the source file for this compile unit.
[in]uidThe user ID of the compile unit. This value is supplied by the SymbolFile plug-in and should be a value that allows the SymbolFile plug-in to easily locate and parse additional information for the compile unit.
[in]languageA language enumeration type that describes the main language of this compile unit.
[in]is_optimizedA value that can initialized with eLazyBoolYes, eLazyBoolNo or eLazyBoolCalculate. If set to eLazyBoolCalculate, then an extra call into SymbolVendor will be made to calculate if the compile unit is optimized will be made when CompileUnit::GetIsOptimized() is called.
See also
lldb::LanguageType

Definition at line 20 of file CompileUnit.cpp.

◆ CompileUnit() [2/3]

CompileUnit::CompileUnit ( const lldb::ModuleSP &  module_sp,
void *  user_data,
const FileSpec file_spec,
lldb::user_id_t  uid,
lldb::LanguageType  language,
lldb_private::LazyBool  is_optimized 
)

Construct with a module, file spec, UID and language.

Initialize the compile unit given the owning module, a path to convert into a FileSpec, the SymbolFile plug-in supplied uid, and the source language type.

Parameters
[in]module_spThe parent module that owns this compile unit. This value must be a valid pointer value.
[in]user_dataUser data where the SymbolFile parser can store data.
[in]file_specThe file specification for the source file of this compile unit.
[in]uidThe user ID of the compile unit. This value is supplied by the SymbolFile plug-in and should be a value that allows the plug-in to easily locate and parse additional information for the compile unit.
[in]languageA language enumeration type that describes the main language of this compile unit.
[in]is_optimizedA value that can initialized with eLazyBoolYes, eLazyBoolNo or eLazyBoolCalculate. If set to eLazyBoolCalculate, then an extra call into SymbolVendor will be made to calculate if the compile unit is optimized will be made when CompileUnit::GetIsOptimized() is called.
See also
lldb::LanguageType

Definition at line 27 of file CompileUnit.cpp.

References lldb::eLanguageTypeUnknown, flagsParsedLanguage, m_flags, and lldb_private::Flags::Set().

◆ CompileUnit() [3/3]

lldb_private::CompileUnit::CompileUnit ( const CompileUnit )
privatedelete

Member Function Documentation

◆ AddFunction()

void CompileUnit::AddFunction ( lldb::FunctionSP &  function_sp)

Add a function to this compile unit.

Typically called by the SymbolFile plug-ins as they partially parse the debug information.

Parameters
[in]function_spA shared pointer to the Function object.

Definition at line 134 of file CompileUnit.cpp.

References m_functions_by_uid.

Referenced by SymbolFileSymtab::ParseFunctions().

◆ CalculateSymbolContext()

void CompileUnit::CalculateSymbolContext ( SymbolContext sc)
overridevirtual

Reconstruct the object's symbol context into sc.

The object should fill in as much of the SymbolContext as it can so function calls that require a symbol context can be made for the given object.

Parameters
[out]scA symbol context object pointer that gets filled in.
See also
SymbolContextScope

Implements lldb_private::SymbolContextScope.

Definition at line 39 of file CompileUnit.cpp.

References lldb_private::SymbolContext::comp_unit, and lldb_private::ModuleChild::GetModule().

Referenced by lldb_private::Function::CalculateSymbolContext(), GetImportedModules(), and GetVariableList().

◆ CalculateSymbolContextCompileUnit()

CompileUnit * CompileUnit::CalculateSymbolContextCompileUnit ( )
overridevirtual

Reimplemented from lldb_private::SymbolContextScope.

Definition at line 46 of file CompileUnit.cpp.

◆ CalculateSymbolContextModule()

ModuleSP CompileUnit::CalculateSymbolContextModule ( )
overridevirtual

Reimplemented from lldb_private::SymbolContextScope.

Definition at line 44 of file CompileUnit.cpp.

References lldb_private::ModuleChild::GetModule().

Referenced by FindFunction().

◆ Dump()

void CompileUnit::Dump ( Stream s,
bool  show_context 
) const

Dump the compile unit contents to the stream s.

Parameters
[in]sThe stream to which to dump the object description.
[in]show_contextIf true, variables will dump their symbol context information.

Definition at line 105 of file CompileUnit.cpp.

References lldb_private::Stream::EOL(), ForeachFunction(), lldb_private::Language::GetNameForLanguageType(), GetPrimaryFile(), lldb_private::Stream::Indent(), lldb_private::Stream::IndentLess(), lldb_private::Stream::IndentMore(), m_functions_by_uid, m_language, m_variables, and lldb_private::Stream::Printf().

Referenced by lldb::SBCompileUnit::GetDescription(), and SetLanguage().

◆ DumpSymbolContext()

void CompileUnit::DumpSymbolContext ( Stream s)
overridevirtual

Dump the object's symbol context to the stream s.

The object should dump its symbol context to the stream s. This function is widely used in the DumpDebug and verbose output for lldb objects.

Parameters
[in]sThe stream to which to dump the object's symbol context.
See also
SymbolContextScope

Implements lldb_private::SymbolContextScope.

Definition at line 48 of file CompileUnit.cpp.

References lldb_private::UserID::GetID(), lldb_private::ModuleChild::GetModule(), and lldb_private::Stream::Printf().

Referenced by lldb_private::Function::DumpSymbolContext().

◆ FindFunction()

lldb::FunctionSP CompileUnit::FindFunction ( llvm::function_ref< bool(const lldb::FunctionSP &)>  matching_lambda)

Find a function in the compile unit based on the predicate matching_lambda.

Parameters
[in]matching_lambdaA predicate that will be used within FindFunction to evaluate each FunctionSP in m_functions_by_uid. When the predicate returns true FindFunction will return the corresponding FunctionSP.
Returns
The first FunctionSP that the matching_lambda prediate returns true for.

Definition at line 76 of file CompileUnit.cpp.

References CalculateSymbolContextModule(), m_functions_by_uid, and lldb_private::SymbolFile::ParseFunctions().

Referenced by SetLanguage().

◆ FindFunctionByUID()

FunctionSP CompileUnit::FindFunctionByUID ( lldb::user_id_t  uid)

Finds a function by user ID.

Typically used by SymbolFile plug-ins when partially parsing the debug information to see if the function has been parsed yet.

Parameters
[in]uidThe user ID of the function to find. This value is supplied by the SymbolFile plug-in and should be a value that allows the plug-in to easily locate and parse additional information in the function.
Returns
A shared pointer to the function object that might contain a NULL Function pointer.

Definition at line 138 of file CompileUnit.cpp.

References m_functions_by_uid.

Referenced by SymbolFileDWARF::GetFunction(), GetPrimaryFile(), SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc(), SymbolFilePDB::ParseDeclsForContext(), SymbolFilePDB::ParseFunctions(), SymbolFileDWARF::ParseFunctions(), SymbolFileDWARF::ParseTypes(), and SymbolFileDWARF::ResolveFunctionAndBlock().

◆ FindLineEntry()

uint32_t CompileUnit::FindLineEntry ( uint32_t  start_idx,
uint32_t  line,
const FileSpec file_spec_ptr,
bool  exact,
LineEntry line_entry 
)

Find the line entry by line and optional inlined file spec.

Finds the first line entry that has an index greater than start_idx that matches line. If file_spec_ptr is NULL, then the search matches line entries whose file matches the file for the compile unit. If file_spec_ptr is not NULL, line entries must match the specified file spec (for inlined line table entries).

Multiple calls to this function can find all entries that match a given file and line by starting with start_idx equal to zero, and calling this function back with the return value + 1.

Parameters
[in]start_idxThe zero based index at which to start looking for matches.
[in]lineThe line number to search for.
[in]file_spec_ptrIf non-NULL search for entries that match this file spec, else if NULL, search for line entries that match the compile unit file.
[in]exactIf match only if there is a line table entry for this line number. If , find the line table entry equal to or after this line number.
[out]line_entryIf non-NULL, a copy of the line entry that was found.
Returns
The zero based index of a matching line entry, or UINT32_MAX if no matching line entry is found.

Definition at line 219 of file CompileUnit.cpp.

References FindFileIndexes(), lldb_private::LineTable::FindLineEntryIndexByFileIndex(), GetLineTable(), GetPrimaryFile(), GetSupportFiles(), and UINT32_MAX.

Referenced by CommandObjectSourceInfo::DumpFileLinesInCompUnit(), lldb::SBCompileUnit::FindLineEntryIndex(), lldb_private::SymbolContext::GetAddressRangeFromHereToEndLine(), and SetLanguage().

◆ ForEachExternalModule()

bool CompileUnit::ForEachExternalModule ( llvm::DenseSet< lldb_private::SymbolFile *> &  visited_symbol_files,
llvm::function_ref< bool(Module &)>  lambda 
)
virtual

Apply a lambda to each external lldb::Module referenced by this compilation unit.

Recursively also descends into the referenced external modules of any encountered compilation unit.

Parameters
visited_symbol_filesA set of SymbolFiles that were already visited to avoid visiting one file more than once.
[in]lambdaThe lambda that should be applied to every function. The lambda can return true if the iteration should be aborted earlier.
Returns
If the lambda early-exited, this function returns true to propagate the early exit.

Definition at line 352 of file CompileUnit.cpp.

References lldb_private::ModuleChild::GetModule().

Referenced by GetModuleConfig(), and GetPrimaryFile().

◆ ForeachFunction()

void CompileUnit::ForeachFunction ( llvm::function_ref< bool(const lldb::FunctionSP &)>  lambda) const

Apply a lambda to each function in this compile unit.

This provides raw access to the function shared pointer list and will not cause the SymbolFile plug-in to parse any unparsed functions.

Note
Prefer using FindFunctionByUID over this if possible.
Parameters
[in]lambdaThe lambda that should be applied to every function. The lambda can return true if the iteration should be aborted earlier.

Definition at line 60 of file CompileUnit.cpp.

References m_functions_by_uid.

Referenced by Dump(), lldb_private::Module::ParseAllDebugSymbols(), and SetLanguage().

◆ GetDebugMacros()

DebugMacros * CompileUnit::GetDebugMacros ( )

◆ GetDescription()

void CompileUnit::GetDescription ( Stream s,
lldb::DescriptionLevel  level 
) const

◆ GetImportedModules()

const std::vector< SourceModule > & CompileUnit::GetImportedModules ( )

Get the compile unit's imported module list.

This reports all the imports that the compile unit made, including the current module.

Returns
A list of imported modules.

Definition at line 339 of file CompileUnit.cpp.

References CalculateSymbolContext(), flagsParsedImportedModules, lldb_private::ModuleChild::GetModule(), lldb_private::Flags::IsClear(), m_flags, m_imported_modules, and lldb_private::Flags::Set().

Referenced by GetPrimaryFile(), and lldb_private::ClangModulesDeclVendor::LanguageSupportsClangModules().

◆ GetIsOptimized()

bool CompileUnit::GetIsOptimized ( )

Get whether compiler optimizations were enabled for this compile unit.

"optimized" means that the debug experience may be difficult for the user to understand. Variables may not be available when the developer would expect them, stepping through the source lines in the function may appear strange, etc.

Returns
Returns 'true' if this compile unit was compiled with optimization. 'false' indicates that either the optimization is unknown, or this compile unit was built without optimization.

Definition at line 324 of file CompileUnit.cpp.

References lldb_private::eLazyBoolCalculate, lldb_private::eLazyBoolNo, lldb_private::eLazyBoolYes, lldb_private::ModuleChild::GetModule(), and m_is_optimized.

Referenced by lldb::SBFunction::GetIsOptimized(), lldb_private::Function::GetIsOptimized(), and GetPrimaryFile().

◆ GetLanguage()

lldb::LanguageType CompileUnit::GetLanguage ( )

◆ GetLineTable()

LineTable * CompileUnit::GetLineTable ( )

◆ GetNumFunctions()

size_t lldb_private::CompileUnit::GetNumFunctions ( ) const
inline

Returns the number of functions in this compile unit.

Definition at line 404 of file CompileUnit.h.

References m_functions_by_uid.

Referenced by lldb_private::npdb::SymbolFileNativePDB::ParseFunctions().

◆ GetPrimaryFile()

const FileSpec& lldb_private::CompileUnit::GetPrimaryFile ( ) const
inline

Return the primary source file associated with this compile unit.

Definition at line 226 of file CompileUnit.h.

References FindFunctionByUID(), ForEachExternalModule(), GetDebugMacros(), GetImportedModules(), GetIsOptimized(), GetLineTable(), GetSupportFiles(), GetUserData(), GetVariableList(), m_file_spec, ResolveSymbolContext(), SetDebugMacros(), SetLineTable(), SetSupportFiles(), and SetVariableList().

Referenced by lldb_private::SearchFilterByModuleListAndCU::AddressPasses(), lldb_private::SourceManager::File::CommonInitializer(), lldb_private::SearchFilterByModuleListAndCU::CompUnitPasses(), CommandObjectTargetVariable::DoExecute(), CommandObjectSourceList::DoExecute(), Dump(), DumpCompileUnitLineTable(), CommandObjectSourceInfo::DumpFileLinesInCompUnit(), CommandObjectTargetVariable::DumpGlobalVariableList(), lldb_private::Module::FindCompileUnits(), FindLineEntry(), lldb::SBCompileUnit::FindLineEntryIndex(), lldb_private::FormatEntity::Format(), lldb_private::Function::GetBlock(), GetDescription(), lldb_private::BreakpointLocation::GetDescription(), lldb::SBCompileUnit::GetFileSpec(), lldb_private::CommandCompletions::InvokeCommonCompletionCallbacks(), lldb_private::Breakpoint::ModulesChanged(), SymbolFileDWARF::ResolveFunctionAndBlock(), ResolveSymbolContext(), lldb_private::SearchFilterByModuleListAndCU::Search(), lldb_private::BreakpointResolverFileRegex::SearchCallback(), lldb_private::FileLineResolver::SearchCallback(), and lldb_private::SymbolContextSpecifier::SymbolContextMatches().

◆ GetSupportFiles()

const FileSpecList & CompileUnit::GetSupportFiles ( )

◆ GetUserData()

void * CompileUnit::GetUserData ( ) const

Get the SymbolFile plug-in user data.

SymbolFile plug-ins can store user data to internal state or objects to quickly allow them to parse more information for a given object.

Returns
The user data stored with the CompileUnit when it was constructed.

Definition at line 371 of file CompileUnit.cpp.

References m_user_data.

Referenced by GetPrimaryFile().

◆ GetVariableList()

VariableListSP CompileUnit::GetVariableList ( bool  can_create)

Get the variable list for a compile unit.

Called by clients to get the variable list for a compile unit. The variable list will contain all global and static variables that were defined at the compile unit level.

Parameters
[in]can_createIf true, the variable list will be parsed on demand. If false, the current variable list will be returned even if it contains a NULL VariableList object (typically called by dumping routines that want to display only what has currently been parsed).
Returns
A shared pointer to a variable list, that can contain NULL VariableList pointer if there are no global or static variables.

Definition at line 199 of file CompileUnit.cpp.

References CalculateSymbolContext(), m_variables, and lldb_private::SymbolContext::module_sp.

Referenced by CommandObjectTargetVariable::DoExecute(), lldb_private::StackFrame::GetInScopeVariableList(), GetPrimaryFile(), lldb_private::StackFrame::GetVariableList(), SymbolFilePDB::ParseVariables(), SymbolFileDWARF::ParseVariables(), SymbolFilePDB::ParseVariablesForContext(), lldb_private::npdb::SymbolFileNativePDB::ParseVariablesForContext(), and SymbolFileDWARF::ParseVariablesForContext().

◆ operator=()

const CompileUnit& lldb_private::CompileUnit::operator= ( const CompileUnit )
privatedelete

◆ ResolveSymbolContext()

void CompileUnit::ResolveSymbolContext ( const FileSpec file_spec,
uint32_t  line,
bool  check_inlines,
bool  exact,
lldb::SymbolContextItem  resolve_scope,
SymbolContextList sc_list 
)

Resolve symbol contexts by file and line.

Given a file in file_spec, and a line number, find all instances and append them to the supplied symbol context list sc_list.

Parameters
[in]file_specA file specification. If file_spec contains no directory information, only the basename will be used when matching contexts. If the directory in file_spec is valid, a complete file specification match will be performed.
[in]lineThe line number to match against the compile unit's line tables.
[in]check_inlinesIf true this function will also match any inline file and line matches. If false, the compile unit's file specification must match file_spec for any matches to be returned.
[in]exactIf true, only resolve the context if line exists in the line table. If false, resolve the context to the closest line greater than line in the line table.
[in]resolve_scopeFor each matching line entry, this bitfield indicates what values within each SymbolContext that gets added to sc_list will be resolved. See the SymbolContext::Scope enumeration for a list of all available bits that can be resolved. Only SymbolContext entries that can be resolved using a LineEntry base address will be able to be resolved.
[out]sc_listA SymbolContext list class that will get any matching entries appended to.
See also
enum SymbolContext::Scope

Definition at line 235 of file CompileUnit.cpp.

References lldb_private::SymbolContextList::Append(), lldb_private::Address::CalculateSymbolContext(), lldb_private::SymbolContext::comp_unit, lldb_private::LineTable::FindLineEntryIndexByFileIndex(), lldb_private::AddressRange::GetBaseAddress(), GetLineTable(), lldb_private::ModuleChild::GetModule(), GetPrimaryFile(), GetSupportFiles(), lldb_private::LineEntry::line, lldb_private::SymbolContext::line_entry, lldb_private::FileSpec::Match(), lldb_private::LineEntry::range, and UINT32_MAX.

Referenced by GetPrimaryFile(), lldb_private::breakpad::SymbolFileBreakpad::ResolveSymbolContext(), lldb_private::AddressResolverFileLine::SearchCallback(), and lldb_private::BreakpointResolverFileRegex::SearchCallback().

◆ SetDebugMacros()

void CompileUnit::SetDebugMacros ( const DebugMacrosSP debug_macros)

◆ SetLanguage()

void lldb_private::CompileUnit::SetLanguage ( lldb::LanguageType  language)
inline

◆ SetLineTable()

void CompileUnit::SetLineTable ( LineTable line_table)

Set the line table for the compile unit.

Called by the SymbolFile plug-in when if first parses the line table and hands ownership of the line table to this object. The compile unit owns the line table object and will delete the object when it is deleted.

Parameters
[in]line_tableA line table object pointer that this object now owns.

Definition at line 167 of file CompileUnit.cpp.

References lldb_private::Flags::Clear(), flagsParsedLineTable, m_flags, m_line_table_up, and lldb_private::Flags::Set().

Referenced by GetPrimaryFile(), SymbolFilePDB::ParseCompileUnitLineTable(), lldb_private::breakpad::SymbolFileBreakpad::ParseLineTable(), and lldb_private::npdb::SymbolFileNativePDB::ParseLineTable().

◆ SetSupportFiles()

void CompileUnit::SetSupportFiles ( const FileSpecList &  support_files)

Definition at line 175 of file CompileUnit.cpp.

References m_support_files.

Referenced by GetPrimaryFile(), and SymbolFileDWARF::ParseSupportFiles().

◆ SetVariableList()

void CompileUnit::SetVariableList ( lldb::VariableListSP &  variable_list_sp)

Set accessor for the variable list.

Called by the SymbolFile plug-ins after they have parsed the variable lists and are ready to hand ownership of the list over to this object.

Parameters
[in]variable_list_spA shared pointer to a VariableList.

Definition at line 335 of file CompileUnit.cpp.

References m_variables.

Referenced by GetPrimaryFile(), SymbolFilePDB::ParseVariables(), lldb_private::npdb::SymbolFileNativePDB::ParseVariablesForContext(), and SymbolFileDWARF::ParseVariablesForContext().

Member Data Documentation

◆ m_debug_macros_sp

DebugMacrosSP lldb_private::CompileUnit::m_debug_macros_sp
protected

Debug macros that will get parsed on demand.

Definition at line 426 of file CompileUnit.h.

Referenced by GetDebugMacros(), and SetDebugMacros().

◆ m_file_spec

FileSpec lldb_private::CompileUnit::m_file_spec
protected

The primary file associated with this compile unit.

Definition at line 419 of file CompileUnit.h.

Referenced by GetPrimaryFile().

◆ m_flags

Flags lldb_private::CompileUnit::m_flags
protected

Compile unit flags that help with partial parsing.

Definition at line 412 of file CompileUnit.h.

Referenced by CompileUnit(), GetDebugMacros(), GetImportedModules(), GetLanguage(), GetLineTable(), GetSupportFiles(), SetDebugMacros(), SetLanguage(), and SetLineTable().

◆ m_functions_by_uid

llvm::DenseMap<lldb::user_id_t, lldb::FunctionSP> lldb_private::CompileUnit::m_functions_by_uid
protected

Maps UIDs to functions.

Definition at line 414 of file CompileUnit.h.

Referenced by AddFunction(), Dump(), FindFunction(), FindFunctionByUID(), ForeachFunction(), and GetNumFunctions().

◆ m_imported_modules

std::vector<SourceModule> lldb_private::CompileUnit::m_imported_modules
protected

All modules, including the current module, imported by this compile unit.

Definition at line 417 of file CompileUnit.h.

Referenced by GetImportedModules().

◆ m_is_optimized

lldb_private::LazyBool lldb_private::CompileUnit::m_is_optimized
protected

eLazyBoolYes if this compile unit was compiled with optimization.

Definition at line 431 of file CompileUnit.h.

Referenced by GetIsOptimized().

◆ m_language

lldb::LanguageType lldb_private::CompileUnit::m_language
protected

The programming language enumeration value.

Definition at line 410 of file CompileUnit.h.

Referenced by Dump(), GetDescription(), GetLanguage(), and SetLanguage().

◆ m_line_table_up

std::unique_ptr<LineTable> lldb_private::CompileUnit::m_line_table_up
protected

Line table that will get parsed on demand.

Definition at line 424 of file CompileUnit.h.

Referenced by GetLineTable(), and SetLineTable().

◆ m_support_files

FileSpecList lldb_private::CompileUnit::m_support_files
protected

Files associated with this compile unit's line table and declarations.

Definition at line 422 of file CompileUnit.h.

Referenced by GetSupportFiles(), and SetSupportFiles().

◆ m_user_data

void* lldb_private::CompileUnit::m_user_data
protected

User data for the SymbolFile parser to store information into.

Definition at line 408 of file CompileUnit.h.

Referenced by GetUserData().

◆ m_variables

lldb::VariableListSP lldb_private::CompileUnit::m_variables
protected

Global and static variable list that will get parsed on demand.

Definition at line 428 of file CompileUnit.h.

Referenced by Dump(), GetVariableList(), and SetVariableList().


The documentation for this class was generated from the following files: