diff options
Diffstat (limited to 'include/lldb/Symbol')
28 files changed, 702 insertions, 841 deletions
diff --git a/include/lldb/Symbol/Block.h b/include/lldb/Symbol/Block.h index a5387cca21c5..1664362431f9 100644 --- a/include/lldb/Symbol/Block.h +++ b/include/lldb/Symbol/Block.h @@ -30,21 +30,21 @@ namespace lldb_private { //---------------------------------------------------------------------- /// @class Block Block.h "lldb/Symbol/Block.h" -/// @brief A class that describes a single lexical block. +/// A class that describes a single lexical block. /// /// A Function object owns a BlockList object which owns one or more -/// Block objects. The BlockList object contains a section offset -/// address range, and Block objects contain one or more ranges -/// which are offsets into that range. Blocks are can have discontiguous -/// ranges within the BlockList address range, and each block can -/// contain child blocks each with their own sets of ranges. +/// Block objects. The BlockList object contains a section offset address +/// range, and Block objects contain one or more ranges which are offsets into +/// that range. Blocks are can have discontiguous ranges within the BlockList +/// address range, and each block can contain child blocks each with their own +/// sets of ranges. /// -/// Each block has a variable list that represents local, argument, and -/// static variables that are scoped to the block. +/// Each block has a variable list that represents local, argument, and static +/// variables that are scoped to the block. /// -/// Inlined functions are represented by attaching a -/// InlineFunctionInfo shared pointer object to a block. Inlined -/// functions are represented as named blocks. +/// Inlined functions are represented by attaching a InlineFunctionInfo shared +/// pointer object to a block. Inlined functions are represented as named +/// blocks. //---------------------------------------------------------------------- class Block : public UserID, public SymbolContextScope { public: @@ -54,10 +54,9 @@ public: //------------------------------------------------------------------ /// Construct with a User ID \a uid, \a depth. /// - /// Initialize this block with the specified UID \a uid. The - /// \a depth in the \a block_list is used to represent the parent, - /// sibling, and child block information and also allows for partial - /// parsing at the block level. + /// Initialize this block with the specified UID \a uid. The \a depth in the + /// \a block_list is used to represent the parent, sibling, and child block + /// information and also allows for partial parsing at the block level. /// /// @param[in] uid /// The UID for a given block. This value is given by the @@ -146,8 +145,7 @@ public: bool Contains(const Range &range) const; //------------------------------------------------------------------ - /// Check if this object contains "block" as a child block at any - /// depth. + /// Check if this object contains "block" as a child block at any depth. /// /// @param[in] block /// A potential child block. @@ -256,8 +254,8 @@ public: lldb::VariableListSP GetBlockVariableList(bool can_create); //------------------------------------------------------------------ - /// Get the variable list for this block and optionally all child - /// blocks if \a get_child_variables is \b true. + /// Get the variable list for this block and optionally all child blocks if + /// \a get_child_variables is \b true. /// /// @param[in] get_child_variables /// If \b true, all variables from all child blocks will be @@ -286,8 +284,8 @@ public: VariableList *variable_list); //------------------------------------------------------------------ - /// Appends the variables from this block, and optionally from all - /// parent blocks, to \a variable_list. + /// Appends the variables from this block, and optionally from all parent + /// blocks, to \a variable_list. /// /// @param[in] can_create /// If \b true, the variables can be parsed if they already @@ -334,8 +332,8 @@ public: //------------------------------------------------------------------ /// Get the memory cost of this object. /// - /// Returns the cost of this object plus any owned objects from the - /// ranges, variables, and inline function information. + /// Returns the cost of this object plus any owned objects from the ranges, + /// variables, and inline function information. /// /// @return /// The number of bytes that this object occupies in memory. @@ -374,9 +372,8 @@ public: //------------------------------------------------------------------ /// 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. + /// 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. /// /// @param[in] variable_list_sp /// A shared pointer to a VariableList. @@ -403,8 +400,8 @@ public: uint32_t GetRangeIndexContainingAddress(const Address &addr); //------------------------------------------------------------------ - // Since blocks might have multiple discontiguous address ranges, - // we need to be able to get at any of the address ranges in a block. + // Since blocks might have multiple discontiguous address ranges, we need to + // be able to get at any of the address ranges in a block. //------------------------------------------------------------------ bool GetRangeAtIndex(uint32_t range_idx, AddressRange &range); diff --git a/include/lldb/Symbol/ClangASTContext.h b/include/lldb/Symbol/ClangASTContext.h index 2d2c804eb025..9364149d98e7 100644 --- a/include/lldb/Symbol/ClangASTContext.h +++ b/include/lldb/Symbol/ClangASTContext.h @@ -253,6 +253,9 @@ public: &type_fields, bool packed = false); + static bool IsOperator(const char *name, + clang::OverloadedOperatorKind &op_kind); + //------------------------------------------------------------------ // Structure, Unions, Classes //------------------------------------------------------------------ @@ -302,6 +305,9 @@ public: lldb::AccessType access_type, const char *class_name, int kind, const TemplateParameterInfos &infos); + clang::TemplateTemplateParmDecl * + CreateTemplateTemplateParmDecl(const char *template_name); + clang::ClassTemplateSpecializationDecl *CreateClassTemplateSpecializationDecl( clang::DeclContext *decl_ctx, clang::ClassTemplateDecl *class_template_decl, int kind, @@ -632,8 +638,7 @@ public: //---------------------------------------------------------------------- // Using the current type, create a new typedef to that type using - // "typedef_name" - // as the name and "decl_ctx" as the decl context. + // "typedef_name" as the name and "decl_ctx" as the decl context. static CompilerType CreateTypedefType(const CompilerType &type, const char *typedef_name, const CompilerDeclContext &compiler_decl_ctx); @@ -650,8 +655,7 @@ public: GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override; // Returns -1 if this isn't a function of if the function doesn't have a - // prototype - // Returns a value >= 0 if there is a prototype. + // prototype Returns a value >= 0 if there is a prototype. int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override; CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type, @@ -763,8 +767,8 @@ public: bool &child_is_base_class, bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags) override; - // Lookup a child given a name. This function will match base class names - // and member member names in "clang_type" only, not descendants. + // Lookup a child given a name. This function will match base class names and + // member member names in "clang_type" only, not descendants. uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes) override; @@ -794,8 +798,8 @@ public: CompilerType GetTypeForFormatters(void *type) override; #define LLDB_INVALID_DECL_LEVEL UINT32_MAX - // LLDB_INVALID_DECL_LEVEL is returned by CountDeclLevels if - // child_decl_ctx could not be found in decl_ctx. + // LLDB_INVALID_DECL_LEVEL is returned by CountDeclLevels if child_decl_ctx + // could not be found in decl_ctx. uint32_t CountDeclLevels(clang::DeclContext *frame_decl_ctx, clang::DeclContext *child_decl_ctx, ConstString *child_name = nullptr, @@ -821,6 +825,7 @@ public: clang::CXXMethodDecl * AddMethodToCXXRecordType(lldb::opaque_compiler_type_t type, const char *name, + const char *mangled_name, const CompilerType &method_type, lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline, bool is_explicit, @@ -885,13 +890,13 @@ public: // Pointers & References //------------------------------------------------------------------ - // Call this function using the class type when you want to make a - // member pointer type to pointee_type. + // Call this function using the class type when you want to make a member + // pointer type to pointee_type. static CompilerType CreateMemberPointerType(const CompilerType &type, const CompilerType &pointee_type); - // Converts "s" to a floating point value and place resulting floating - // point bytes in the "dst" buffer. + // Converts "s" to a floating point value and place resulting floating point + // bytes in the "dst" buffer. size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, const char *s, uint8_t *dst, size_t dst_size) override; diff --git a/include/lldb/Symbol/ClangASTImporter.h b/include/lldb/Symbol/ClangASTImporter.h index 6823ad748282..52a164a1d2dd 100644 --- a/include/lldb/Symbol/ClangASTImporter.h +++ b/include/lldb/Symbol/ClangASTImporter.h @@ -250,13 +250,12 @@ private: // recorded and placed into the decls_to_deport set. // // A call to "ExecuteDeportWorkQueues" completes all the Decls that - // are in decls_to_deport, adding any Decls it sees along the way that - // it hasn't already deported. It proceeds until decls_to_deport is - // empty. + // are in decls_to_deport, adding any Decls it sees along the way that it + // hasn't already deported. It proceeds until decls_to_deport is empty. // - // These calls must be paired. Leaving a minion in deport mode or - // trying to start deport minion with a new pair of queues will result - // in an assertion failure. + // These calls must be paired. Leaving a minion in deport mode or trying + // to start deport minion with a new pair of queues will result in an + // assertion failure. void InitDeportWorkQueues(std::set<clang::NamedDecl *> *decls_to_deport, diff --git a/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h b/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h index 61bbc122dd5f..ef0010314e1d 100644 --- a/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h +++ b/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h @@ -60,21 +60,21 @@ public: //------------------------------------------------------------------ clang::Decl *GetExternalDecl(uint32_t ID) override { - // This method only needs to be implemented if the AST source ever - // passes back decl sets as VisibleDeclaration objects. + // This method only needs to be implemented if the AST source ever passes + // back decl sets as VisibleDeclaration objects. return nullptr; } clang::Stmt *GetExternalDeclStmt(uint64_t Offset) override { - // This operation is meant to be used via a LazyOffsetPtr. It only - // needs to be implemented if the AST source uses methods like + // This operation is meant to be used via a LazyOffsetPtr. It only needs + // to be implemented if the AST source uses methods like // FunctionDecl::setLazyBody when building decls. return nullptr; } clang::Selector GetExternalSelector(uint32_t ID) override { - // This operation only needs to be implemented if the AST source - // returns non-zero for GetNumKnownSelectors(). + // This operation only needs to be implemented if the AST source returns + // non-zero for GetNumKnownSelectors(). return clang::Selector(); } diff --git a/include/lldb/Symbol/CompactUnwindInfo.h b/include/lldb/Symbol/CompactUnwindInfo.h index 630067241735..711420f66a46 100644 --- a/include/lldb/Symbol/CompactUnwindInfo.h +++ b/include/lldb/Symbol/CompactUnwindInfo.h @@ -22,23 +22,18 @@ namespace lldb_private { // Compact Unwind info is an unwind format used on Darwin. The unwind -// instructions -// for typical compiler-generated functions can be expressed in a 32-bit -// encoding. -// The format includes a two-level index so the unwind information for a -// function -// can be found by two binary searches in the section. It can represent both -// stack frames that use a frame-pointer register and frameless functions, on -// i386/x86_64 for instance. When a function is too complex to be represented -// in -// the compact unwind format, it calls out to eh_frame unwind instructions. +// instructions for typical compiler-generated functions can be expressed in a +// 32-bit encoding. The format includes a two-level index so the unwind +// information for a function can be found by two binary searches in the +// section. It can represent both stack frames that use a frame-pointer +// register and frameless functions, on i386/x86_64 for instance. When a +// function is too complex to be represented in the compact unwind format, it +// calls out to eh_frame unwind instructions. // On Mac OS X / iOS, a function will have either a compact unwind -// representation -// or an eh_frame representation. If lldb is going to benefit from the -// compiler's -// description about saved register locations, it must be able to read both -// sources of information. +// representation or an eh_frame representation. If lldb is going to benefit +// from the compiler's description about saved register locations, it must be +// able to read both sources of information. class CompactUnwindInfo { public: @@ -54,9 +49,8 @@ private: // The top level index entries of the compact unwind info // (internal representation of struct // unwind_info_section_header_index_entry) - // There are relatively few of these (one per 500/1000 functions, depending on - // format) so - // creating them on first scan will not be too costly. + // There are relatively few of these (one per 500/1000 functions, depending + // on format) so creating them on first scan will not be too costly. struct UnwindIndex { uint32_t function_offset; // The offset of the first function covered by // this index @@ -84,8 +78,7 @@ private: }; // An internal object used to store the information we retrieve about a - // function -- - // the encoding bits and possibly the LSDA/personality function. + // function -- the encoding bits and possibly the LSDA/personality function. struct FunctionInfo { uint32_t encoding; // compact encoding 32-bit value for this function Address lsda_address; // the address of the LSDA data for this function diff --git a/include/lldb/Symbol/CompileUnit.h b/include/lldb/Symbol/CompileUnit.h index e7a1ebc8c00f..b816439cee13 100644 --- a/include/lldb/Symbol/CompileUnit.h +++ b/include/lldb/Symbol/CompileUnit.h @@ -21,16 +21,16 @@ namespace lldb_private { //---------------------------------------------------------------------- /// @class CompileUnit CompileUnit.h "lldb/Symbol/CompileUnit.h" -/// @brief A class that describes a compilation unit. +/// 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. +/// 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. +/// 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. //---------------------------------------------------------------------- class CompileUnit : public std::enable_shared_from_this<CompileUnit>, public ModuleChild, @@ -41,9 +41,9 @@ public: //------------------------------------------------------------------ /// Construct with a module, path, UID and language. /// - /// Initialize the compile unit given the owning \a module, a path - /// to convert into a FileSpec, the SymbolFile plug-in supplied - /// \a uid, and the source language type. + /// Initialize the compile unit given the owning \a module, a path to + /// convert into a FileSpec, the SymbolFile plug-in supplied \a uid, and the + /// source language type. /// /// @param[in] module /// The parent module that owns this compile unit. This value @@ -81,9 +81,9 @@ public: //------------------------------------------------------------------ /// Construct with a module, file spec, UID and language. /// - /// Initialize the compile unit given the owning \a module, a path - /// to convert into a FileSpec, the SymbolFile plug-in supplied - /// \a uid, and the source language type. + /// Initialize the compile unit given the owning \a module, a path to + /// convert into a FileSpec, the SymbolFile plug-in supplied \a uid, and the + /// source language type. /// /// @param[in] module /// The parent module that owns this compile unit. This value @@ -127,8 +127,8 @@ public: //------------------------------------------------------------------ /// Add a function to this compile unit. /// - /// Typically called by the SymbolFile plug-ins as they partially - /// parse the debug information. + /// Typically called by the SymbolFile plug-ins as they partially parse the + /// debug information. /// /// @param[in] function_sp /// A shared pointer to the Function object. @@ -163,13 +163,12 @@ public: void GetDescription(Stream *s, lldb::DescriptionLevel level) const; //------------------------------------------------------------------ - /// Get a shared pointer to a function in this compile unit by - /// index. + /// Get a shared pointer to a function in this compile unit by index. /// - /// Typically called when iterating though all functions in a - /// compile unit after all functions have been parsed. This provides - /// raw access to the function shared pointer list and will not - /// cause the SymbolFile plug-in to parse any unparsed functions. + /// Typically called when iterating though all functions in a compile unit + /// after all functions have been parsed. This provides raw access to the + /// function shared pointer list and will not cause the SymbolFile plug-in + /// to parse any unparsed functions. /// /// @param[in] idx /// An index into the function list. @@ -195,16 +194,15 @@ public: //------------------------------------------------------------------ /// Find the line entry by line and optional inlined file spec. /// - /// Finds the first line entry that has an index greater than - /// \a start_idx that matches \a line. If \a file_spec_ptr - /// is NULL, then the search matches line entries whose file matches - /// the file for the compile unit. If \a file_spec_ptr is - /// not NULL, line entries must match the specified file spec (for - /// inlined line table entries). + /// Finds the first line entry that has an index greater than \a start_idx + /// that matches \a line. If \a file_spec_ptr is NULL, then the search + /// matches line entries whose file matches the file for the compile unit. + /// If \a 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 \a start_idx equal to zero, - /// and calling this function back with the return value + 1. + /// Multiple calls to this function can find all entries that match a given + /// file and line by starting with \a start_idx equal to zero, and calling + /// this function back with the return value + 1. /// /// @param[in] start_idx /// The zero based index at which to start looking for matches. @@ -237,10 +235,9 @@ public: //------------------------------------------------------------------ /// Get the line table for the compile unit. /// - /// Called by clients and the SymbolFile plug-in. The SymbolFile - /// plug-ins use this function to determine if the line table has - /// be parsed yet. Clients use this function to get the line table - /// from a compile unit. + /// Called by clients and the SymbolFile plug-in. The SymbolFile plug-ins + /// use this function to determine if the line table has be parsed yet. + /// Clients use this function to get the line table from a compile unit. /// /// @return /// The line table object pointer, or NULL if this line table @@ -253,8 +250,8 @@ public: //------------------------------------------------------------------ /// Get the compile unit's support file list. /// - /// The support file list is used by the line table, and any objects - /// that have valid Declaration objects. + /// The support file list is used by the line table, and any objects that + /// have valid Declaration objects. /// /// @return /// A support file list object. @@ -264,8 +261,8 @@ public: //------------------------------------------------------------------ /// Get the compile unit's imported module list. /// - /// This reports all the imports that the compile unit made, - /// including the current module. + /// This reports all the imports that the compile unit made, including the + /// current module. /// /// @return /// A list of imported module names. @@ -275,9 +272,8 @@ public: //------------------------------------------------------------------ /// 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. + /// SymbolFile plug-ins can store user data to internal state or objects to + /// quickly allow them to parse more information for a given object. /// /// @return /// The user data stored with the CompileUnit when it was @@ -288,9 +284,9 @@ public: //------------------------------------------------------------------ /// 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. + /// 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. /// /// @param[in] can_create /// If \b true, the variable list will be parsed on demand. If @@ -309,9 +305,8 @@ public: //------------------------------------------------------------------ /// 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. + /// Typically used by SymbolFile plug-ins when partially parsing the debug + /// information to see if the function has been parsed yet. /// /// @param[in] uid /// The user ID of the function to find. This value is supplied @@ -328,10 +323,9 @@ public: //------------------------------------------------------------------ /// 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. + /// 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. /// /// @param[in] line_table /// A line table object pointer that this object now owns. @@ -343,9 +337,8 @@ public: //------------------------------------------------------------------ /// 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. + /// 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. /// /// @param[in] variable_list_sp /// A shared pointer to a VariableList. @@ -355,9 +348,8 @@ public: //------------------------------------------------------------------ /// Resolve symbol contexts by file and line. /// - /// Given a file in \a file_spec, and a line number, find all - /// instances and append them to the supplied symbol context list - /// \a sc_list. + /// Given a file in \a file_spec, and a line number, find all instances and + /// append them to the supplied symbol context list \a sc_list. /// /// @param[in] file_spec /// A file specification. If \a file_spec contains no directory @@ -405,10 +397,10 @@ public: //------------------------------------------------------------------ /// 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. + /// "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. /// /// @return /// Returns 'true' if this compile unit was compiled with diff --git a/include/lldb/Symbol/CompilerType.h b/include/lldb/Symbol/CompilerType.h index 70d56db7fc21..1170832a7396 100644 --- a/include/lldb/Symbol/CompilerType.h +++ b/include/lldb/Symbol/CompilerType.h @@ -28,13 +28,12 @@ class DataExtractor; //---------------------------------------------------------------------- // A class that can carry around a clang ASTContext and a opaque clang -// QualType. A clang::QualType can be easily reconstructed from an -// opaque clang type and often the ASTContext is needed when doing -// various type related tasks, so this class allows both items to travel -// in a single very lightweight class that can be used. There are many -// static equivalents of the member functions that allow the ASTContext -// and the opaque clang QualType to be specified for ease of use and -// to avoid code duplication. +// QualType. A clang::QualType can be easily reconstructed from an opaque clang +// type and often the ASTContext is needed when doing various type related +// tasks, so this class allows both items to travel in a single very +// lightweight class that can be used. There are many static equivalents of the +// member functions that allow the ASTContext and the opaque clang QualType to +// be specified for ease of use and to avoid code duplication. //---------------------------------------------------------------------- class CompilerType { public: @@ -206,8 +205,7 @@ public: CompilerType GetFullyUnqualifiedType() const; // Returns -1 if this isn't a function of if the function doesn't have a - // prototype - // Returns a value >= 0 if there is a prototype. + // prototype Returns a value >= 0 if there is a prototype. int GetFunctionArgumentCount() const; CompilerType GetFunctionArgumentTypeAtIndex(size_t idx) const; @@ -220,14 +218,14 @@ public: //---------------------------------------------------------------------- // If this type is a reference to a type (L value or R value reference), - // return a new type with the reference removed, else return the current - // type itself. + // return a new type with the reference removed, else return the current type + // itself. //---------------------------------------------------------------------- CompilerType GetNonReferenceType() const; //---------------------------------------------------------------------- - // If this type is a pointer type, return the type that the pointer - // points to, else return an invalid type. + // If this type is a pointer type, return the type that the pointer points + // to, else return an invalid type. //---------------------------------------------------------------------- CompilerType GetPointeeType() const; @@ -237,44 +235,44 @@ public: CompilerType GetPointerType() const; //---------------------------------------------------------------------- - // Return a new CompilerType that is a L value reference to this type if - // this type is valid and the type system supports L value references, - // else return an invalid type. + // Return a new CompilerType that is a L value reference to this type if this + // type is valid and the type system supports L value references, else return + // an invalid type. //---------------------------------------------------------------------- CompilerType GetLValueReferenceType() const; //---------------------------------------------------------------------- - // Return a new CompilerType that is a R value reference to this type if - // this type is valid and the type system supports R value references, - // else return an invalid type. + // Return a new CompilerType that is a R value reference to this type if this + // type is valid and the type system supports R value references, else return + // an invalid type. //---------------------------------------------------------------------- CompilerType GetRValueReferenceType() const; //---------------------------------------------------------------------- - // Return a new CompilerType adds a const modifier to this type if - // this type is valid and the type system supports const modifiers, - // else return an invalid type. + // Return a new CompilerType adds a const modifier to this type if this type + // is valid and the type system supports const modifiers, else return an + // invalid type. //---------------------------------------------------------------------- CompilerType AddConstModifier() const; //---------------------------------------------------------------------- - // Return a new CompilerType adds a volatile modifier to this type if - // this type is valid and the type system supports volatile modifiers, - // else return an invalid type. + // Return a new CompilerType adds a volatile modifier to this type if this + // type is valid and the type system supports volatile modifiers, else return + // an invalid type. //---------------------------------------------------------------------- CompilerType AddVolatileModifier() const; //---------------------------------------------------------------------- - // Return a new CompilerType adds a restrict modifier to this type if - // this type is valid and the type system supports restrict modifiers, - // else return an invalid type. + // Return a new CompilerType adds a restrict modifier to this type if this + // type is valid and the type system supports restrict modifiers, else return + // an invalid type. //---------------------------------------------------------------------- CompilerType AddRestrictModifier() const; //---------------------------------------------------------------------- - // Create a typedef to this type using "name" as the name of the typedef - // this type is valid and the type system supports typedefs, else return - // an invalid type. + // Create a typedef to this type using "name" as the name of the typedef this + // type is valid and the type system supports typedefs, else return an + // invalid type. //---------------------------------------------------------------------- CompilerType CreateTypedef(const char *name, const CompilerDeclContext &decl_ctx) const; @@ -311,8 +309,8 @@ public: //---------------------------------------------------------------------- // If this type is an enumeration, iterate through all of its enumerators - // using a callback. If the callback returns true, keep iterating, else - // abort the iteration. + // using a callback. If the callback returns true, keep iterating, else abort + // the iteration. //---------------------------------------------------------------------- void ForEachEnumerator( std::function<bool(const CompilerType &integer_type, @@ -351,8 +349,8 @@ public: bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags) const; - // Lookup a child given a name. This function will match base class names - // and member member names in "clang_type" only, not descendants. + // Lookup a child given a name. This function will match base class names and + // member member names in "clang_type" only, not descendants. uint32_t GetIndexOfChildWithName(const char *name, bool omit_empty_base_classes) const; @@ -385,8 +383,8 @@ public: // Pointers & References //------------------------------------------------------------------ - // Converts "s" to a floating point value and place resulting floating - // point bytes in the "dst" buffer. + // Converts "s" to a floating point value and place resulting floating point + // bytes in the "dst" buffer. size_t ConvertStringToFloatValue(const char *s, uint8_t *dst, size_t dst_size) const; diff --git a/include/lldb/Symbol/DWARFCallFrameInfo.h b/include/lldb/Symbol/DWARFCallFrameInfo.h index a1bd1bc8b1c9..133c66d4ae4f 100644 --- a/include/lldb/Symbol/DWARFCallFrameInfo.h +++ b/include/lldb/Symbol/DWARFCallFrameInfo.h @@ -25,12 +25,12 @@ namespace lldb_private { -// DWARFCallFrameInfo is a class which can read eh_frame and DWARF -// Call Frame Information FDEs. It stores little information internally. -// Only two APIs are exported - one to find the high/low pc values -// of a function given a text address via the information in the -// eh_frame / debug_frame, and one to generate an UnwindPlan based -// on the FDE in the eh_frame / debug_frame section. +// DWARFCallFrameInfo is a class which can read eh_frame and DWARF Call Frame +// Information FDEs. It stores little information internally. Only two APIs +// are exported - one to find the high/low pc values of a function given a text +// address via the information in the eh_frame / debug_frame, and one to +// generate an UnwindPlan based on the FDE in the eh_frame / debug_frame +// section. class DWARFCallFrameInfo { public: @@ -40,13 +40,13 @@ public: ~DWARFCallFrameInfo() = default; - // Locate an AddressRange that includes the provided Address in this - // object's eh_frame/debug_info - // Returns true if a range is found to cover that address. + // Locate an AddressRange that includes the provided Address in this object's + // eh_frame/debug_info Returns true if a range is found to cover that + // address. bool GetAddressRange(Address addr, AddressRange &range); - // Return an UnwindPlan based on the call frame information encoded - // in the FDE of this DWARFCallFrameInfo section. + // Return an UnwindPlan based on the call frame information encoded in the + // FDE of this DWARFCallFrameInfo section. bool GetUnwindPlan(Address addr, UnwindPlan &unwind_plan); typedef RangeVector<lldb::addr_t, uint32_t> FunctionAddressAndSizeVector; @@ -55,12 +55,11 @@ public: // Build a vector of file address and size for all functions in this Module // based on the eh_frame FDE entries. // - // The eh_frame information can be a useful source of file address and size of - // the functions in a Module. Often a binary's non-exported symbols are - // stripped - // before shipping so lldb won't know the start addr / size of many functions - // in the Module. But the eh_frame can help to give the addresses of these - // stripped symbols, at least. + // The eh_frame information can be a useful source of file address and size + // of the functions in a Module. Often a binary's non-exported symbols are + // stripped before shipping so lldb won't know the start addr / size of many + // functions in the Module. But the eh_frame can help to give the addresses + // of these stripped symbols, at least. // // @param[out] function_info // A vector provided by the caller is filled out. May be empty if no @@ -112,10 +111,9 @@ private: typedef std::map<dw_offset_t, CIESP> cie_map_t; - // Start address (file address), size, offset of FDE location - // used for finding an FDE for a given File address; the start address field - // is - // an offset into an individual Module. + // Start address (file address), size, offset of FDE location used for + // finding an FDE for a given File address; the start address field is an + // offset into an individual Module. typedef RangeDataVector<lldb::addr_t, uint32_t, dw_offset_t> FDEEntryMap; bool IsEHFrame() const; @@ -133,8 +131,8 @@ private: void GetCFIData(); // Applies the specified DWARF opcode to the given row. This function handle - // the commands - // operates only on a single row (these are the ones what can appear both in + // the commands operates only on a single row (these are the ones what can + // appear both in // CIE and in FDE). // Returns true if the opcode is handled and false otherwise. bool HandleCommonDwarfOpcode(uint8_t primary_opcode, uint8_t extended_opcode, diff --git a/include/lldb/Symbol/DeclVendor.h b/include/lldb/Symbol/DeclVendor.h index f0ce9157cfa5..d1ccb4191cbc 100644 --- a/include/lldb/Symbol/DeclVendor.h +++ b/include/lldb/Symbol/DeclVendor.h @@ -20,9 +20,8 @@ namespace lldb_private { //---------------------------------------------------------------------- -// The Decl vendor class is intended as a generic interface to search -// for named declarations that are not necessarily backed by a specific -// symbol file. +// The Decl vendor class is intended as a generic interface to search for named +// declarations that are not necessarily backed by a specific symbol file. //---------------------------------------------------------------------- class DeclVendor { public: diff --git a/include/lldb/Symbol/Declaration.h b/include/lldb/Symbol/Declaration.h index 581176e23961..b654988bccd2 100644 --- a/include/lldb/Symbol/Declaration.h +++ b/include/lldb/Symbol/Declaration.h @@ -17,13 +17,12 @@ namespace lldb_private { //---------------------------------------------------------------------- /// @class Declaration Declaration.h "lldb/Symbol/Declaration.h" -/// @brief A class that describes the declaration location of a +/// A class that describes the declaration location of a /// lldb object. /// -/// The declarations include the file specification, line number, and -/// the column info and can help track where functions, blocks, inlined -/// functions, types, variables, any many other debug core objects were -/// declared. +/// The declarations include the file specification, line number, and the +/// column info and can help track where functions, blocks, inlined functions, +/// types, variables, any many other debug core objects were declared. //---------------------------------------------------------------------- class Declaration { public: @@ -92,8 +91,8 @@ public: //------------------------------------------------------------------ /// Clear the object's state. /// - /// Sets the file specification to be empty, and the line and column - /// to zero. + /// Sets the file specification to be empty, and the line and column to + /// zero. //------------------------------------------------------------------ void Clear() { m_file.Clear(); @@ -106,9 +105,9 @@ public: //------------------------------------------------------------------ /// Compare two declaration objects. /// - /// Compares the two file specifications from \a lhs and \a rhs. If - /// the file specifications are equal, then continue to compare the - /// line number and column numbers respectively. + /// Compares the two file specifications from \a lhs and \a rhs. If the file + /// specifications are equal, then continue to compare the line number and + /// column numbers respectively. /// /// @param[in] lhs /// The Left Hand Side const Declaration object reference. @@ -126,8 +125,8 @@ public: //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// - /// Dump a description of the contents of this object to the - /// supplied stream \a s. + /// Dump a description of the contents of this object to the supplied stream + /// \a s. /// /// @param[in] s /// The stream to which to dump the object description. diff --git a/include/lldb/Symbol/FuncUnwinders.h b/include/lldb/Symbol/FuncUnwinders.h index 27f42cf425b2..ae8bcc892ce4 100644 --- a/include/lldb/Symbol/FuncUnwinders.h +++ b/include/lldb/Symbol/FuncUnwinders.h @@ -12,8 +12,8 @@ class UnwindTable; class FuncUnwinders { public: - // FuncUnwinders objects are used to track UnwindPlans for a function - // (named or not - really just an address range) + // FuncUnwinders objects are used to track UnwindPlans for a function (named + // or not - really just an address range) // We'll record four different UnwindPlans for each address range: // @@ -28,8 +28,8 @@ public: // available for some reason. // Additionally, FuncUnwinds object can be asked where the prologue - // instructions are finished for migrating breakpoints past the - // stack frame setup instructions when we don't have line table information. + // instructions are finished for migrating breakpoints past the stack frame + // setup instructions when we don't have line table information. FuncUnwinders(lldb_private::UnwindTable &unwind_table, AddressRange range); @@ -38,10 +38,8 @@ public: // current_offset is the byte offset into the function. // 0 means no instructions have executed yet. -1 means the offset is unknown. // On architectures where the pc points to the next instruction that will - // execute, this - // offset value will have already been decremented by 1 to stay within the - // bounds of the - // correct function body. + // execute, this offset value will have already been decremented by 1 to stay + // within the bounds of the correct function body. lldb::UnwindPlanSP GetUnwindPlanAtCallSite(Target &target, int current_offset); @@ -69,24 +67,19 @@ public: // A function may have a Language Specific Data Area specified -- a block of // data in // the object file which is used in the processing of an exception throw / - // catch. - // If any of the UnwindPlans have the address of the LSDA region for this - // function, - // this will return it. + // catch. If any of the UnwindPlans have the address of the LSDA region for + // this function, this will return it. Address GetLSDAAddress(Target &target); // A function may have a Personality Routine associated with it -- used in the // processing of throwing an exception. If any of the UnwindPlans have the - // address of the personality routine, this will return it. Read the - // target-pointer - // at this address to get the personality function address. + // address of the personality routine, this will return it. Read the target- + // pointer at this address to get the personality function address. Address GetPersonalityRoutinePtrAddress(Target &target); // The following methods to retrieve specific unwind plans should rarely be - // used. - // Instead, clients should ask for the *behavior* they are looking for, using - // one - // of the above UnwindPlan retrieval methods. + // used. Instead, clients should ask for the *behavior* they are looking for, + // using one of the above UnwindPlan retrieval methods. lldb::UnwindPlanSP GetAssemblyUnwindPlan(Target &target, Thread &thread, int current_offset); @@ -116,11 +109,11 @@ public: private: lldb::UnwindAssemblySP GetUnwindAssemblyProfiler(Target &target); - // Do a simplistic comparison for the register restore rule for getting - // the caller's pc value on two UnwindPlans -- returns LazyBoolYes if - // they have the same unwind rule for the pc, LazyBoolNo if they do not - // have the same unwind rule for the pc, and LazyBoolCalculate if it was - // unable to determine this for some reason. + // Do a simplistic comparison for the register restore rule for getting the + // caller's pc value on two UnwindPlans -- returns LazyBoolYes if they have + // the same unwind rule for the pc, LazyBoolNo if they do not have the same + // unwind rule for the pc, and LazyBoolCalculate if it was unable to + // determine this for some reason. lldb_private::LazyBool CompareUnwindPlansForIdenticalInitialPCLocation( Thread &thread, const lldb::UnwindPlanSP &a, const lldb::UnwindPlanSP &b); @@ -143,8 +136,8 @@ private: lldb::UnwindPlanSP m_unwind_plan_arch_default_sp; lldb::UnwindPlanSP m_unwind_plan_arch_default_at_func_entry_sp; - // Fetching the UnwindPlans can be expensive - if we've already attempted - // to get one & failed, don't try again. + // Fetching the UnwindPlans can be expensive - if we've already attempted to + // get one & failed, don't try again. bool m_tried_unwind_plan_assembly : 1, m_tried_unwind_plan_eh_frame : 1, m_tried_unwind_plan_debug_frame : 1, m_tried_unwind_plan_eh_frame_augmented : 1, diff --git a/include/lldb/Symbol/Function.h b/include/lldb/Symbol/Function.h index 9d376007a411..28c6b4857b10 100644 --- a/include/lldb/Symbol/Function.h +++ b/include/lldb/Symbol/Function.h @@ -21,10 +21,10 @@ namespace lldb_private { //---------------------------------------------------------------------- /// @class FunctionInfo Function.h "lldb/Symbol/Function.h" -/// @brief A class that contains generic function information. +/// A class that contains generic function information. /// -/// This provides generic function information that gets reused between -/// inline functions and function types. +/// This provides generic function information that gets reused between inline +/// functions and function types. //---------------------------------------------------------------------- class FunctionInfo { public: @@ -67,8 +67,8 @@ public: //------------------------------------------------------------------ /// Compare two function information objects. /// - /// First compares the method names, and if equal, then compares - /// the declaration information. + /// First compares the method names, and if equal, then compares the + /// declaration information. /// /// @param[in] lhs /// The Left Hand Side const FunctionInfo object reference. @@ -86,8 +86,8 @@ public: //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// - /// Dump a description of the contents of this object to the - /// supplied stream \a s. + /// Dump a description of the contents of this object to the supplied stream + /// \a s. /// /// @param[in] s /// The stream to which to dump the object description. @@ -141,13 +141,13 @@ protected: //---------------------------------------------------------------------- /// @class InlineFunctionInfo Function.h "lldb/Symbol/Function.h" -/// @brief A class that describes information for an inlined function. +/// A class that describes information for an inlined function. //---------------------------------------------------------------------- class InlineFunctionInfo : public FunctionInfo { public: //------------------------------------------------------------------ - /// Construct with the function method name, mangled name, and - /// optional declaration information. + /// Construct with the function method name, mangled name, and optional + /// declaration information. /// /// @param[in] name /// A C string name for the method name for this function. This @@ -171,8 +171,8 @@ public: const Declaration *call_decl_ptr); //------------------------------------------------------------------ - /// Construct with the function method name, mangled name, and - /// optional declaration information. + /// Construct with the function method name, mangled name, and optional + /// declaration information. /// /// @param[in] name /// A name for the method name for this function. This value @@ -202,8 +202,8 @@ public: //------------------------------------------------------------------ /// Compare two inlined function information objects. /// - /// First compares the FunctionInfo objects, and if equal, - /// compares the mangled names. + /// First compares the FunctionInfo objects, and if equal, compares the + /// mangled names. /// /// @param[in] lhs /// The Left Hand Side const InlineFunctionInfo object @@ -223,8 +223,8 @@ public: //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// - /// Dump a description of the contents of this object to the - /// supplied stream \a s. + /// Dump a description of the contents of this object to the supplied stream + /// \a s. /// /// @param[in] s /// The stream to which to dump the object description. @@ -292,17 +292,15 @@ private: //---------------------------------------------------------------------- /// @class Function Function.h "lldb/Symbol/Function.h" -/// @brief A class that describes a function. +/// A class that describes a function. /// -/// Functions belong to CompileUnit objects (Function::m_comp_unit), -/// have unique user IDs (Function::UserID), know how to reconstruct -/// their symbol context (Function::SymbolContextScope), have a -/// specific function type (Function::m_type_uid), have a simple -/// method name (FunctionInfo::m_name), be declared at a specific -/// location (FunctionInfo::m_declaration), possibly have mangled -/// names (Function::m_mangled), an optional return type -/// (Function::m_type), and contains lexical blocks -/// (Function::m_blocks). +/// Functions belong to CompileUnit objects (Function::m_comp_unit), have +/// unique user IDs (Function::UserID), know how to reconstruct their symbol +/// context (Function::SymbolContextScope), have a specific function type +/// (Function::m_type_uid), have a simple method name (FunctionInfo::m_name), +/// be declared at a specific location (FunctionInfo::m_declaration), possibly +/// have mangled names (Function::m_mangled), an optional return type +/// (Function::m_type), and contains lexical blocks (Function::m_blocks). /// /// The function information is split into a few pieces: /// @li The concrete instance information @@ -311,15 +309,14 @@ private: /// The abstract information is found in the function type (Type) that /// describes a function information, return type and parameter types. /// -/// The concrete information is the address range information and -/// specific locations for an instance of this function. +/// The concrete information is the address range information and specific +/// locations for an instance of this function. //---------------------------------------------------------------------- class Function : public UserID, public SymbolContextScope { public: //------------------------------------------------------------------ - /// Construct with a compile unit, function UID, function type UID, - /// optional mangled name, function type, and a section offset - /// based address range. + /// Construct with a compile unit, function UID, function type UID, optional + /// mangled name, function type, and a section offset based address range. /// /// @param[in] comp_unit /// The compile unit to which this function belongs. @@ -352,9 +349,8 @@ public: Type *func_type, const AddressRange &range); //------------------------------------------------------------------ - /// Construct with a compile unit, function UID, function type UID, - /// optional mangled name, function type, and a section offset - /// based address range. + /// Construct with a compile unit, function UID, function type UID, optional + /// mangled name, function type, and a section offset based address range. /// /// @param[in] comp_unit /// The compile unit to which this function belongs. @@ -408,10 +404,10 @@ public: lldb::LanguageType GetLanguage() const; //------------------------------------------------------------------ - /// Find the file and line number of the source location of the start - /// of the function. This will use the declaration if present and fall - /// back on the line table if that fails. So there may NOT be a line - /// table entry for this source file/line combo. + /// Find the file and line number of the source location of the start of the + /// function. This will use the declaration if present and fall back on the + /// line table if that fails. So there may NOT be a line table entry for + /// this source file/line combo. /// /// @param[out] source_file /// The source file. @@ -422,8 +418,8 @@ public: void GetStartLineSourceInfo(FileSpec &source_file, uint32_t &line_no); //------------------------------------------------------------------ - /// Find the file and line number of the source location of the end - /// of the function. + /// Find the file and line number of the source location of the end of the + /// function. /// /// /// @param[out] source_file @@ -497,8 +493,8 @@ public: CompilerDeclContext GetDeclContext(); //------------------------------------------------------------------ - /// Get accessor for the type that describes the function - /// return value type, and parameter types. + /// Get accessor for the type that describes the function return value type, + /// and parameter types. /// /// @return /// A type object pointer. @@ -506,8 +502,8 @@ public: Type *GetType(); //------------------------------------------------------------------ - /// Get const accessor for the type that describes the function - /// return value type, and parameter types. + /// Get const accessor for the type that describes the function return value + /// type, and parameter types. /// /// @return /// A const type object pointer. @@ -518,10 +514,8 @@ public: //------------------------------------------------------------------ /// Get the size of the prologue instructions for this function. The - /// "prologue" - /// instructions include any instructions given line number 0 immediately - /// following - /// the prologue end. + /// "prologue" instructions include any instructions given line number 0 + /// immediately following the prologue end. /// /// @return /// The size of the prologue. @@ -531,8 +525,8 @@ public: //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// - /// Dump a description of the contents of this object to the - /// supplied stream \a s. + /// Dump a description of the contents of this object to the supplied stream + /// \a s. /// /// @param[in] s /// The stream to which to dump the object description. @@ -567,10 +561,10 @@ public: /// /// The debug information may provide information about whether this /// function was compiled with optimization or not. In this case, - /// "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. + /// "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. /// /// @return /// Returns 'true' if this function was compiled with @@ -582,10 +576,10 @@ public: //------------------------------------------------------------------ /// Get whether this function represents a 'top-level' function /// - /// The concept of a top-level function is language-specific, mostly - /// meant to represent the notion of scripting-style code that has - /// global visibility of the variables/symbols/functions/... - /// defined within the containing file/module + /// The concept of a top-level function is language-specific, mostly meant + /// to represent the notion of scripting-style code that has global + /// visibility of the variables/symbols/functions/... defined within the + /// containing file/module /// /// If stopped in a top-level function, LLDB will expose global variables /// as-if locals in the 'frame variable' command diff --git a/include/lldb/Symbol/GoASTContext.h b/include/lldb/Symbol/GoASTContext.h index ee111942c205..29c8cdceacff 100644 --- a/include/lldb/Symbol/GoASTContext.h +++ b/include/lldb/Symbol/GoASTContext.h @@ -216,8 +216,7 @@ public: CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override; // Returns -1 if this isn't a function of if the function doesn't have a - // prototype - // Returns a value >= 0 if there is a prototype. + // prototype Returns a value >= 0 if there is a prototype. int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override; CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type, @@ -294,8 +293,8 @@ public: bool &child_is_base_class, bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags) override; - // Lookup a child given a name. This function will match base class names - // and member member names in "clang_type" only, not descendants. + // Lookup a child given a name. This function will match base class names and + // member member names in "clang_type" only, not descendants. uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes) override; @@ -347,8 +346,8 @@ public: Stream *s, const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size) override; - // Converts "s" to a floating point value and place resulting floating - // point bytes in the "dst" buffer. + // Converts "s" to a floating point value and place resulting floating point + // bytes in the "dst" buffer. size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, const char *s, uint8_t *dst, size_t dst_size) override; diff --git a/include/lldb/Symbol/LineEntry.h b/include/lldb/Symbol/LineEntry.h index b9a1a1442d47..c1ce614609c1 100644 --- a/include/lldb/Symbol/LineEntry.h +++ b/include/lldb/Symbol/LineEntry.h @@ -18,7 +18,7 @@ namespace lldb_private { //---------------------------------------------------------------------- /// @class LineEntry LineEntry.h "lldb/Symbol/LineEntry.h" -/// @brief A line table entry class. +/// A line table entry class. //---------------------------------------------------------------------- struct LineEntry { //------------------------------------------------------------------ @@ -44,8 +44,8 @@ struct LineEntry { //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// - /// Dump a description of the contents of this object to the - /// supplied stream \a s. + /// Dump a description of the contents of this object to the supplied stream + /// \a s. /// /// @param[in] s /// The stream to which to dump the object description. @@ -79,8 +79,8 @@ struct LineEntry { Target *target, bool show_address_only) const; //------------------------------------------------------------------ - /// Dumps information specific to a process that stops at this - /// line entry to the supplied stream \a s. + /// Dumps information specific to a process that stops at this line entry to + /// the supplied stream \a s. /// /// @param[in] s /// The stream to which to dump the object description. @@ -123,25 +123,25 @@ struct LineEntry { static int Compare(const LineEntry &lhs, const LineEntry &rhs); //------------------------------------------------------------------ - /// Give the range for this LineEntry + any additional LineEntries for - /// this same source line that are contiguous. + /// Give the range for this LineEntry + any additional LineEntries for this + /// same source line that are contiguous. /// /// A compiler may emit multiple line entries for a single source line, - /// e.g. to indicate subexpressions at different columns. This method - /// will get the AddressRange for all of the LineEntries for this source - /// line that are contiguous. + /// e.g. to indicate subexpressions at different columns. This method will + /// get the AddressRange for all of the LineEntries for this source line + /// that are contiguous. // - /// Line entries with a line number of 0 are treated specially - these - /// are compiler-generated line table entries that the user did not - /// write in their source code, and we want to skip past in the debugger. - /// If this LineEntry is for line 32, and the following LineEntry is for - /// line 0, we will extend the range to include the AddressRange of the - /// line 0 LineEntry (and it will include the range of the following - /// LineEntries that match either 32 or 0.) + /// Line entries with a line number of 0 are treated specially - these are + /// compiler-generated line table entries that the user did not write in + /// their source code, and we want to skip past in the debugger. If this + /// LineEntry is for line 32, and the following LineEntry is for line 0, we + /// will extend the range to include the AddressRange of the line 0 + /// LineEntry (and it will include the range of the following LineEntries + /// that match either 32 or 0.) /// - /// If the initial LineEntry this method is called on is a line #0, only - /// the range of contiuous LineEntries with line #0 will be included in - /// the complete range. + /// If the initial LineEntry this method is called on is a line #0, only the + /// range of contiuous LineEntries with line #0 will be included in the + /// complete range. /// /// @return /// The contiguous AddressRange for this source line. diff --git a/include/lldb/Symbol/LineTable.h b/include/lldb/Symbol/LineTable.h index a55e797f7b16..fe8be0c55764 100644 --- a/include/lldb/Symbol/LineTable.h +++ b/include/lldb/Symbol/LineTable.h @@ -25,8 +25,8 @@ namespace lldb_private { //---------------------------------------------------------------------- -/// @class LineSequence LineTable.h "lldb/Symbol/LineTable.h" -/// @brief An abstract base class used during symbol table creation. +/// @class LineSequence LineTable.h "lldb/Symbol/LineTable.h" An abstract base +/// class used during symbol table creation. //---------------------------------------------------------------------- class LineSequence { public: @@ -42,7 +42,7 @@ private: //---------------------------------------------------------------------- /// @class LineTable LineTable.h "lldb/Symbol/LineTable.h" -/// @brief A line table class. +/// A line table class. //---------------------------------------------------------------------- class LineTable { public: @@ -111,8 +111,7 @@ public: void GetDescription(Stream *s, Target *target, lldb::DescriptionLevel level); //------------------------------------------------------------------ - /// Find a line entry that contains the section offset address \a - /// so_addr. + /// Find a line entry that contains the section offset address \a so_addr. /// /// @param[in] so_addr /// A section offset address object containing the address we @@ -134,12 +133,12 @@ public: uint32_t *index_ptr = nullptr); //------------------------------------------------------------------ - /// Find a line entry index that has a matching file index and - /// source line number. + /// Find a line entry index that has a matching file index and source line + /// number. /// - /// Finds the next line entry that has a matching \a file_idx and - /// source line number \a line starting at the \a start_idx entries - /// into the line entry collection. + /// Finds the next line entry that has a matching \a file_idx and source + /// line number \a line starting at the \a start_idx entries into the line + /// entry collection. /// /// @param[in] start_idx /// The number of entries to skip when starting the search. @@ -224,8 +223,8 @@ public: bool append); //------------------------------------------------------------------ - /// Given a file range link map, relink the current line table - /// and return a fixed up line table. + /// Given a file range link map, relink the current line table and return a + /// fixed up line table. /// /// @param[out] file_range_map /// A collection of file ranges that maps to new file ranges diff --git a/include/lldb/Symbol/ObjectContainer.h b/include/lldb/Symbol/ObjectContainer.h index 110379234fb5..2138d22808c3 100644 --- a/include/lldb/Symbol/ObjectContainer.h +++ b/include/lldb/Symbol/ObjectContainer.h @@ -25,23 +25,23 @@ namespace lldb_private { //---------------------------------------------------------------------- /// @class ObjectContainer ObjectContainer.h "lldb/Symbol/ObjectContainer.h" -/// @brief A plug-in interface definition class for object containers. +/// A plug-in interface definition class for object containers. /// -/// Object containers contain object files from one or more -/// architectures, and also can contain one or more named objects. +/// Object containers contain object files from one or more architectures, and +/// also can contain one or more named objects. /// -/// Typical object containers are static libraries (.a files) that -/// contain multiple named object files, and universal files that contain -/// multiple architectures. +/// Typical object containers are static libraries (.a files) that contain +/// multiple named object files, and universal files that contain multiple +/// architectures. //---------------------------------------------------------------------- class ObjectContainer : public PluginInterface, public ModuleChild { public: //------------------------------------------------------------------ /// Construct with a parent module, offset, and header data. /// - /// Object files belong to modules and a valid module must be - /// supplied upon construction. The at an offset within a file for - /// objects that contain more than one architecture or object. + /// Object files belong to modules and a valid module must be supplied upon + /// construction. The at an offset within a file for objects that contain + /// more than one architecture or object. //------------------------------------------------------------------ ObjectContainer(const lldb::ModuleSP &module_sp, const FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length, @@ -58,18 +58,17 @@ public: //------------------------------------------------------------------ /// Destructor. /// - /// The destructor is virtual since this class is designed to be - /// inherited from by the plug-in instance. + /// The destructor is virtual since this class is designed to be inherited + /// from by the plug-in instance. //------------------------------------------------------------------ ~ObjectContainer() override = default; //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// - /// Dump a description of the current contents of this object - /// to the supplied stream \a s. The dumping should include the - /// section list if it has been parsed, and the symbol table - /// if it has been parsed. + /// Dump a description of the current contents of this object to the + /// supplied stream \a s. The dumping should include the section list if it + /// has been parsed, and the symbol table if it has been parsed. /// /// @param[in] s /// The stream to which to dump the object description. @@ -101,8 +100,8 @@ public: //------------------------------------------------------------------ /// Returns the offset into a file at which this object resides. /// - /// Some files contain many object files, and this function allows - /// access to an object's offset within the file. + /// Some files contain many object files, and this function allows access to + /// an object's offset within the file. /// /// @return /// The offset in bytes into the file. Defaults to zero for @@ -124,10 +123,10 @@ public: //------------------------------------------------------------------ /// Get the number of architectures in this object file. /// - /// The default implementation returns 1 as for object files that - /// contain a single architecture. ObjectContainer instances that - /// contain more than one architecture should override this function - /// and return an appropriate value. + /// The default implementation returns 1 as for object files that contain a + /// single architecture. ObjectContainer instances that contain more than + /// one architecture should override this function and return an appropriate + /// value. /// /// @return /// The number of architectures contained in this object file. @@ -137,11 +136,11 @@ public: //------------------------------------------------------------------ /// Attempts to parse the object header. /// - /// This function is used as a test to see if a given plug-in - /// instance can parse the header data already contained in - /// ObjectContainer::m_data. If an object file parser does not - /// recognize that magic bytes in a header, false should be returned - /// and the next plug-in can attempt to parse an object file. + /// This function is used as a test to see if a given plug-in instance can + /// parse the header data already contained in ObjectContainer::m_data. If + /// an object file parser does not recognize that magic bytes in a header, + /// false should be returned and the next plug-in can attempt to parse an + /// object file. /// /// @return /// Returns \b true if the header was parsed successfully, \b @@ -152,14 +151,14 @@ public: //------------------------------------------------------------------ /// Selects an architecture in an object file. /// - /// Object files that contain a single architecture should verify - /// that the specified \a arch matches the architecture in in - /// object file and return \b true or \b false accordingly. + /// Object files that contain a single architecture should verify that the + /// specified \a arch matches the architecture in in object file and return + /// \b true or \b false accordingly. /// - /// Object files that contain more than one architecture should - /// attempt to select that architecture, and if successful, clear - /// out any previous state from any previously selected architecture - /// and prepare to return information for the new architecture. + /// Object files that contain more than one architecture should attempt to + /// select that architecture, and if successful, clear out any previous + /// state from any previously selected architecture and prepare to return + /// information for the new architecture. /// /// @return /// Returns a pointer to the object file of the requested \a diff --git a/include/lldb/Symbol/ObjectFile.h b/include/lldb/Symbol/ObjectFile.h index dff802522da8..1e9ae8b45417 100644 --- a/include/lldb/Symbol/ObjectFile.h +++ b/include/lldb/Symbol/ObjectFile.h @@ -20,6 +20,7 @@ #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/UUID.h" #include "lldb/lldb-private.h" +#include "llvm/Support/VersionTuple.h" namespace lldb_private { @@ -44,16 +45,15 @@ public: //---------------------------------------------------------------------- /// @class ObjectFile ObjectFile.h "lldb/Symbol/ObjectFile.h" -/// @brief A plug-in interface definition class for object file parsers. +/// A plug-in interface definition class for object file parsers. /// -/// Object files belong to Module objects and know how to extract -/// information from executable, shared library, and object (.o) files -/// used by operating system runtime. The symbol table and section list -/// for an object file. +/// Object files belong to Module objects and know how to extract information +/// from executable, shared library, and object (.o) files used by operating +/// system runtime. The symbol table and section list for an object file. /// -/// Object files can be represented by the entire file, or by part of a -/// file. An example of a partial file ObjectFile is one that contains -/// information for one of multiple architectures in the same file. +/// Object files can be represented by the entire file, or by part of a file. +/// An example of a partial file ObjectFile is one that contains information +/// for one of multiple architectures in the same file. /// /// Once an architecture is selected the object file information can be /// extracted from this abstract class. @@ -88,12 +88,17 @@ public: eStrataJIT } Strata; + struct LoadableData { + lldb::addr_t Dest; + llvm::ArrayRef<uint8_t> Contents; + }; + //------------------------------------------------------------------ /// Construct with a parent module, offset, and header data. /// - /// Object files belong to modules and a valid module must be - /// supplied upon construction. The at an offset within a file for - /// objects that contain more than one architecture or object. + /// Object files belong to modules and a valid module must be supplied upon + /// construction. The at an offset within a file for objects that contain + /// more than one architecture or object. //------------------------------------------------------------------ ObjectFile(const lldb::ModuleSP &module_sp, const FileSpec *file_spec_ptr, lldb::offset_t file_offset, lldb::offset_t length, @@ -105,18 +110,17 @@ public: //------------------------------------------------------------------ /// Destructor. /// - /// The destructor is virtual since this class is designed to be - /// inherited from by the plug-in instance. + /// The destructor is virtual since this class is designed to be inherited + /// from by the plug-in instance. //------------------------------------------------------------------ ~ObjectFile() override; //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// - /// Dump a description of the current contents of this object - /// to the supplied stream \a s. The dumping should include the - /// section list if it has been parsed, and the symbol table - /// if it has been parsed. + /// Dump a description of the current contents of this object to the + /// supplied stream \a s. The dumping should include the section list if it + /// has been parsed, and the symbol table if it has been parsed. /// /// @param[in] s /// The stream to which to dump the object description. @@ -126,9 +130,9 @@ public: //------------------------------------------------------------------ /// Find a ObjectFile plug-in that can parse \a file_spec. /// - /// Scans all loaded plug-in interfaces that implement versions of - /// the ObjectFile plug-in interface and returns the first - /// instance that can parse the file. + /// Scans all loaded plug-in interfaces that implement versions of the + /// ObjectFile plug-in interface and returns the first instance that can + /// parse the file. /// /// @param[in] module /// The parent module that owns this object file. @@ -156,9 +160,9 @@ public: //------------------------------------------------------------------ /// Find a ObjectFile plug-in that can parse a file in memory. /// - /// Scans all loaded plug-in interfaces that implement versions of - /// the ObjectFile plug-in interface and returns the first - /// instance that can parse the file. + /// Scans all loaded plug-in interfaces that implement versions of the + /// ObjectFile plug-in interface and returns the first instance that can + /// parse the file. /// /// @param[in] module /// The parent module that owns this object file. @@ -189,9 +193,9 @@ public: //------------------------------------------------------------------ /// Split a path into a file path with object name. /// - /// For paths like "/tmp/foo.a(bar.o)" we often need to split a path - /// up into the actual path name and into the object name so we can - /// make a valid object file from it. + /// For paths like "/tmp/foo.a(bar.o)" we often need to split a path up into + /// the actual path name and into the object name so we can make a valid + /// object file from it. /// /// @param[in] path_with_object /// A path that might contain an archive path with a .o file @@ -228,29 +232,25 @@ public: //------------------------------------------------------------------ /// Get the address type given a file address in an object file. /// - /// Many binary file formats know what kinds - /// This is primarily for ARM binaries, though it can be applied to - /// any executable file format that supports different opcode types - /// within the same binary. ARM binaries support having both ARM and - /// Thumb within the same executable container. We need to be able - /// to get - /// @return + /// Many binary file formats know what kinds This is primarily for ARM + /// binaries, though it can be applied to any executable file format that + /// supports different opcode types within the same binary. ARM binaries + /// support having both ARM and Thumb within the same executable container. + /// We need to be able to get @return /// The size of an address in bytes for the currently selected /// architecture (and object for archives). Returns zero if no /// architecture or object has been selected. //------------------------------------------------------------------ - virtual lldb::AddressClass GetAddressClass(lldb::addr_t file_addr); + virtual AddressClass GetAddressClass(lldb::addr_t file_addr); //------------------------------------------------------------------ /// Extract the dependent modules from an object file. /// - /// If an object file has information about which other images it - /// depends on (such as shared libraries), this function will - /// provide the list. Since many executables or shared libraries - /// may depend on the same files, - /// FileSpecList::AppendIfUnique(const FileSpec &) should be - /// used to make sure any files that are added are not already in - /// the list. + /// If an object file has information about which other images it depends on + /// (such as shared libraries), this function will provide the list. Since + /// many executables or shared libraries may depend on the same files, + /// FileSpecList::AppendIfUnique(const FileSpec &) should be used to make + /// sure any files that are added are not already in the list. /// /// @param[out] file_list /// A list of file specification objects that gets dependent @@ -275,8 +275,8 @@ public: //------------------------------------------------------------------ /// Returns the offset into a file at which this object resides. /// - /// Some files contain many object files, and this function allows - /// access to an object's offset within the file. + /// Some files contain many object files, and this function allows access to + /// an object's offset within the file. /// /// @return /// The offset in bytes into the file. Defaults to zero for @@ -307,8 +307,8 @@ public: //------------------------------------------------------------------ /// Get the name of the cpu, vendor and OS for this object file. /// - /// This value is a string that represents the target triple where - /// the cpu type, the vendor and the OS are encoded into a string. + /// This value is a string that represents the target triple where the cpu + /// type, the vendor and the OS are encoded into a string. /// /// @param[out] target_triple /// The string value of the target triple. @@ -320,11 +320,11 @@ public: virtual bool GetArchitecture(ArchSpec &arch) = 0; //------------------------------------------------------------------ - /// Gets the section list for the currently selected architecture - /// (and object for archives). + /// Gets the section list for the currently selected architecture (and + /// object for archives). /// - /// Section list parsing can be deferred by ObjectFile instances - /// until this accessor is called the first time. + /// Section list parsing can be deferred by ObjectFile instances until this + /// accessor is called the first time. /// /// @return /// The list of sections contained in this object file. @@ -334,17 +334,17 @@ public: virtual void CreateSections(SectionList &unified_section_list) = 0; //------------------------------------------------------------------ - /// Notify the ObjectFile that the file addresses in the Sections - /// for this module have been changed. + /// Notify the ObjectFile that the file addresses in the Sections for this + /// module have been changed. //------------------------------------------------------------------ virtual void SectionFileAddressesChanged() {} //------------------------------------------------------------------ - /// Gets the symbol table for the currently selected architecture - /// (and object for archives). + /// Gets the symbol table for the currently selected architecture (and + /// object for archives). /// - /// Symbol table parsing can be deferred by ObjectFile instances - /// until this accessor is called the first time. + /// Symbol table parsing can be deferred by ObjectFile instances until this + /// accessor is called the first time. /// /// @return /// The symbol table for this object file. @@ -360,11 +360,11 @@ public: //------------------------------------------------------------------ /// Appends a Symbol for the specified so_addr to the symbol table. /// - /// If verify_unique is false, the symbol table is not searched - /// to determine if a Symbol found at this address has already been - /// added to the symbol table. When verify_unique is true, this - /// method resolves the Symbol as the first match in the SymbolTable - /// and appends a Symbol only if required/found. + /// If verify_unique is false, the symbol table is not searched to determine + /// if a Symbol found at this address has already been added to the symbol + /// table. When verify_unique is true, this method resolves the Symbol as + /// the first match in the SymbolTable and appends a Symbol only if + /// required/found. /// /// @return /// The resolved symbol or nullptr. Returns nullptr if a @@ -372,13 +372,13 @@ public: //------------------------------------------------------------------ virtual Symbol *ResolveSymbolForAddress(const Address &so_addr, bool verify_unique) { - // Typically overridden to lazily add stripped symbols recoverable from - // the exception handling unwind information (i.e. without parsing - // the entire eh_frame section. + // Typically overridden to lazily add stripped symbols recoverable from the + // exception handling unwind information (i.e. without parsing the entire + // eh_frame section. // - // The availability of LC_FUNCTION_STARTS allows ObjectFileMachO - // to efficiently add stripped symbols when the symbol table is - // first constructed. Poorer cousins are PECoff and ELF. + // The availability of LC_FUNCTION_STARTS allows ObjectFileMachO to + // efficiently add stripped symbols when the symbol table is first + // constructed. Poorer cousins are PECoff and ELF. return nullptr; } @@ -410,10 +410,9 @@ public: //------------------------------------------------------------------ /// Gets the UUID for this object file. /// - /// If the object file format contains a UUID, the value should be - /// returned. Else ObjectFile instances should return the MD5 - /// checksum of all of the bytes for the object file (or memory for - /// memory based object files). + /// If the object file format contains a UUID, the value should be returned. + /// Else ObjectFile instances should return the MD5 checksum of all of the + /// bytes for the object file (or memory for memory based object files). /// /// @return /// Returns \b true if a UUID was successfully extracted into @@ -424,8 +423,8 @@ public: //------------------------------------------------------------------ /// Gets the symbol file spec list for this object file. /// - /// If the object file format contains a debug symbol file link, - /// the values will be returned in the FileSpecList. + /// If the object file format contains a debug symbol file link, the values + /// will be returned in the FileSpecList. /// /// @return /// Returns filespeclist. @@ -438,8 +437,8 @@ public: /// Gets the file spec list of libraries re-exported by this object file. /// /// If the object file format has the notion of one library re-exporting the - /// symbols from another, - /// the re-exported libraries will be returned in the FileSpecList. + /// symbols from another, the re-exported libraries will be returned in the + /// FileSpecList. /// /// @return /// Returns filespeclist. @@ -449,8 +448,8 @@ public: } //------------------------------------------------------------------ - /// Sets the load address for an entire module, assuming a rigid - /// slide of sections, if possible in the implementation. + /// Sets the load address for an entire module, assuming a rigid slide of + /// sections, if possible in the implementation. /// /// @return /// Returns true iff any section's load address changed. @@ -461,8 +460,8 @@ public: } //------------------------------------------------------------------ - /// Gets whether endian swapping should occur when extracting data - /// from this object file. + /// Gets whether endian swapping should occur when extracting data from this + /// object file. /// /// @return /// Returns \b true if endian swapping is needed, \b false @@ -473,11 +472,11 @@ public: //------------------------------------------------------------------ /// Attempts to parse the object header. /// - /// This function is used as a test to see if a given plug-in - /// instance can parse the header data already contained in - /// ObjectFile::m_data. If an object file parser does not - /// recognize that magic bytes in a header, false should be returned - /// and the next plug-in can attempt to parse an object file. + /// This function is used as a test to see if a given plug-in instance can + /// parse the header data already contained in ObjectFile::m_data. If an + /// object file parser does not recognize that magic bytes in a header, + /// false should be returned and the next plug-in can attempt to parse an + /// object file. /// /// @return /// Returns \b true if the header was parsed successfully, \b @@ -488,11 +487,11 @@ public: //------------------------------------------------------------------ /// Returns a reference to the UnwindTable for this ObjectFile /// - /// The UnwindTable contains FuncUnwinders objects for any function in - /// this ObjectFile. 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. + /// The UnwindTable contains FuncUnwinders objects for any function in this + /// ObjectFile. 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 object file. @@ -500,21 +499,21 @@ public: virtual lldb_private::UnwindTable &GetUnwindTable() { return m_unwind_table; } //------------------------------------------------------------------ - /// Returns if the function bounds for symbols in this symbol file - /// are likely accurate. + /// Returns if the function bounds for symbols in this symbol file are + /// likely accurate. /// /// The unwinder can emulate the instructions of functions to understand - /// prologue/epilogue code sequences, where registers are spilled on - /// the stack, etc. This feature relies on having the correct start - /// addresses of all functions. If the ObjectFile has a way to tell - /// that symbols have been stripped and there's no way to reconstruct - /// start addresses (e.g. LC_FUNCTION_STARTS on Mach-O, or eh_frame - /// unwind info), the ObjectFile should indicate that assembly emulation - /// should not be used for this module. + /// prologue/epilogue code sequences, where registers are spilled on the + /// stack, etc. This feature relies on having the correct start addresses + /// of all functions. If the ObjectFile has a way to tell that symbols have + /// been stripped and there's no way to reconstruct start addresses (e.g. + /// LC_FUNCTION_STARTS on Mach-O, or eh_frame unwind info), the ObjectFile + /// should indicate that assembly emulation should not be used for this + /// module. /// - /// It is uncommon for this to return false. An ObjectFile needs to - /// be sure that symbol start addresses are unavailable before false - /// is returned. If it is unclear, this should return true. + /// It is uncommon for this to return false. An ObjectFile needs to be sure + /// that symbol start addresses are unavailable before false is returned. + /// If it is unclear, this should return true. /// /// @return /// Returns true if assembly emulation should be used for this @@ -542,9 +541,9 @@ public: } //------------------------------------------------------------------ - /// Returns the address of the Entry Point in this object file - if - /// the object file doesn't have an entry point (because it is not an - /// executable file) then an invalid address is returned. + /// Returns the address of the Entry Point in this object file - if the + /// object file doesn't have an entry point (because it is not an executable + /// file) then an invalid address is returned. /// /// @return /// Returns the entry address for this module. @@ -552,14 +551,13 @@ public: virtual lldb_private::Address GetEntryPointAddress() { return Address(); } //------------------------------------------------------------------ - /// Returns the address that represents the header of this object - /// file. + /// Returns the address that represents the header of this object file. /// - /// The header address is defined as where the header for the object - /// file is that describes the content of the file. If the header - /// doesn't appear in a section that is defined in the object file, - /// an address with no section is returned that has the file offset - /// set in the m_file_offset member of the lldb_private::Address object. + /// The header address is defined as where the header for the object file is + /// that describes the content of the file. If the header doesn't appear in + /// a section that is defined in the object file, an address with no section + /// is returned that has the file offset set in the m_file_offset member of + /// the lldb_private::Address object. /// /// @return /// Returns the entry address for this module. @@ -571,9 +569,9 @@ public: virtual uint32_t GetNumThreadContexts() { return 0; } //------------------------------------------------------------------ - /// Some object files may have an identifier string embedded in them, - /// e.g. in a Mach-O core file using the LC_IDENT load command (which - /// is obsolete, but can still be found in some old files) + /// Some object files may have an identifier string embedded in them, e.g. + /// in a Mach-O core file using the LC_IDENT load command (which is + /// obsolete, but can still be found in some old files) /// /// @return /// Returns the identifier string if one exists, else an empty @@ -584,11 +582,11 @@ public: } //------------------------------------------------------------------ - /// When the ObjectFile is a core file, lldb needs to locate the - /// "binary" in the core file. lldb can iterate over the pages looking - /// for a valid binary, but some core files may have metadata - /// describing where the main binary is exactly which removes ambiguity - /// when there are multiple binaries present in the captured memory pages. + /// When the ObjectFile is a core file, lldb needs to locate the "binary" in + /// the core file. lldb can iterate over the pages looking for a valid + /// binary, but some core files may have metadata describing where the main + /// binary is exactly which removes ambiguity when there are multiple + /// binaries present in the captured memory pages. /// /// @param[out] address /// If the address of the binary is specified, this will be set. @@ -615,13 +613,12 @@ public: } //------------------------------------------------------------------ - /// The object file should be able to calculate its type by looking - /// at its file header and possibly the sections or other data in - /// the object file. The file type is used in the debugger to help - /// select the correct plug-ins for the job at hand, so this is - /// important to get right. If any eTypeXXX definitions do not match - /// up with the type of file you are loading, please feel free to - /// add a new enumeration value. + /// The object file should be able to calculate its type by looking at its + /// file header and possibly the sections or other data in the object file. + /// The file type is used in the debugger to help select the correct plug- + /// ins for the job at hand, so this is important to get right. If any + /// eTypeXXX definitions do not match up with the type of file you are + /// loading, please feel free to add a new enumeration value. /// /// @return /// The calculated file type for the current object file. @@ -629,20 +626,19 @@ public: virtual Type CalculateType() = 0; //------------------------------------------------------------------ - /// In cases where the type can't be calculated (elf files), this - /// routine allows someone to explicitly set it. As an example, - /// SymbolVendorELF uses this routine to set eTypeDebugInfo when - /// loading debug link files. + /// In cases where the type can't be calculated (elf files), this routine + /// allows someone to explicitly set it. As an example, SymbolVendorELF uses + /// this routine to set eTypeDebugInfo when loading debug link files. virtual void SetType(Type type) { m_type = type; } //------------------------------------------------------------------ - /// The object file should be able to calculate the strata of the - /// object file. + /// The object file should be able to calculate the strata of the object + /// file. /// - /// Many object files for platforms might be for either user space - /// debugging or for kernel debugging. If your object file subclass - /// can figure this out, it will help with debugger plug-in selection - /// when it comes time to debug. + /// Many object files for platforms might be for either user space debugging + /// or for kernel debugging. If your object file subclass can figure this + /// out, it will help with debugger plug-in selection when it comes time to + /// debug. /// /// @return /// The calculated object file strata for the current object @@ -653,96 +649,31 @@ public: //------------------------------------------------------------------ /// Get the object file version numbers. /// - /// Many object files have a set of version numbers that describe - /// the version of the executable or shared library. Typically there - /// are major, minor and build, but there may be more. This function - /// will extract the versions from object files if they are available. - /// - /// If \a versions is NULL, or if \a num_versions is 0, the return - /// value will indicate how many version numbers are available in - /// this object file. Then a subsequent call can be made to this - /// function with a value of \a versions and \a num_versions that - /// has enough storage to store some or all version numbers. - /// - /// @param[out] versions - /// A pointer to an array of uint32_t types that is \a num_versions - /// long. If this value is NULL, the return value will indicate - /// how many version numbers are required for a subsequent call - /// to this function so that all versions can be retrieved. If - /// the value is non-NULL, then at most \a num_versions of the - /// existing versions numbers will be filled into \a versions. - /// If there is no version information available, \a versions - /// will be filled with \a num_versions UINT32_MAX values - /// and zero will be returned. - /// - /// @param[in] num_versions - /// The maximum number of entries to fill into \a versions. If - /// this value is zero, then the return value will indicate - /// how many version numbers there are in total so another call - /// to this function can be make with adequate storage in - /// \a versions to get all of the version numbers. If \a - /// num_versions is less than the actual number of version - /// numbers in this object file, only \a num_versions will be - /// filled into \a versions (if \a versions is non-NULL). + /// Many object files have a set of version numbers that describe the + /// version of the executable or shared library. Typically there are major, + /// minor and build, but there may be more. This function will extract the + /// versions from object files if they are available. /// /// @return - /// This function always returns the number of version numbers - /// that this object file has regardless of the number of - /// version numbers that were copied into \a versions. + /// This function returns extracted version numbers as a + /// llvm::VersionTuple. In case of error an empty VersionTuple is + /// returned. //------------------------------------------------------------------ - virtual uint32_t GetVersion(uint32_t *versions, uint32_t num_versions) { - if (versions && num_versions) { - for (uint32_t i = 0; i < num_versions; ++i) - versions[i] = UINT32_MAX; - } - return 0; - } + virtual llvm::VersionTuple GetVersion() { return llvm::VersionTuple(); } //------------------------------------------------------------------ /// Get the minimum OS version this object file can run on. /// - /// Some object files have information that specifies the minimum OS - /// version that they can be used on. - /// - /// If \a versions is NULL, or if \a num_versions is 0, the return - /// value will indicate how many version numbers are available in - /// this object file. Then a subsequent call can be made to this - /// function with a value of \a versions and \a num_versions that - /// has enough storage to store some or all version numbers. - /// - /// @param[out] versions - /// A pointer to an array of uint32_t types that is \a num_versions - /// long. If this value is NULL, the return value will indicate - /// how many version numbers are required for a subsequent call - /// to this function so that all versions can be retrieved. If - /// the value is non-NULL, then at most \a num_versions of the - /// existing versions numbers will be filled into \a versions. - /// If there is no version information available, \a versions - /// will be filled with \a num_versions UINT32_MAX values - /// and zero will be returned. - /// - /// @param[in] num_versions - /// The maximum number of entries to fill into \a versions. If - /// this value is zero, then the return value will indicate - /// how many version numbers there are in total so another call - /// to this function can be make with adequate storage in - /// \a versions to get all of the version numbers. If \a - /// num_versions is less than the actual number of version - /// numbers in this object file, only \a num_versions will be - /// filled into \a versions (if \a versions is non-NULL). + /// Some object files have information that specifies the minimum OS version + /// that they can be used on. /// /// @return - /// This function always returns the number of version numbers - /// that this object file has regardless of the number of - /// version numbers that were copied into \a versions. + /// This function returns extracted version numbers as a + /// llvm::VersionTuple. In case of error an empty VersionTuple is + /// returned. //------------------------------------------------------------------ - virtual uint32_t GetMinimumOSVersion(uint32_t *versions, - uint32_t num_versions) { - if (versions && num_versions) { - for (uint32_t i = 0; i < num_versions; ++i) - versions[i] = UINT32_MAX; - } - return 0; + virtual llvm::VersionTuple GetMinimumOSVersion() { + return llvm::VersionTuple(); } //------------------------------------------------------------------ @@ -762,12 +693,11 @@ public: //------------------------------------------------------------------ /// Return true if this file is a dynamic link editor (dyld) /// - /// Often times dyld has symbols that mirror symbols in libc and - /// other shared libraries (like "malloc" and "free") and the user - /// does _not_ want to stop in these shared libraries by default. - /// We can ask the ObjectFile if it is such a file and should be - /// avoided for things like settings breakpoints and doing function - /// lookups for expressions. + /// Often times dyld has symbols that mirror symbols in libc and other + /// shared libraries (like "malloc" and "free") and the user does _not_ want + /// to stop in these shared libraries by default. We can ask the ObjectFile + /// if it is such a file and should be avoided for things like settings + /// breakpoints and doing function lookups for expressions. //------------------------------------------------------------------ virtual bool GetIsDynamicLinkEditor() { return false; } @@ -786,10 +716,9 @@ public: return m_strata; } - // When an object file is in memory, subclasses should try and lock - // the process weak pointer. If the process weak pointer produces a - // valid ProcessSP, then subclasses can call this function to read - // memory. + // When an object file is in memory, subclasses should try and lock the + // process weak pointer. If the process weak pointer produces a valid + // ProcessSP, then subclasses can call this function to read memory. static lldb::DataBufferSP ReadMemory(const lldb::ProcessSP &process_sp, lldb::addr_t addr, size_t byte_size); @@ -809,8 +738,8 @@ public: size_t dst_len); // This function will transparently decompress section data if the section if - // compressed. Note that for compressed section the resulting data size may be - // larger than what Section::GetFileSize reports. + // compressed. Note that for compressed section the resulting data size may + // be larger than what Section::GetFileSize reports. virtual size_t ReadSectionData(Section *section, DataExtractor §ion_data); @@ -829,16 +758,16 @@ public: //------------------------------------------------------------------ /// Loads this objfile to memory. /// - /// Loads the bits needed to create an executable image to the memory. - /// It is useful with bare-metal targets where target does not have the - /// ability to start a process itself. + /// Loads the bits needed to create an executable image to the memory. It is + /// useful with bare-metal targets where target does not have the ability to + /// start a process itself. /// /// @param[in] target /// Target where to load. /// /// @return //------------------------------------------------------------------ - virtual Status LoadInMemory(Target &target, bool set_pc); + virtual std::vector<LoadableData> GetLoadableData(Target &target); protected: //------------------------------------------------------------------ @@ -864,9 +793,9 @@ protected: uint32_t m_synthetic_symbol_idx; //------------------------------------------------------------------ - /// Sets the architecture for a module. At present the architecture - /// can only be set if it is invalid. It is not allowed to switch from - /// one concrete architecture to another. + /// Sets the architecture for a module. At present the architecture can + /// only be set if it is invalid. It is not allowed to switch from one + /// concrete architecture to another. /// /// @param[in] new_arch /// The architecture this module will be set to. diff --git a/include/lldb/Symbol/Symbol.h b/include/lldb/Symbol/Symbol.h index 44c67f6f4716..9523158e0780 100644 --- a/include/lldb/Symbol/Symbol.h +++ b/include/lldb/Symbol/Symbol.h @@ -20,11 +20,9 @@ namespace lldb_private { class Symbol : public SymbolContextScope { public: - // ObjectFile readers can classify their symbol table entries and searches can - // be made - // on specific types where the symbol values will have drastically different - // meanings - // and sorting requirements. + // ObjectFile readers can classify their symbol table entries and searches + // can be made on specific types where the symbol values will have + // drastically different meanings and sorting requirements. Symbol(); Symbol(uint32_t symID, const char *name, bool name_is_mangled, @@ -52,56 +50,53 @@ public: bool ValueIsAddress() const; //------------------------------------------------------------------ - // The GetAddressRef() accessor functions should only be called if - // you previously call ValueIsAddress() otherwise you might get an - // reference to an Address object that contains an constant integer - // value in m_addr_range.m_base_addr.m_offset which could be - // incorrectly used to represent an absolute address since it has - // no section. + // The GetAddressRef() accessor functions should only be called if you + // previously call ValueIsAddress() otherwise you might get an reference to + // an Address object that contains an constant integer value in + // m_addr_range.m_base_addr.m_offset which could be incorrectly used to + // represent an absolute address since it has no section. //------------------------------------------------------------------ Address &GetAddressRef() { return m_addr_range.GetBaseAddress(); } const Address &GetAddressRef() const { return m_addr_range.GetBaseAddress(); } //------------------------------------------------------------------ - // Makes sure the symbol's value is an address and returns the file - // address. Returns LLDB_INVALID_ADDRESS if the symbol's value isn't - // an address. + // Makes sure the symbol's value is an address and returns the file address. + // Returns LLDB_INVALID_ADDRESS if the symbol's value isn't an address. //------------------------------------------------------------------ lldb::addr_t GetFileAddress() const; //------------------------------------------------------------------ - // Makes sure the symbol's value is an address and gets the load - // address using \a target if it is. Returns LLDB_INVALID_ADDRESS - // if the symbol's value isn't an address or if the section isn't - // loaded in \a target. + // Makes sure the symbol's value is an address and gets the load address + // using \a target if it is. Returns LLDB_INVALID_ADDRESS if the symbol's + // value isn't an address or if the section isn't loaded in \a target. //------------------------------------------------------------------ lldb::addr_t GetLoadAddress(Target *target) const; //------------------------------------------------------------------ - // Access the address value. Do NOT hand out the AddressRange as an - // object as the byte size of the address range may not be filled in - // and it should be accessed via GetByteSize(). + // Access the address value. Do NOT hand out the AddressRange as an object as + // the byte size of the address range may not be filled in and it should be + // accessed via GetByteSize(). //------------------------------------------------------------------ Address GetAddress() const { - // Make sure the our value is an address before we hand a copy out. - // We use the Address inside m_addr_range to contain the value for - // symbols that are not address based symbols so we are using it - // for more than just addresses. For example undefined symbols on - // MacOSX have a nlist.n_value of 0 (zero) and this will get placed - // into m_addr_range.m_base_addr.m_offset and it will have no section. - // So in the GetAddress() accessor, we need to hand out an invalid - // address if the symbol's value isn't an address. + // Make sure the our value is an address before we hand a copy out. We use + // the Address inside m_addr_range to contain the value for symbols that + // are not address based symbols so we are using it for more than just + // addresses. For example undefined symbols on MacOSX have a nlist.n_value + // of 0 (zero) and this will get placed into + // m_addr_range.m_base_addr.m_offset and it will have no section. So in the + // GetAddress() accessor, we need to hand out an invalid address if the + // symbol's value isn't an address. if (ValueIsAddress()) return m_addr_range.GetBaseAddress(); else return Address(); } - // When a symbol's value isn't an address, we need to access the raw - // value. This function will ensure this symbol's value isn't an address - // and return the integer value if this checks out, otherwise it will - // return "fail_value" if the symbol is an address value. + // When a symbol's value isn't an address, we need to access the raw value. + // This function will ensure this symbol's value isn't an address and return + // the integer value if this checks out, otherwise it will return + // "fail_value" if the symbol is an address value. uint64_t GetIntegerValue(uint64_t fail_value = 0) const { if (ValueIsAddress()) { // This symbol's value is an address. Use Symbol::GetAddress() to get the @@ -238,9 +233,8 @@ public: protected: // This is the internal guts of ResolveReExportedSymbol, it assumes - // reexport_name is not null, and that module_spec - // is valid. We track the modules we've already seen to make sure we don't - // get caught in a cycle. + // reexport_name is not null, and that module_spec is valid. We track the + // modules we've already seen to make sure we don't get caught in a cycle. Symbol *ResolveReExportedSymbolInModuleSpec( Target &target, ConstString &reexport_name, @@ -260,8 +254,8 @@ protected: m_size_is_sibling : 1, // m_size contains the index of this symbol's // sibling m_size_is_synthesized : 1, // non-zero if this symbol's size was - // calculated using a delta between this symbol - // and the next + // calculated using a delta between this + // symbol and the next m_size_is_valid : 1, m_demangled_is_synthesized : 1, // The demangled name was created should // not be used for expressions or other diff --git a/include/lldb/Symbol/SymbolContext.h b/include/lldb/Symbol/SymbolContext.h index f84b7cf916fe..0ec0006f193a 100644 --- a/include/lldb/Symbol/SymbolContext.h +++ b/include/lldb/Symbol/SymbolContext.h @@ -29,14 +29,12 @@ namespace lldb_private { class SymbolContextScope; //---------------------------------------------------------------------- -/// @class SymbolContext SymbolContext.h "lldb/Symbol/SymbolContext.h" -/// @brief Defines a symbol context baton that can be handed other debug -/// core functions. +/// @class SymbolContext SymbolContext.h "lldb/Symbol/SymbolContext.h" Defines +/// a symbol context baton that can be handed other debug core functions. /// -/// Many debugger functions require a context when doing lookups. This -/// class provides a common structure that can be used as the result -/// of a query that can contain a single result. Examples of such -/// queries include +/// Many debugger functions require a context when doing lookups. This class +/// provides a common structure that can be used as the result of a query that +/// can contain a single result. Examples of such queries include /// @li Looking up a load address. //---------------------------------------------------------------------- class SymbolContext { @@ -44,14 +42,14 @@ public: //------------------------------------------------------------------ /// Default constructor. /// - /// Initialize all pointer members to nullptr and all struct members - /// to their default state. + /// Initialize all pointer members to nullptr and all struct members to + /// their default state. //------------------------------------------------------------------ SymbolContext(); //------------------------------------------------------------------ - /// Construct with an object that knows how to reconstruct its - /// symbol context. + /// Construct with an object that knows how to reconstruct its symbol + /// context. /// /// @param[in] sc_scope /// A symbol context scope object that knows how to reconstruct @@ -60,8 +58,8 @@ public: explicit SymbolContext(SymbolContextScope *sc_scope); //------------------------------------------------------------------ - /// Construct with module, and optional compile unit, function, - /// block, line table, line entry and symbol. + /// Construct with module, and optional compile unit, function, block, line + /// table, line entry and symbol. /// /// Initialize all pointer to the specified values. /// @@ -112,8 +110,8 @@ public: //------------------------------------------------------------------ /// Assignment operator. /// - /// Copies the address value from another SymbolContext object \a - /// rhs into \a this object. + /// Copies the address value from another SymbolContext object \a rhs into + /// \a this object. /// /// @param[in] rhs /// A const SymbolContext object reference to copy. @@ -126,16 +124,16 @@ public: //------------------------------------------------------------------ /// Clear the object's state. /// - /// Resets all pointer members to nullptr, and clears any class objects - /// to their default state. + /// Resets all pointer members to nullptr, and clears any class objects to + /// their default state. //------------------------------------------------------------------ void Clear(bool clear_target); //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// - /// Dump a description of the contents of this object to the - /// supplied stream \a s. + /// Dump a description of the contents of this object to the supplied stream + /// \a s. /// /// @param[in] s /// The stream to which to dump the object description. @@ -145,13 +143,12 @@ public: //------------------------------------------------------------------ /// Dump the stop context in this object to a Stream. /// - /// Dump the best description of this object to the stream. The - /// information displayed depends on the amount and quality of the - /// information in this context. If a module, function, file and - /// line number are available, they will be dumped. If only a - /// module and function or symbol name with offset is available, - /// that will be output. Else just the address at which the target - /// was stopped will be displayed. + /// Dump the best description of this object to the stream. The information + /// displayed depends on the amount and quality of the information in this + /// context. If a module, function, file and line number are available, they + /// will be dumped. If only a module and function or symbol name with offset + /// is available, that will be output. Else just the address at which the + /// target was stopped will be displayed. /// /// @param[in] s /// The stream to which to dump the object description. @@ -267,21 +264,21 @@ public: lldb::LanguageType GetLanguage() const; //------------------------------------------------------------------ - /// Find a block that defines the function represented by this - /// symbol context. + /// Find a block that defines the function represented by this symbol + /// context. /// - /// If this symbol context points to a block that is an inlined - /// function, or is contained within an inlined function, the block - /// that defines the inlined function is returned. + /// If this symbol context points to a block that is an inlined function, or + /// is contained within an inlined function, the block that defines the + /// inlined function is returned. /// - /// If this symbol context has no block in it, or the block is not - /// itself an inlined function block or contained within one, we - /// return the top level function block. + /// If this symbol context has no block in it, or the block is not itself an + /// inlined function block or contained within one, we return the top level + /// function block. /// - /// This is a handy function to call when you want to get the block - /// whose variable list will include the arguments for the function - /// that is represented by this symbol context (whether the function - /// is an inline function or not). + /// This is a handy function to call when you want to get the block whose + /// variable list will include the arguments for the function that is + /// represented by this symbol context (whether the function is an inline + /// function or not). /// /// @return /// The block object pointer that defines the function that is @@ -290,8 +287,8 @@ public: Block *GetFunctionBlock(); //------------------------------------------------------------------ - /// If this symbol context represents a function that is a method, - /// return true and provide information about the method. + /// If this symbol context represents a function that is a method, return + /// true and provide information about the method. /// /// @param[out] language /// If \b true is returned, the language for the method. @@ -313,8 +310,7 @@ public: ConstString &language_object_name); //------------------------------------------------------------------ - /// Sorts the types in TypeMap according to SymbolContext - /// to TypeList + /// Sorts the types in TypeMap according to SymbolContext to TypeList /// //------------------------------------------------------------------ void SortTypeList(TypeMap &type_map, TypeList &type_list) const; @@ -322,8 +318,8 @@ public: //------------------------------------------------------------------ /// Find a name of the innermost function for the symbol context. /// - /// For instance, if the symbol context contains an inlined block, - /// it will return the inlined function name. + /// For instance, if the symbol context contains an inlined block, it will + /// return the inlined function name. /// /// @param[in] prefer_mangled /// if \btrue, then the mangled name will be returned if there @@ -339,14 +335,13 @@ public: //------------------------------------------------------------------ /// Get the line entry that corresponds to the function. /// - /// If the symbol context contains an inlined block, the line entry - /// for the start address of the inlined function will be returned, - /// otherwise the line entry for the start address of the function - /// will be returned. This can be used after doing a - /// Module::FindFunctions(...) or ModuleList::FindFunctions(...) - /// call in order to get the correct line table information for - /// the symbol context. - /// it will return the inlined function name. + /// If the symbol context contains an inlined block, the line entry for the + /// start address of the inlined function will be returned, otherwise the + /// line entry for the start address of the function will be returned. This + /// can be used after doing a Module::FindFunctions(...) or + /// ModuleList::FindFunctions(...) call in order to get the correct line + /// table information for the symbol context. it will return the inlined + /// function name. /// /// @param[in] prefer_mangled /// if \btrue, then the mangled name will be returned if there @@ -361,8 +356,8 @@ public: //------------------------------------------------------------------ /// Find the block containing the inlined block that contains this block. /// - /// For instance, if the symbol context contains an inlined block, - /// it will return the inlined function name. + /// For instance, if the symbol context contains an inlined block, it will + /// return the inlined function name. /// /// @param[in] curr_frame_pc /// The address within the block of this object. @@ -440,11 +435,11 @@ private: //---------------------------------------------------------------------- /// @class SymbolContextList SymbolContext.h "lldb/Symbol/SymbolContext.h" -/// @brief Defines a list of symbol context objects. +/// Defines a list of symbol context objects. /// -/// This class provides a common structure that can be used to contain -/// the result of a query that can contain a multiple results. Examples -/// of such queries include: +/// This class provides a common structure that can be used to contain the +/// result of a query that can contain a multiple results. Examples of such +/// queries include: /// @li Looking up a function by name. /// @li Finding all addresses for a specified file and line number. //---------------------------------------------------------------------- @@ -491,8 +486,8 @@ public: //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// - /// Dump a description of the contents of each symbol context in - /// the list to the supplied stream \a s. + /// Dump a description of the contents of each symbol context in the list to + /// the supplied stream \a s. /// /// @param[in] s /// The stream to which to dump the object description. @@ -502,8 +497,8 @@ public: //------------------------------------------------------------------ /// Get accessor for a symbol context at index \a idx. /// - /// Dump a description of the contents of each symbol context in - /// the list to the supplied stream \a s. + /// Dump a description of the contents of each symbol context in the list to + /// the supplied stream \a s. /// /// @param[in] idx /// The zero based index into the symbol context list. @@ -521,8 +516,8 @@ public: //------------------------------------------------------------------ /// Direct reference accessor for a symbol context at index \a idx. /// - /// The index \a idx must be a valid index, no error checking will - /// be done to ensure that it is valid. + /// The index \a idx must be a valid index, no error checking will be done + /// to ensure that it is valid. /// /// @param[in] idx /// The zero based index into the symbol context list. diff --git a/include/lldb/Symbol/SymbolContextScope.h b/include/lldb/Symbol/SymbolContextScope.h index 926e34bc03a2..c2fbb5272fc0 100644 --- a/include/lldb/Symbol/SymbolContextScope.h +++ b/include/lldb/Symbol/SymbolContextScope.h @@ -20,16 +20,15 @@ namespace lldb_private { //---------------------------------------------------------------------- /// @class SymbolContextScope SymbolContextScope.h -/// "lldb/Symbol/SymbolContextScope.h" -/// @brief Inherit from this if your object is part of a symbol context +/// "lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is +/// part of a symbol context /// and can reconstruct its symbol context. /// -/// Many objects that are part of a symbol context that have pointers -/// back to parent objects that own them. Any members of a symbol -/// context that, once they are built, will not go away, can inherit -/// from this pure virtual class and can then reconstruct their symbol -/// context without having to keep a complete SymbolContext object in -/// the object. +/// Many objects that are part of a symbol context that have pointers back to +/// parent objects that own them. Any members of a symbol context that, once +/// they are built, will not go away, can inherit from this pure virtual class +/// and can then reconstruct their symbol context without having to keep a +/// complete SymbolContext object in the object. /// /// Examples of these objects include: /// @li Module @@ -38,14 +37,14 @@ namespace lldb_private { /// @li Block /// @li Symbol /// -/// Other objects can store a "SymbolContextScope *" using any pointers -/// to one of the above objects. This allows clients to hold onto a -/// pointer that uniquely will identify a symbol context. Those clients -/// can then always reconstruct the symbol context using the pointer, or -/// use it to uniquely identify a symbol context for an object. +/// Other objects can store a "SymbolContextScope *" using any pointers to one +/// of the above objects. This allows clients to hold onto a pointer that +/// uniquely will identify a symbol context. Those clients can then always +/// reconstruct the symbol context using the pointer, or use it to uniquely +/// identify a symbol context for an object. /// -/// Example objects include that currently use "SymbolContextScope *" -/// objects include: +/// Example objects include that currently use "SymbolContextScope *" objects +/// include: /// @li Variable objects that can reconstruct where they are scoped /// by making sure the SymbolContextScope * comes from the scope /// in which the variable was declared. If a variable is a global, @@ -63,11 +62,11 @@ namespace lldb_private { /// location) match within the same thread, that the stack /// frame is the same as the previous stack frame. /// -/// Objects that adhere to this protocol can reconstruct enough of a -/// symbol context to allow functions that take a symbol context to be -/// called. Lists can also be created using a SymbolContextScope* and -/// and object pairs that allow large collections of objects to be -/// passed around with minimal overhead. +/// Objects that adhere to this protocol can reconstruct enough of a symbol +/// context to allow functions that take a symbol context to be called. Lists +/// can also be created using a SymbolContextScope* and and object pairs that +/// allow large collections of objects to be passed around with minimal +/// overhead. //---------------------------------------------------------------------- class SymbolContextScope { public: @@ -76,9 +75,9 @@ public: //------------------------------------------------------------------ /// Reconstruct the object's symbol context into \a 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. + /// 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. /// /// @param[out] sc /// A symbol context object pointer that gets filled in. @@ -100,9 +99,9 @@ public: //------------------------------------------------------------------ /// Dump the object's symbol context to the stream \a s. /// - /// The object should dump its symbol context to the stream \a s. - /// This function is widely used in the DumpDebug and verbose output - /// for lldb objects. + /// The object should dump its symbol context to the stream \a s. This + /// function is widely used in the DumpDebug and verbose output for lldb + /// objects. /// /// @param[in] s /// The stream to which to dump the object's symbol context. diff --git a/include/lldb/Symbol/SymbolFile.h b/include/lldb/Symbol/SymbolFile.h index 69110dc68cd7..7b77c60a3c3d 100644 --- a/include/lldb/Symbol/SymbolFile.h +++ b/include/lldb/Symbol/SymbolFile.h @@ -26,10 +26,10 @@ public: //------------------------------------------------------------------ // Symbol file ability bits. // - // Each symbol file can claim to support one or more symbol file - // abilities. These get returned from SymbolFile::GetAbilities(). - // These help us to determine which plug-in will be best to load - // the debug information found in files. + // Each symbol file can claim to support one or more symbol file abilities. + // These get returned from SymbolFile::GetAbilities(). These help us to + // determine which plug-in will be best to load the debug information found + // in files. //------------------------------------------------------------------ enum Abilities { CompileUnits = (1u << 0), @@ -148,10 +148,10 @@ public: SymbolContextList &sc_list); virtual uint32_t FindGlobalVariables(const ConstString &name, - const CompilerDeclContext *parent_decl_ctx, bool append, + const CompilerDeclContext *parent_decl_ctx, uint32_t max_matches, VariableList &variables); virtual uint32_t FindGlobalVariables(const RegularExpression ®ex, - bool append, uint32_t max_matches, + uint32_t max_matches, VariableList &variables); virtual uint32_t FindFunctions(const ConstString &name, const CompilerDeclContext *parent_decl_ctx, @@ -200,6 +200,8 @@ public: //------------------------------------------------------------------ virtual void SectionFileAddressesChanged() {} + virtual void Dump(Stream &s) {} + protected: ObjectFile *m_obj_file; // The object file that symbols can be extracted from. uint32_t m_abilities; diff --git a/include/lldb/Symbol/SymbolVendor.h b/include/lldb/Symbol/SymbolVendor.h index 7db3de6e690c..312b146f2970 100644 --- a/include/lldb/Symbol/SymbolVendor.h +++ b/include/lldb/Symbol/SymbolVendor.h @@ -22,14 +22,13 @@ namespace lldb_private { //---------------------------------------------------------------------- -// The symbol vendor class is designed to abstract the process of -// searching for debug information for a given module. Platforms can -// subclass this class and provide extra ways to find debug information. -// Examples would be a subclass that would allow for locating a stand -// alone debug file, parsing debug maps, or runtime data in the object -// files. A symbol vendor can use multiple sources (SymbolFile -// objects) to provide the information and only parse as deep as needed -// in order to provide the information that is requested. +// The symbol vendor class is designed to abstract the process of searching for +// debug information for a given module. Platforms can subclass this class and +// provide extra ways to find debug information. Examples would be a subclass +// that would allow for locating a stand alone debug file, parsing debug maps, +// or runtime data in the object files. A symbol vendor can use multiple +// sources (SymbolFile objects) to provide the information and only parse as +// deep as needed in order to provide the information that is requested. //---------------------------------------------------------------------- class SymbolVendor : public ModuleChild, public PluginInterface { public: @@ -82,11 +81,11 @@ public: virtual size_t FindGlobalVariables(const ConstString &name, const CompilerDeclContext *parent_decl_ctx, - bool append, size_t max_matches, + size_t max_matches, VariableList &variables); virtual size_t FindGlobalVariables(const RegularExpression ®ex, - bool append, size_t max_matches, + size_t max_matches, VariableList &variables); virtual size_t FindFunctions(const ConstString &name, diff --git a/include/lldb/Symbol/Type.h b/include/lldb/Symbol/Type.h index 9740dc25a587..fec2578c9fec 100644 --- a/include/lldb/Symbol/Type.h +++ b/include/lldb/Symbol/Type.h @@ -24,8 +24,8 @@ namespace lldb_private { //---------------------------------------------------------------------- -// CompilerContext allows an array of these items to be passed to -// perform detailed lookups in SymbolVendor and SymbolFile functions. +// CompilerContext allows an array of these items to be passed to perform +// detailed lookups in SymbolVendor and SymbolFile functions. //---------------------------------------------------------------------- struct CompilerContext { CompilerContext(CompilerContextKind t, const ConstString &n) @@ -82,16 +82,12 @@ public: eEncodingIsSyntheticUID } EncodingDataType; - // We must force the underlying type of the enum to be unsigned here. Not all - // compilers - // behave the same with regards to the default underlying type of an enum, but - // because - // this enum is used in an enum bitfield and integer comparisons are done with - // the value - // we need to guarantee that it's always unsigned so that, for example, - // eResolveStateFull - // doesn't compare less than eResolveStateUnresolved when used in a 2-bit - // bitfield. + // We must force the underlying type of the enum to be unsigned here. Not + // all compilers behave the same with regards to the default underlying type + // of an enum, but because this enum is used in an enum bitfield and integer + // comparisons are done with the value we need to guarantee that it's always + // unsigned so that, for example, eResolveStateFull doesn't compare less than + // eResolveStateUnresolved when used in a 2-bit bitfield. typedef enum ResolveStateTag : unsigned { eResolveStateUnresolved = 0, eResolveStateForward = 1, @@ -106,8 +102,7 @@ public: ResolveState compiler_type_resolve_state); // This makes an invalid type. Used for functions that return a Type when - // they - // get an error. + // they get an error. Type(); Type(const Type &rhs); @@ -119,7 +114,8 @@ public: void DumpTypeName(Stream *s); // Since Type instances only keep a "SymbolFile *" internally, other classes - // like TypeImpl need make sure the module is still around before playing with + // like TypeImpl need make sure the module is still around before playing + // with // Type instances. They can store a weak pointer to the Module; lldb::ModuleSP GetModule(); @@ -188,8 +184,8 @@ public: CompilerType GetFullCompilerType(); // Get the clang type, and resolve definitions enough so that the type could - // have layout performed. This allows ptrs and refs to class/struct/union/enum - // types remain forward declarations. + // have layout performed. This allows ptrs and refs to + // class/struct/union/enum types remain forward declarations. CompilerType GetLayoutCompilerType(); // Get the clang type and leave class/struct/union/enum types as forward @@ -198,8 +194,8 @@ public: static int Compare(const Type &a, const Type &b); - // From a fully qualified typename, split the type into the type basename - // and the remaining type scope (namespaces/classes). + // From a fully qualified typename, split the type into the type basename and + // the remaining type scope (namespaces/classes). static bool GetTypeScopeAndBasename(const llvm::StringRef& name, llvm::StringRef &scope, llvm::StringRef &basename, @@ -366,8 +362,8 @@ protected: lldb::TypeSP type_sp; }; -// the two classes here are used by the public API as a backend to -// the SBType and SBTypeList classes +// the two classes here are used by the public API as a backend to the SBType +// and SBTypeList classes class TypeImpl { public: diff --git a/include/lldb/Symbol/TypeSystem.h b/include/lldb/Symbol/TypeSystem.h index ff85d8428746..94d1b9cdf3fd 100644 --- a/include/lldb/Symbol/TypeSystem.h +++ b/include/lldb/Symbol/TypeSystem.h @@ -66,8 +66,8 @@ public: // { // } // - // Then you can use the llvm casting on any "TypeSystem *" to get an - // instance of your subclass. + // Then you can use the llvm casting on any "TypeSystem *" to get an instance + // of your subclass. //---------------------------------------------------------------------- enum LLVMCastKind { eKindClang, @@ -94,8 +94,7 @@ public: Target *target); // Free up any resources associated with this TypeSystem. Done before - // removing - // all the TypeSystems from the TypeSystemMap. + // removing all the TypeSystems from the TypeSystemMap. virtual void Finalize() {} virtual DWARFASTParser *GetDWARFParser() { return nullptr; } @@ -239,8 +238,7 @@ public: virtual CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) = 0; // Returns -1 if this isn't a function of if the function doesn't have a - // prototype - // Returns a value >= 0 if there is a prototype. + // prototype Returns a value >= 0 if there is a prototype. virtual int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) = 0; virtual CompilerType @@ -332,8 +330,8 @@ public: bool &child_is_base_class, bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags) = 0; - // Lookup a child given a name. This function will match base class names - // and member member names in "clang_type" only, not descendants. + // Lookup a child given a name. This function will match base class names and + // member member names in "clang_type" only, not descendants. virtual uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes) = 0; @@ -395,8 +393,8 @@ public: lldb::offset_t data_offset, size_t data_byte_size) = 0; - // Converts "s" to a floating point value and place resulting floating - // point bytes in the "dst" buffer. + // Converts "s" to a floating point value and place resulting floating point + // bytes in the "dst" buffer. virtual size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, const char *s, uint8_t *dst, size_t dst_size) = 0; @@ -481,23 +479,17 @@ public: virtual LazyBool ShouldPrintAsOneLiner(void *type, ValueObject *valobj); // Type systems can have types that are placeholder types, which are meant to - // indicate - // the presence of a type, but offer no actual information about said types, - // and leave - // the burden of actually figuring type information out to dynamic type - // resolution. For instance - // a language with a generics system, can use placeholder types to indicate - // "type argument goes here", - // without promising uniqueness of the placeholder, nor attaching any actually - // idenfiable information - // to said placeholder. This API allows type systems to tell LLDB when such a - // type has been encountered - // In response, the debugger can react by not using this type as a cache entry - // in any type-specific way - // For instance, LLDB will currently not cache any formatters that are - // discovered on such a type as - // attributable to the meaningless type itself, instead preferring to use the - // dynamic type + // indicate the presence of a type, but offer no actual information about + // said types, and leave the burden of actually figuring type information out + // to dynamic type resolution. For instance a language with a generics + // system, can use placeholder types to indicate "type argument goes here", + // without promising uniqueness of the placeholder, nor attaching any + // actually idenfiable information to said placeholder. This API allows type + // systems to tell LLDB when such a type has been encountered In response, + // the debugger can react by not using this type as a cache entry in any + // type-specific way For instance, LLDB will currently not cache any + // formatters that are discovered on such a type as attributable to the + // meaningless type itself, instead preferring to use the dynamic type virtual bool IsMeaninglessWithoutDynamicResolution(void *type); protected: @@ -514,8 +506,8 @@ public: // empties the map. void Clear(); - // Iterate through all of the type systems that are created. Return true - // from callback to keep iterating, false to stop iterating. + // Iterate through all of the type systems that are created. Return true from + // callback to keep iterating, false to stop iterating. void ForEach(std::function<bool(TypeSystem *)> const &callback); TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language, diff --git a/include/lldb/Symbol/UnwindPlan.h b/include/lldb/Symbol/UnwindPlan.h index abb57a2c499d..a76ea23b46bc 100644 --- a/include/lldb/Symbol/UnwindPlan.h +++ b/include/lldb/Symbol/UnwindPlan.h @@ -25,28 +25,25 @@ namespace lldb_private { -// The UnwindPlan object specifies how to unwind out of a function - where -// this function saves the caller's register values before modifying them -// (for non-volatile aka saved registers) and how to find this frame's -// Canonical Frame Address (CFA). +// The UnwindPlan object specifies how to unwind out of a function - where this +// function saves the caller's register values before modifying them (for non- +// volatile aka saved registers) and how to find this frame's Canonical Frame +// Address (CFA). -// Most commonly, registers are saved on the stack, offset some bytes from -// the Canonical Frame Address, or CFA, which is the starting address of -// this function's stack frame (the CFA is same as the eh_frame's CFA, -// whatever that may be on a given architecture). -// The CFA address for the stack frame does not change during -// the lifetime of the function. +// Most commonly, registers are saved on the stack, offset some bytes from the +// Canonical Frame Address, or CFA, which is the starting address of this +// function's stack frame (the CFA is same as the eh_frame's CFA, whatever that +// may be on a given architecture). The CFA address for the stack frame does +// not change during the lifetime of the function. // Internally, the UnwindPlan is structured as a vector of register locations // organized by code address in the function, showing which registers have been -// saved at that point and where they are saved. -// It can be thought of as the expanded table form of the DWARF CFI -// encoded information. +// saved at that point and where they are saved. It can be thought of as the +// expanded table form of the DWARF CFI encoded information. // Other unwind information sources will be converted into UnwindPlans before -// being added to a FuncUnwinders object. The unwind source may be -// an eh_frame FDE, a DWARF debug_frame FDE, or assembly language based -// prologue analysis. +// being added to a FuncUnwinders object. The unwind source may be an eh_frame +// FDE, a DWARF debug_frame FDE, or assembly language based prologue analysis. // The UnwindPlan is the canonical form of this information that the unwinder // code will use when walking the stack. @@ -371,12 +368,10 @@ public: void InsertRow(const RowSP &row_sp, bool replace_existing = false); // Returns a pointer to the best row for the given offset into the function's - // instructions. - // If offset is -1 it indicates that the function start is unknown - the final - // row in the UnwindPlan is returned. - // In practice, the UnwindPlan for a function with no known start address will - // be the architectural default - // UnwindPlan which will only have one row. + // instructions. If offset is -1 it indicates that the function start is + // unknown - the final row in the UnwindPlan is returned. In practice, the + // UnwindPlan for a function with no known start address will be the + // architectural default UnwindPlan which will only have one row. UnwindPlan::RowSP GetRowForFunctionOffset(int offset) const; lldb::RegisterKind GetRegisterKind() const { return m_register_kind; } @@ -427,15 +422,13 @@ public: } // Is this UnwindPlan valid at all instructions? If not, then it is assumed - // valid at call sites, - // e.g. for exception handling. + // valid at call sites, e.g. for exception handling. lldb_private::LazyBool GetUnwindPlanValidAtAllInstructions() const { return m_plan_is_valid_at_all_instruction_locations; } // Is this UnwindPlan valid at all instructions? If not, then it is assumed - // valid at call sites, - // e.g. for exception handling. + // valid at call sites, e.g. for exception handling. void SetUnwindPlanValidAtAllInstructions( lldb_private::LazyBool valid_at_all_insn) { m_plan_is_valid_at_all_instruction_locations = valid_at_all_insn; diff --git a/include/lldb/Symbol/UnwindTable.h b/include/lldb/Symbol/UnwindTable.h index 851d24bea03b..5c83e3003192 100644 --- a/include/lldb/Symbol/UnwindTable.h +++ b/include/lldb/Symbol/UnwindTable.h @@ -18,8 +18,8 @@ namespace lldb_private { // A class which holds all the FuncUnwinders objects for a given ObjectFile. -// The UnwindTable is populated with FuncUnwinders objects lazily during -// the debug session. +// The UnwindTable is populated with FuncUnwinders objects lazily during the +// debug session. class UnwindTable { public: @@ -39,16 +39,13 @@ public: bool GetAllowAssemblyEmulationUnwindPlans(); // Normally when we create a new FuncUnwinders object we track it in this - // UnwindTable so it can - // be reused later. But for the target modules show-unwind we want to create - // brand new - // UnwindPlans for the function of interest - so ignore any existing - // FuncUnwinders for that - // function and don't add this new one to our UnwindTable. - // This FuncUnwinders object does have a reference to the UnwindTable but the - // lifetime of this - // uncached FuncUnwinders is expected to be short so in practice this will not - // be a problem. + // UnwindTable so it can be reused later. But for the target modules show- + // unwind we want to create brand new UnwindPlans for the function of + // interest - so ignore any existing FuncUnwinders for that function and + // don't add this new one to our UnwindTable. This FuncUnwinders object does + // have a reference to the UnwindTable but the lifetime of this uncached + // FuncUnwinders is expected to be short so in practice this will not be a + // problem. lldb::FuncUnwindersSP GetUncachedFuncUnwindersContainingAddress(const Address &addr, SymbolContext &sc); diff --git a/include/lldb/Symbol/Variable.h b/include/lldb/Symbol/Variable.h index 507b41309042..531312e63591 100644 --- a/include/lldb/Symbol/Variable.h +++ b/include/lldb/Symbol/Variable.h @@ -17,6 +17,7 @@ #include "lldb/Core/RangeMap.h" #include "lldb/Expression/DWARFExpression.h" #include "lldb/Symbol/Declaration.h" +#include "lldb/Utility/CompletionRequest.h" #include "lldb/Utility/UserID.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-private.h" @@ -53,11 +54,11 @@ public: SymbolContextScope *GetSymbolContextScope() const { return m_owner_scope; } - // Since a variable can have a basename "i" and also a mangled - // named "_ZN12_GLOBAL__N_11iE" and a demangled mangled name - // "(anonymous namespace)::i", this function will allow a generic match - // function that can be called by commands and expression parsers to make - // sure we match anything we come across. + // Since a variable can have a basename "i" and also a mangled named + // "_ZN12_GLOBAL__N_11iE" and a demangled mangled name "(anonymous + // namespace)::i", this function will allow a generic match function that can + // be called by commands and expression parsers to make sure we match + // anything we come across. bool NameMatches(const ConstString &name) const; bool NameMatches(const RegularExpression ®ex) const; @@ -103,8 +104,7 @@ public: ValueObjectList &valobj_list); static size_t AutoComplete(const ExecutionContext &exe_ctx, - llvm::StringRef name, StringList &matches, - bool &word_complete); + CompletionRequest &request); CompilerDeclContext GetDeclContext(); diff --git a/include/lldb/Symbol/VariableList.h b/include/lldb/Symbol/VariableList.h index c9e0be89a3bc..6729a9c108a9 100644 --- a/include/lldb/Symbol/VariableList.h +++ b/include/lldb/Symbol/VariableList.h @@ -50,11 +50,11 @@ public: size_t AppendVariablesIfUnique(VariableList &var_list); - // Returns the actual number of unique variables that were added to the - // list. "total_matches" will get updated with the actually number of - // matches that were found regardless of whether they were unique or not - // to allow for error conditions when nothing is found, versus conditions - // where any variables that match "regex" were already in "var_list". + // Returns the actual number of unique variables that were added to the list. + // "total_matches" will get updated with the actually number of matches that + // were found regardless of whether they were unique or not to allow for + // error conditions when nothing is found, versus conditions where any + // variables that match "regex" were already in "var_list". size_t AppendVariablesIfUnique(const RegularExpression ®ex, VariableList &var_list, size_t &total_matches); @@ -66,6 +66,7 @@ public: size_t MemorySize() const; size_t GetSize() const; + bool Empty() const { return m_variables.empty(); } protected: typedef std::vector<lldb::VariableSP> collection; |
