diff options
Diffstat (limited to 'include/lldb/Core/Module.h')
-rw-r--r-- | include/lldb/Core/Module.h | 417 |
1 files changed, 159 insertions, 258 deletions
diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h index 270a401172fa..544895ea89e9 100644 --- a/include/lldb/Core/Module.h +++ b/include/lldb/Core/Module.h @@ -1,9 +1,8 @@ //===-- Module.h ------------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -40,60 +39,24 @@ namespace lldb_private { class CompilerDeclContext; -} -namespace lldb_private { class Function; -} -namespace lldb_private { class Log; -} -namespace lldb_private { class ObjectFile; -} -namespace lldb_private { class RegularExpression; -} -namespace lldb_private { class SectionList; -} -namespace lldb_private { class Stream; -} -namespace lldb_private { class Symbol; -} -namespace lldb_private { class SymbolContext; -} -namespace lldb_private { class SymbolContextList; -} -namespace lldb_private { class SymbolFile; -} -namespace lldb_private { class SymbolVendor; -} -namespace lldb_private { class Symtab; -} -namespace lldb_private { class Target; -} -namespace lldb_private { class TypeList; -} -namespace lldb_private { class TypeMap; -} -namespace lldb_private { class VariableList; -} - -namespace lldb_private { -//---------------------------------------------------------------------- -/// @class Module Module.h "lldb/Core/Module.h" +/// \class Module Module.h "lldb/Core/Module.h" /// A class that describes an executable image and its associated /// object and symbol files. /// @@ -108,7 +71,6 @@ namespace lldb_private { /// Module::GetSymbolVendor() is called. /// /// The module will parse more detailed information as more queries are made. -//---------------------------------------------------------------------- class Module : public std::enable_shared_from_this<Module>, public SymbolContextScope { public: @@ -124,30 +86,28 @@ public: static std::recursive_mutex &GetAllocationModuleCollectionMutex(); - //------------------------------------------------------------------ /// Construct with file specification and architecture. /// /// Clients that wish to share modules with other targets should use /// ModuleList::GetSharedModule(). /// - /// @param[in] file_spec + /// \param[in] file_spec /// The file specification for the on disk representation of /// this executable image. /// - /// @param[in] arch + /// \param[in] arch /// The architecture to set as the current architecture in /// this module. /// - /// @param[in] object_name + /// \param[in] object_name /// The name of an object in a module used to extract a module /// within a module (.a files and modules that contain multiple /// architectures). /// - /// @param[in] object_offset + /// \param[in] object_offset /// The offset within an existing module used to extract a /// module within a module (.a files and modules that contain /// multiple architectures). - //------------------------------------------------------------------ Module( const FileSpec &file_spec, const ArchSpec &arch, const ConstString *object_name = nullptr, @@ -164,25 +124,26 @@ public: lldb::ModuleSP module_sp(new Module()); module_sp->m_objfile_sp = std::make_shared<ObjFilePlugin>(module_sp, std::forward<Args>(args)...); - - // Once we get the object file, update our module with the object file's - // architecture since it might differ in vendor/os if some parts were - // unknown. - if (ArchSpec arch = module_sp->m_objfile_sp->GetArchitecture()) { - module_sp->m_arch = arch; - return module_sp; - } - return nullptr; + module_sp->m_did_load_objfile.store(true, std::memory_order_relaxed); + + // Once we get the object file, set module ArchSpec to the one we get from + // the object file. If the object file does not have an architecture, we + // consider the creation a failure. + ArchSpec arch = module_sp->m_objfile_sp->GetArchitecture(); + if (!arch) + return nullptr; + module_sp->m_arch = arch; + + // Also copy the object file's FileSpec. + module_sp->m_file = module_sp->m_objfile_sp->GetFileSpec(); + return module_sp; } - //------------------------------------------------------------------ /// Destructor. - //------------------------------------------------------------------ ~Module() override; bool MatchesModuleSpec(const ModuleSpec &module_ref); - //------------------------------------------------------------------ /// Set the load address for all sections in a module to be the file address /// plus \a slide. /// @@ -191,23 +152,23 @@ public: /// address for all top level sections to be the section file address + /// offset. /// - /// @param[in] target + /// \param[in] target /// The target in which to apply the section load addresses. /// - /// @param[in] value + /// \param[in] value /// if \a value_is_offset is true, then value is the offset to /// apply to all file addresses for all top level sections in /// the object file as each section load address is being set. /// If \a value_is_offset is false, then "value" is the new /// absolute base address for the image. /// - /// @param[in] value_is_offset + /// \param[in] value_is_offset /// If \b true, then \a value is an offset to apply to each /// file address of each top level section. /// If \b false, then \a value is the image base address that /// will be used to rigidly slide all loadable sections. /// - /// @param[out] changed + /// \param[out] changed /// If any section load addresses were changed in \a target, /// then \a changed will be set to \b true. Else \a changed /// will be set to false. This allows this function to be @@ -216,18 +177,15 @@ public: /// be false and no module updated notification will need to /// be sent out. /// - /// @return + /// \return /// /b True if any sections were successfully loaded in \a target, /// /b false otherwise. - //------------------------------------------------------------------ bool SetLoadAddress(Target &target, lldb::addr_t value, bool value_is_offset, bool &changed); - //------------------------------------------------------------------ - /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*) + /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*) /// - /// @see SymbolContextScope - //------------------------------------------------------------------ + /// \see SymbolContextScope void CalculateSymbolContext(SymbolContext *sc) override; lldb::ModuleSP CalculateSymbolContextModule() override; @@ -236,7 +194,6 @@ public: GetDescription(Stream *s, lldb::DescriptionLevel level = lldb::eDescriptionLevelFull); - //------------------------------------------------------------------ /// Get the module path and object name. /// /// Modules can refer to object files. In this case the specification is @@ -252,12 +209,10 @@ public: /// There are many places where logging wants to log this fully qualified /// specification, so we centralize this functionality here. /// - /// @return + /// \return /// The object path + object name if there is one. - //------------------------------------------------------------------ std::string GetSpecificationDescription() const; - //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// /// Dump a description of the contents of this object to the supplied stream @@ -265,39 +220,34 @@ public: /// to this point at which this function is called, so this is a good way to /// see what has been parsed in a module. /// - /// @param[in] s + /// \param[in] s /// The stream to which to dump the object description. - //------------------------------------------------------------------ void Dump(Stream *s); - //------------------------------------------------------------------ - /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*) + /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*) /// - /// @see SymbolContextScope - //------------------------------------------------------------------ + /// \see SymbolContextScope void DumpSymbolContext(Stream *s) override; - //------------------------------------------------------------------ /// Find a symbol in the object file's symbol table. /// - /// @param[in] name + /// \param[in] name /// The name of the symbol that we are looking for. /// - /// @param[in] symbol_type + /// \param[in] symbol_type /// If set to eSymbolTypeAny, find a symbol of any type that /// has a name that matches \a name. If set to any other valid /// SymbolType enumeration value, then search only for /// symbols that match \a symbol_type. /// - /// @return + /// \return /// Returns a valid symbol pointer if a symbol was found, /// nullptr otherwise. - //------------------------------------------------------------------ const Symbol *FindFirstSymbolWithNameAndType( - const ConstString &name, + ConstString name, lldb::SymbolType symbol_type = lldb::eSymbolTypeAny); - size_t FindSymbolsWithNameAndType(const ConstString &name, + size_t FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list); @@ -305,132 +255,123 @@ public: lldb::SymbolType symbol_type, SymbolContextList &sc_list); - //------------------------------------------------------------------ /// Find a function symbols in the object file's symbol table. /// - /// @param[in] name + /// \param[in] name /// The name of the symbol that we are looking for. /// - /// @param[in] name_type_mask + /// \param[in] name_type_mask /// A mask that has one or more bitwise OR'ed values from the /// lldb::FunctionNameType enumeration type that indicate what /// kind of names we are looking for. /// - /// @param[out] sc_list + /// \param[out] sc_list /// A list to append any matching symbol contexts to. /// - /// @return + /// \return /// The number of symbol contexts that were added to \a sc_list - //------------------------------------------------------------------ - size_t FindFunctionSymbols(const ConstString &name, uint32_t name_type_mask, + size_t FindFunctionSymbols(ConstString name, uint32_t name_type_mask, SymbolContextList &sc_list); - //------------------------------------------------------------------ /// Find compile units by partial or full path. /// /// Finds all compile units that match \a path in all of the modules and /// returns the results in \a sc_list. /// - /// @param[in] path + /// \param[in] path /// The name of the function we are looking for. /// - /// @param[in] append + /// \param[in] append /// If \b true, then append any compile units that were found /// to \a sc_list. If \b false, then the \a sc_list is cleared /// and the contents of \a sc_list are replaced. /// - /// @param[out] sc_list + /// \param[out] sc_list /// A symbol context list that gets filled in with all of the /// matches. /// - /// @return + /// \return /// The number of matches added to \a sc_list. - //------------------------------------------------------------------ size_t FindCompileUnits(const FileSpec &path, bool append, SymbolContextList &sc_list); - //------------------------------------------------------------------ /// Find functions by name. /// /// If the function is an inlined function, it will have a block, /// representing the inlined function, and the function will be the /// containing function. If it is not inlined, then the block will be NULL. /// - /// @param[in] name + /// \param[in] name /// The name of the compile unit we are looking for. /// - /// @param[in] namespace_decl + /// \param[in] namespace_decl /// If valid, a namespace to search in. /// - /// @param[in] name_type_mask + /// \param[in] name_type_mask /// A bit mask of bits that indicate what kind of names should /// be used when doing the lookup. Bits include fully qualified /// names, base names, C++ methods, or ObjC selectors. /// See FunctionNameType for more details. /// - /// @param[in] append + /// \param[in] append /// If \b true, any matches will be appended to \a sc_list, else /// matches replace the contents of \a sc_list. /// - /// @param[out] sc_list + /// \param[out] sc_list /// A symbol context list that gets filled in with all of the /// matches. /// - /// @return + /// \return /// The number of matches added to \a sc_list. - //------------------------------------------------------------------ - size_t FindFunctions(const ConstString &name, + size_t FindFunctions(ConstString name, const CompilerDeclContext *parent_decl_ctx, lldb::FunctionNameType name_type_mask, bool symbols_ok, bool inlines_ok, bool append, SymbolContextList &sc_list); - //------------------------------------------------------------------ /// Find functions by name. /// /// If the function is an inlined function, it will have a block, /// representing the inlined function, and the function will be the /// containing function. If it is not inlined, then the block will be NULL. /// - /// @param[in] regex + /// \param[in] regex /// A regular expression to use when matching the name. /// - /// @param[in] append + /// \param[in] append /// If \b true, any matches will be appended to \a sc_list, else /// matches replace the contents of \a sc_list. /// - /// @param[out] sc_list + /// \param[out] sc_list /// A symbol context list that gets filled in with all of the /// matches. /// - /// @return + /// \return /// The number of matches added to \a sc_list. - //------------------------------------------------------------------ size_t FindFunctions(const RegularExpression ®ex, bool symbols_ok, bool inlines_ok, bool append, SymbolContextList &sc_list); - //------------------------------------------------------------------ /// Find addresses by file/line /// - /// @param[in] target_sp + /// \param[in] target_sp /// The target the addresses are desired for. /// - /// @param[in] file + /// \param[in] file /// Source file to locate. /// - /// @param[in] line + /// \param[in] line /// Source line to locate. /// - /// @param[in] function + /// \param[in] function /// Optional filter function. Addresses within this function will be /// added to the 'local' list. All others will be added to the 'extern' /// list. /// - /// @param[out] output_local + /// \param[out] output_local /// All matching addresses within 'function' /// - /// @param[out] output_extern + /// \param[out] output_extern /// All matching addresses not within 'function' void FindAddressesForLine(const lldb::TargetSP target_sp, const FileSpec &file, uint32_t line, @@ -438,50 +379,45 @@ public: std::vector<Address> &output_local, std::vector<Address> &output_extern); - //------------------------------------------------------------------ /// Find global and static variables by name. /// - /// @param[in] name + /// \param[in] name /// The name of the global or static variable we are looking /// for. /// - /// @param[in] parent_decl_ctx + /// \param[in] parent_decl_ctx /// If valid, a decl context that results must exist within /// - /// @param[in] max_matches + /// \param[in] max_matches /// Allow the number of matches to be limited to \a /// max_matches. Specify UINT32_MAX to get all possible matches. /// - /// @param[in] variable_list + /// \param[in] variable_list /// A list of variables that gets the matches appended to. /// - /// @return + /// \return /// The number of matches added to \a variable_list. - //------------------------------------------------------------------ - size_t FindGlobalVariables(const ConstString &name, + size_t FindGlobalVariables(ConstString name, const CompilerDeclContext *parent_decl_ctx, size_t max_matches, VariableList &variable_list); - //------------------------------------------------------------------ /// Find global and static variables by regular expression. /// - /// @param[in] regex + /// \param[in] regex /// A regular expression to use when matching the name. /// - /// @param[in] max_matches + /// \param[in] max_matches /// Allow the number of matches to be limited to \a /// max_matches. Specify UINT32_MAX to get all possible matches. /// - /// @param[in] variable_list + /// \param[in] variable_list /// A list of variables that gets the matches appended to. /// - /// @return + /// \return /// The number of matches added to \a variable_list. - //------------------------------------------------------------------ size_t FindGlobalVariables(const RegularExpression ®ex, size_t max_matches, VariableList &variable_list); - //------------------------------------------------------------------ /// Find types by name. /// /// Type lookups in modules go through the SymbolVendor (which will use one @@ -499,74 +435,66 @@ public: /// have to specify complete scoping on all expressions, but it also allows /// for exact matching when required. /// - /// @param[in] type_name + /// \param[in] type_name /// The name of the type we are looking for that is a fully /// or partially qualified type name. /// - /// @param[in] exact_match + /// \param[in] exact_match /// If \b true, \a type_name is fully qualified and must match /// exactly. If \b false, \a type_name is a partially qualified /// name where the leading namespaces or classes can be /// omitted to make finding types that a user may type /// easier. /// - /// @param[out] type_list + /// \param[out] type_list /// A type list gets populated with any matches. /// - /// @return + /// \return /// The number of matches added to \a type_list. - //------------------------------------------------------------------ size_t - FindTypes(const ConstString &type_name, bool exact_match, size_t max_matches, + FindTypes(ConstString type_name, bool exact_match, size_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeList &types); lldb::TypeSP FindFirstType(const SymbolContext &sc, - const ConstString &type_name, bool exact_match); + ConstString type_name, bool exact_match); - //------------------------------------------------------------------ /// Find types by name that are in a namespace. This function is used by the /// expression parser when searches need to happen in an exact namespace /// scope. /// - /// @param[in] type_name + /// \param[in] type_name /// The name of a type within a namespace that should not include /// any qualifying namespaces (just a type basename). /// - /// @param[in] namespace_decl + /// \param[in] namespace_decl /// The namespace declaration that this type must exist in. /// - /// @param[out] type_list + /// \param[out] type_list /// A type list gets populated with any matches. /// - /// @return + /// \return /// The number of matches added to \a type_list. - //------------------------------------------------------------------ - size_t FindTypesInNamespace(const ConstString &type_name, + size_t FindTypesInNamespace(ConstString type_name, const CompilerDeclContext *parent_decl_ctx, size_t max_matches, TypeList &type_list); - //------------------------------------------------------------------ /// Get const accessor for the module architecture. /// - /// @return + /// \return /// A const reference to the architecture object. - //------------------------------------------------------------------ const ArchSpec &GetArchitecture() const; - //------------------------------------------------------------------ /// Get const accessor for the module file specification. /// /// This function returns the file for the module on the host system that is /// running LLDB. This can differ from the path on the platform since we /// might be doing remote debugging. /// - /// @return + /// \return /// A const reference to the file specification object. - //------------------------------------------------------------------ const FileSpec &GetFileSpec() const { return m_file; } - //------------------------------------------------------------------ /// Get accessor for the module platform file specification. /// /// Platform file refers to the path of the module as it is known on the @@ -577,9 +505,8 @@ public: /// "/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib" The /// file could also be cached in a local developer kit directory. /// - /// @return + /// \return /// A const reference to the file specification object. - //------------------------------------------------------------------ const FileSpec &GetPlatformFileSpec() const { if (m_platform_file) return m_platform_file; @@ -614,63 +541,54 @@ public: m_mod_time = mod_time; } - //------------------------------------------------------------------ /// Tells whether this module is capable of being the main executable for a /// process. /// - /// @return + /// \return /// \b true if it is, \b false otherwise. - //------------------------------------------------------------------ bool IsExecutable(); - //------------------------------------------------------------------ /// Tells whether this module has been loaded in the target passed in. This /// call doesn't distinguish between whether the module is loaded by the /// dynamic loader, or by a "target module add" type call. /// - /// @param[in] target + /// \param[in] target /// The target to check whether this is loaded in. /// - /// @return + /// \return /// \b true if it is, \b false otherwise. - //------------------------------------------------------------------ bool IsLoadedInTarget(Target *target); bool LoadScriptingResourceInTarget(Target *target, Status &error, Stream *feedback_stream = nullptr); - //------------------------------------------------------------------ /// Get the number of compile units for this module. /// - /// @return + /// \return /// The number of compile units that the symbol vendor plug-in /// finds. - //------------------------------------------------------------------ size_t GetNumCompileUnits(); lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx); - const ConstString &GetObjectName() const; + ConstString GetObjectName() const; uint64_t GetObjectOffset() const { return m_object_offset; } - //------------------------------------------------------------------ /// Get the object file representation for the current architecture. /// /// If the object file has not been located or parsed yet, this function /// will find the best ObjectFile plug-in that can parse Module::m_file. /// - /// @return + /// \return /// If Module::m_file does not exist, or no plug-in was found /// that can parse the file, or the object file doesn't contain /// the current architecture in Module::m_arch, nullptr will be /// returned, else a valid object file interface will be /// returned. The returned pointer is owned by this object and /// remains valid as long as the object is around. - //------------------------------------------------------------------ virtual ObjectFile *GetObjectFile(); - //------------------------------------------------------------------ /// Get the unified section list for the module. This is the section list /// created by the module's object file and any debug info and symbol files /// created by the symbol vendor. @@ -678,12 +596,10 @@ public: /// If the symbol vendor has not been loaded yet, this function will return /// the section list for the object file. /// - /// @return + /// \return /// Unified module section list. - //------------------------------------------------------------------ virtual SectionList *GetSectionList(); - //------------------------------------------------------------------ /// Notify the module that the file addresses for the Sections have been /// updated. /// @@ -691,12 +607,23 @@ public: /// should be called. Any parts of the module, object file, or symbol file /// that has cached those file addresses must invalidate or update its /// cache. - //------------------------------------------------------------------ virtual void SectionFileAddressesChanged(); + /// Returns a reference to the UnwindTable for this Module + /// + /// The UnwindTable contains FuncUnwinders objects for any function in this + /// Module. If a FuncUnwinders object hasn't been created yet (i.e. the + /// function has yet to be unwound in a stack walk), it will be created when + /// requested. Specifically, we do not create FuncUnwinders objects for + /// functions until they are needed. + /// + /// \return + /// Returns the unwind table for this module. If this object has no + /// associated object file, an empty UnwindTable is returned. + UnwindTable &GetUnwindTable(); + llvm::VersionTuple GetVersion(); - //------------------------------------------------------------------ /// Load an object file from memory. /// /// If available, the size of the object file in memory may be passed to @@ -705,54 +632,46 @@ public: /// enable the ObjectFile plugins to read the header of the object file /// without going back to the process. /// - /// @return + /// \return /// The object file loaded from memory or nullptr, if the operation /// failed (see the `error` for more information in that case). - //------------------------------------------------------------------ ObjectFile *GetMemoryObjectFile(const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, Status &error, size_t size_to_read = 512); - //------------------------------------------------------------------ /// Get the symbol vendor interface for the current architecture. /// /// If the symbol vendor file has not been located yet, this function will /// find the best SymbolVendor plug-in that can use the current object file. /// - /// @return + /// \return /// If this module does not have a valid object file, or no /// plug-in can be found that can use the object file, nullptr will /// be returned, else a valid symbol vendor plug-in interface /// will be returned. The returned pointer is owned by this /// object and remains valid as long as the object is around. - //------------------------------------------------------------------ virtual SymbolVendor * GetSymbolVendor(bool can_create = true, lldb_private::Stream *feedback_strm = nullptr); - //------------------------------------------------------------------ /// Get accessor the type list for this module. /// - /// @return + /// \return /// A valid type list pointer, or nullptr if there is no valid /// symbol vendor for this module. - //------------------------------------------------------------------ TypeList *GetTypeList(); - //------------------------------------------------------------------ /// Get a reference to the UUID value contained in this object. /// /// If the executable image file doesn't not have a UUID value built into /// the file format, an MD5 checksum of the entire file, or slice of the /// file for the current architecture should be used. /// - /// @return + /// \return /// A const pointer to the internal copy of the UUID value in /// this module if this module has a valid UUID value, NULL /// otherwise. - //------------------------------------------------------------------ const lldb_private::UUID &GetUUID(); - //------------------------------------------------------------------ /// A debugging function that will cause everything in a module to /// be parsed. /// @@ -763,12 +682,10 @@ public: /// complete list of the resulting debug information that gets parsed, or as /// a debug function to ensure that the module can consume all of the debug /// data the symbol vendor provides. - //------------------------------------------------------------------ void ParseAllDebugSymbols(); bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr); - //------------------------------------------------------------------ /// Resolve the symbol context for the given address. /// /// Tries to resolve the matching symbol context based on a lookup from the @@ -782,10 +699,10 @@ public: /// line entry. Use the return value to determine which of these properties /// have been modified. /// - /// @param[in] so_addr + /// \param[in] so_addr /// A load address to resolve. /// - /// @param[in] resolve_scope + /// \param[in] resolve_scope /// The scope that should be resolved (see SymbolContext::Scope). /// A combination of flags from the enumeration SymbolContextItem /// requesting a resolution depth. Note that the flags that are @@ -794,24 +711,22 @@ public: /// eSymbolContextModule, and eSymbolContextFunction requires /// eSymbolContextSymbol. /// - /// @param[out] sc + /// \param[out] sc /// The SymbolContext that is modified based on symbol resolution. /// - /// @param[in] resolve_tail_call_address + /// \param[in] resolve_tail_call_address /// Determines if so_addr should resolve to a symbol in the case /// of a function whose last instruction is a call. In this case, /// the PC can be one past the address range of the function. /// - /// @return + /// \return /// The scope that has been resolved (see SymbolContext::Scope). /// - /// @see SymbolContext::Scope - //------------------------------------------------------------------ + /// \see SymbolContext::Scope uint32_t ResolveSymbolContextForAddress( const Address &so_addr, lldb::SymbolContextItem resolve_scope, SymbolContext &sc, bool resolve_tail_call_address = false); - //------------------------------------------------------------------ /// Resolve items in the symbol context for a given file and line. /// /// Tries to resolve \a file_path and \a line to a list of matching symbol @@ -823,40 +738,38 @@ public: /// to only what is needed -- typically the module, compile unit, line table /// and line table entry are sufficient. /// - /// @param[in] file_path + /// \param[in] file_path /// A path to a source file to match. If \a file_path does not /// specify a directory, then this query will match all files /// whose base filename matches. If \a file_path does specify /// a directory, the fullpath to the file must match. /// - /// @param[in] line + /// \param[in] line /// The source line to match, or zero if just the compile unit /// should be resolved. /// - /// @param[in] check_inlines + /// \param[in] check_inlines /// Check for inline file and line number matches. This option /// should be used sparingly as it will cause all line tables /// for every compile unit to be parsed and searched for /// matching inline file entries. /// - /// @param[in] resolve_scope + /// \param[in] resolve_scope /// The scope that should be resolved (see /// SymbolContext::Scope). /// - /// @param[out] sc_list + /// \param[out] sc_list /// A symbol context list that gets matching symbols contexts /// appended to. /// - /// @return + /// \return /// The number of matches that were added to \a sc_list. /// - /// @see SymbolContext::Scope - //------------------------------------------------------------------ + /// \see SymbolContext::Scope uint32_t ResolveSymbolContextForFilePath( const char *file_path, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list); - //------------------------------------------------------------------ /// Resolve items in the symbol context for a given file and line. /// /// Tries to resolve \a file_spec and \a line to a list of matching symbol @@ -868,42 +781,41 @@ public: /// to only what is needed -- typically the module, compile unit, line table /// and line table entry are sufficient. /// - /// @param[in] file_spec + /// \param[in] file_spec /// A file spec to a source file to match. If \a file_path does /// not specify a directory, then this query will match all /// files whose base filename matches. If \a file_path does /// specify a directory, the fullpath to the file must match. /// - /// @param[in] line + /// \param[in] line /// The source line to match, or zero if just the compile unit /// should be resolved. /// - /// @param[in] check_inlines + /// \param[in] check_inlines /// Check for inline file and line number matches. This option /// should be used sparingly as it will cause all line tables /// for every compile unit to be parsed and searched for /// matching inline file entries. /// - /// @param[in] resolve_scope + /// \param[in] resolve_scope /// The scope that should be resolved (see /// SymbolContext::Scope). /// - /// @param[out] sc_list + /// \param[out] sc_list /// A symbol context list that gets filled in with all of the /// matches. /// - /// @return + /// \return /// A integer that contains SymbolContext::Scope bits set for /// each item that was successfully resolved. /// - /// @see SymbolContext::Scope - //------------------------------------------------------------------ + /// \see SymbolContext::Scope uint32_t ResolveSymbolContextsForFileSpec( const FileSpec &file_spec, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list); void SetFileSpecAndObjectName(const FileSpec &file, - const ConstString &object_name); + ConstString object_name); bool GetIsDynamicLinkEditor(); @@ -931,17 +843,13 @@ public: void ReportErrorIfModifyDetected(const char *format, ...) __attribute__((format(printf, 2, 3))); - //------------------------------------------------------------------ // Return true if the file backing this module has changed since the module // was originally created since we saved the initial file modification time // when the module first gets created. - //------------------------------------------------------------------ bool FileHasChanged() const; - //------------------------------------------------------------------ // SymbolVendor, SymbolFile and ObjectFile member objects should lock the // module mutex to avoid deadlocks. - //------------------------------------------------------------------ std::recursive_mutex &GetMutex() const { return m_mutex; } PathMappingList &GetSourceMappingList() { return m_source_mappings; } @@ -950,7 +858,6 @@ public: return m_source_mappings; } - //------------------------------------------------------------------ /// Finds a source file given a file spec using the module source path /// remappings (if any). /// @@ -959,41 +866,37 @@ public: /// if the remappings are on a network file system, so use this function /// sparingly (not in a tight debug info parsing loop). /// - /// @param[in] orig_spec + /// \param[in] orig_spec /// The original source file path to try and remap. /// - /// @param[out] new_spec + /// \param[out] new_spec /// The newly remapped filespec that is guaranteed to exist. /// - /// @return + /// \return /// /b true if \a orig_spec was successfully located and /// \a new_spec is filled in with an existing file spec, /// \b false otherwise. - //------------------------------------------------------------------ bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const; - //------------------------------------------------------------------ /// Remaps a source file given \a path into \a new_path. /// /// Remaps \a path if any source remappings match. This function does NOT /// stat the file system so it can be used in tight loops where debug info /// is being parsed. /// - /// @param[in] path + /// \param[in] path /// The original source file path to try and remap. /// - /// @param[out] new_path + /// \param[out] new_path /// The newly remapped filespec that is may or may not exist. /// - /// @return + /// \return /// /b true if \a path was successfully located and \a new_path /// is filled in with a new source path, \b false otherwise. - //------------------------------------------------------------------ bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const; bool RemapSourceFile(const char *, std::string &) const = delete; - //---------------------------------------------------------------------- - /// @class LookupInfo Module.h "lldb/Core/Module.h" + /// \class LookupInfo Module.h "lldb/Core/Module.h" /// A class that encapsulates name lookup information. /// /// Users can type a wide variety of partial names when setting breakpoints @@ -1014,7 +917,6 @@ public: /// Function lookups are done in Module.cpp, ModuleList.cpp and in /// BreakpointResolverName.cpp and they all now use this class to do lookups /// correctly. - //---------------------------------------------------------------------- class LookupInfo { public: LookupInfo() @@ -1022,16 +924,16 @@ public: m_name_type_mask(lldb::eFunctionNameTypeNone), m_match_name_after_lookup(false) {} - LookupInfo(const ConstString &name, lldb::FunctionNameType name_type_mask, + LookupInfo(ConstString name, lldb::FunctionNameType name_type_mask, lldb::LanguageType language); - const ConstString &GetName() const { return m_name; } + ConstString GetName() const { return m_name; } - void SetName(const ConstString &name) { m_name = name; } + void SetName(ConstString name) { m_name = name; } - const ConstString &GetLookupName() const { return m_lookup_name; } + ConstString GetLookupName() const { return m_lookup_name; } - void SetLookupName(const ConstString &name) { m_lookup_name = name; } + void SetLookupName(ConstString name) { m_lookup_name = name; } lldb::FunctionNameType GetNameTypeMask() const { return m_name_type_mask; } @@ -1061,9 +963,7 @@ public: }; protected: - //------------------------------------------------------------------ // Member Variables - //------------------------------------------------------------------ mutable std::recursive_mutex m_mutex; ///< A mutex to keep this object happy ///in multi-threaded environments. @@ -1091,8 +991,11 @@ protected: lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file ///parser for this module as it may or may ///not be shared with the SymbolFile + llvm::Optional<UnwindTable> m_unwind_table; ///< Table of FuncUnwinders + /// objects created for this + /// Module's functions lldb::SymbolVendorUP - m_symfile_ap; ///< A pointer to the symbol vendor for this module. + m_symfile_up; ///< A pointer to the symbol vendor for this module. std::vector<lldb::SymbolVendorUP> m_old_symfiles; ///< If anyone calls Module::SetSymbolFileFileSpec() and ///changes the symbol file, @@ -1104,9 +1007,9 @@ protected: ///when you have debug info for a module ///that doesn't match where the sources ///currently are - lldb::SectionListUP m_sections_ap; ///< Unified section list for module that - ///is used by the ObjectFile and and - ///ObjectFile instances for the debug info + lldb::SectionListUP m_sections_up; ///< Unified section list for module that + /// is used by the ObjectFile and and + /// ObjectFile instances for the debug info std::atomic<bool> m_did_load_objfile{false}; std::atomic<bool> m_did_load_symbol_vendor{false}; @@ -1115,7 +1018,6 @@ protected: m_first_file_changed_log : 1; /// See if the module was modified after it /// was initially opened. - //------------------------------------------------------------------ /// Resolve a file or load virtual address. /// /// Tries to resolve \a vm_addr as a file address (if \a @@ -1124,31 +1026,30 @@ protected: /// indicates what clients wish to resolve and can be used to limit the /// scope of what is parsed. /// - /// @param[in] vm_addr + /// \param[in] vm_addr /// The load virtual address to resolve. /// - /// @param[in] vm_addr_is_file_addr + /// \param[in] vm_addr_is_file_addr /// If \b true, \a vm_addr is a file address, else \a vm_addr /// if a load address. /// - /// @param[in] resolve_scope + /// \param[in] resolve_scope /// The scope that should be resolved (see /// SymbolContext::Scope). /// - /// @param[out] so_addr + /// \param[out] so_addr /// The section offset based address that got resolved if /// any bits are returned. /// - /// @param[out] sc + /// \param[out] sc // The symbol context that has objects filled in. Each bit /// in the \a resolve_scope pertains to a member in the \a sc. /// - /// @return + /// \return /// A integer that contains SymbolContext::Scope bits set for /// each item that was successfully resolved. /// - /// @see SymbolContext::Scope - //------------------------------------------------------------------ + /// \see SymbolContext::Scope uint32_t ResolveSymbolContextForAddress(lldb::addr_t vm_addr, bool vm_addr_is_file_addr, lldb::SymbolContextItem resolve_scope, @@ -1172,7 +1073,7 @@ private: Module(); // Only used internally by CreateJITModule () size_t FindTypes_Impl( - const ConstString &name, const CompilerDeclContext *parent_decl_ctx, + ConstString name, const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap &types); |