diff options
Diffstat (limited to 'include/lldb/Symbol')
24 files changed, 357 insertions, 105 deletions
diff --git a/include/lldb/Symbol/Block.h b/include/lldb/Symbol/Block.h index 4a305e3cbbec..59671b00b3b8 100644 --- a/include/lldb/Symbol/Block.h +++ b/include/lldb/Symbol/Block.h @@ -29,13 +29,13 @@ namespace lldb_private { /// 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 adress range, and each block can +/// 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. /// -/// Inlined functions are representated by attaching a +/// Inlined functions are represented by attaching a /// InlineFunctionInfo shared pointer object to a block. Inlined /// functions are represented as named blocks. //---------------------------------------------------------------------- @@ -169,7 +169,7 @@ public: /// Dump the block contents. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. /// /// @param[in] base_addr /// The resolved start address of the Function's address @@ -348,7 +348,7 @@ public: /// Get const accessor for any inlined function information. /// /// @return - /// A comst pointer to any inlined function information, or NULL + /// A const pointer to any inlined function information, or NULL /// if this is a regular block. //------------------------------------------------------------------ const InlineFunctionInfo* @@ -455,7 +455,7 @@ public: GetRangeIndexContainingAddress (const Address& addr); //------------------------------------------------------------------ - // Since blocks might have multiple discontiguous addresss ranges, + // 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 @@ -477,7 +477,7 @@ protected: collection m_children; RangeList m_ranges; lldb::InlineFunctionInfoSP m_inlineInfoSP; ///< Inlined function information. - lldb::VariableListSP m_variable_list_sp; ///< The variable list for all local, static and paramter variables scoped to this block. + lldb::VariableListSP m_variable_list_sp; ///< The variable list for all local, static and parameter variables scoped to this block. bool m_parsed_block_info:1, ///< Set to true if this block and it's children have all been parsed m_parsed_block_variables:1, m_parsed_child_blocks:1; diff --git a/include/lldb/Symbol/ClangASTContext.h b/include/lldb/Symbol/ClangASTContext.h index 75fc07b480e1..2bb911c6e566 100644 --- a/include/lldb/Symbol/ClangASTContext.h +++ b/include/lldb/Symbol/ClangASTContext.h @@ -18,7 +18,6 @@ #include <vector> // Other libraries and framework includes -#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallVector.h" #include "clang/AST/TemplateBase.h" @@ -44,6 +43,9 @@ public: ClangASTContext (const char *triple = NULL); ~ClangASTContext(); + + static ClangASTContext* + GetASTContext (clang::ASTContext* ast_ctx); clang::ASTContext * getASTContext(); @@ -72,8 +74,7 @@ public: clang::DiagnosticConsumer * getDiagnosticConsumer(); - clang::TargetOptions * - getTargetOptions(); + std::shared_ptr<clang::TargetOptions> &getTargetOptions(); clang::TargetInfo * getTargetInfo(); @@ -94,7 +95,7 @@ public: HasExternalSource (); void - SetExternalSource (llvm::OwningPtr<clang::ExternalASTSource> &ast_source_ap); + SetExternalSource (llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_ap); void RemoveExternalSource (); @@ -259,8 +260,8 @@ public: return 0; } - llvm::SmallVector<const char *, 8> names; - llvm::SmallVector<clang::TemplateArgument, 8> args; + llvm::SmallVector<const char *, 2> names; + llvm::SmallVector<clang::TemplateArgument, 2> args; }; clang::FunctionTemplateDecl * @@ -395,6 +396,29 @@ public: const ClangASTType &integer_qual_type); //------------------------------------------------------------------ + // Integer type functions + //------------------------------------------------------------------ + + ClangASTType + GetIntTypeFromBitSize (size_t bit_size, bool is_signed) + { + return GetIntTypeFromBitSize (getASTContext(), bit_size, is_signed); + } + + static ClangASTType + GetIntTypeFromBitSize (clang::ASTContext *ast, + size_t bit_size, bool is_signed); + + ClangASTType + GetPointerSizedIntType (bool is_signed) + { + return GetPointerSizedIntType (getASTContext(), is_signed); + } + + static ClangASTType + GetPointerSizedIntType (clang::ASTContext *ast, bool is_signed); + + //------------------------------------------------------------------ // Floating point functions //------------------------------------------------------------------ @@ -419,7 +443,7 @@ protected: std::unique_ptr<clang::SourceManager> m_source_manager_ap; std::unique_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_ap; std::unique_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_ap; - llvm::IntrusiveRefCntPtr<clang::TargetOptions> m_target_options_rp; + std::shared_ptr<clang::TargetOptions> m_target_options_rp; std::unique_ptr<clang::TargetInfo> m_target_info_ap; std::unique_ptr<clang::IdentifierTable> m_identifier_table_ap; std::unique_ptr<clang::SelectorTable> m_selector_table_ap; diff --git a/include/lldb/Symbol/ClangASTImporter.h b/include/lldb/Symbol/ClangASTImporter.h index dc6ce6b5b95b..ee4fcada8a6d 100644 --- a/include/lldb/Symbol/ClangASTImporter.h +++ b/include/lldb/Symbol/ClangASTImporter.h @@ -166,7 +166,7 @@ public: void BuildNamespaceMap (const clang::NamespaceDecl *decl); // - // Comleters for maps + // Completers for maps // class MapCompleter diff --git a/include/lldb/Symbol/ClangASTType.h b/include/lldb/Symbol/ClangASTType.h index 19b5d6ec6727..4dd17031e568 100644 --- a/include/lldb/Symbol/ClangASTType.h +++ b/include/lldb/Symbol/ClangASTType.h @@ -155,6 +155,9 @@ public: bool IsFunctionType (bool *is_variadic_ptr = NULL) const; + uint32_t + IsHomogeneousAggregate (ClangASTType* base_type_ptr) const; + size_t GetNumberOfFunctionArguments () const; @@ -210,7 +213,7 @@ public: IsPointerOrReferenceType (ClangASTType *pointee_type = NULL) const; bool - IsReferenceType (ClangASTType *pointee_type = NULL) const; + IsReferenceType (ClangASTType *pointee_type = nullptr, bool* is_rvalue = nullptr) const; bool IsScalarType () const; @@ -261,6 +264,9 @@ public: ConstString GetTypeName () const; + ConstString + GetDisplayTypeName () const; + uint32_t GetTypeInfo (ClangASTType *pointee_or_element_clang_type = NULL) const; @@ -309,7 +315,7 @@ public: clang::DeclContext *decl_ctx) const; ClangASTType - GetArrayElementType (uint64_t& stride) const; + GetArrayElementType (uint64_t *stride = nullptr) const; ClangASTType GetCanonicalType () const; @@ -317,7 +323,7 @@ public: ClangASTType GetFullyUnqualifiedType () const; - // Returns -1 if this isn't a function of if the fucntion doesn't have a prototype + // 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. int GetFunctionArgumentCount () const; @@ -420,7 +426,6 @@ public: ClangASTType GetChildClangTypeAtIndex (ExecutionContext *exe_ctx, - const char *parent_name, size_t idx, bool transparent_pointers, bool omit_empty_base_classes, @@ -431,7 +436,8 @@ public: uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset, bool &child_is_base_class, - bool &child_is_deref_of_parent) const; + bool &child_is_deref_of_parent, + ValueObject *valobj) const; // Lookup a child given a name. This function will match base class names // and member member names in "clang_type" only, not descendants. @@ -641,6 +647,9 @@ public: AddressType address_type, StreamString &new_value); + clang::EnumDecl * + GetAsEnumDecl () const; + clang::RecordDecl * GetAsRecordDecl () const; diff --git a/include/lldb/Symbol/ClangExternalASTSourceCommon.h b/include/lldb/Symbol/ClangExternalASTSourceCommon.h index 72d77e74ca90..20c4b4354367 100644 --- a/include/lldb/Symbol/ClangExternalASTSourceCommon.h +++ b/include/lldb/Symbol/ClangExternalASTSourceCommon.h @@ -11,7 +11,7 @@ #define liblldb_ClangExternalASTSourceCommon_h // Clang headers like to use NDEBUG inside of them to enable/disable debug -// releated features using "#ifndef NDEBUG" preprocessor blocks to do one thing +// related features using "#ifndef NDEBUG" preprocessor blocks to do one thing // or another. This is bad because it means that if clang was built in release // mode, it assumes that you are building in release mode which is not always // the case. You can end up with functions that are defined as empty in header diff --git a/include/lldb/Symbol/CompileUnit.h b/include/lldb/Symbol/CompileUnit.h index 5de93670c5a7..f9238ebba18c 100644 --- a/include/lldb/Symbol/CompileUnit.h +++ b/include/lldb/Symbol/CompileUnit.h @@ -115,7 +115,7 @@ public: /// parse the debug information. /// /// @param[in] function_sp - /// A shared pointer to the a Function object. + /// A shared pointer to the Function object. //------------------------------------------------------------------ void AddFunction(lldb::FunctionSP& function_sp); @@ -178,7 +178,7 @@ public: /// Dump the compile unit contents to the stream \a s. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. /// /// @param[in] show_context /// If \b true, variables will dump their symbol context @@ -199,7 +199,7 @@ public: /// /// 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 valeu + 1. + /// 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. @@ -377,7 +377,7 @@ public: /// using a LineEntry base address will be able to be resolved. /// /// @param[out] sc_list - /// A SymbolContext list class that willl get any matching + /// A SymbolContext list class that will get any matching /// entries appended to. /// /// @return diff --git a/include/lldb/Symbol/DWARFCallFrameInfo.h b/include/lldb/Symbol/DWARFCallFrameInfo.h index 13a14f8c4041..e67a5a2a8e2c 100644 --- a/include/lldb/Symbol/DWARFCallFrameInfo.h +++ b/include/lldb/Symbol/DWARFCallFrameInfo.h @@ -100,7 +100,7 @@ private: typedef std::shared_ptr<CIE> CIESP; - typedef std::map<off_t, CIESP> cie_map_t; + 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 diff --git a/include/lldb/Symbol/Declaration.h b/include/lldb/Symbol/Declaration.h index f014571595f0..73dede556eae 100644 --- a/include/lldb/Symbol/Declaration.h +++ b/include/lldb/Symbol/Declaration.h @@ -136,7 +136,7 @@ public: /// supplied stream \a s. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. //------------------------------------------------------------------ void Dump (Stream *s, bool show_fullpaths) const; @@ -236,7 +236,7 @@ public: /// Set accessor for the declaration file specification. /// /// @param[in] file_spec - /// The new declaration file specifciation. + /// The new declaration file specification. //------------------------------------------------------------------ void SetFile (const FileSpec& file_spec) diff --git a/include/lldb/Symbol/FuncUnwinders.h b/include/lldb/Symbol/FuncUnwinders.h index 7af063402289..0cf584239f95 100644 --- a/include/lldb/Symbol/FuncUnwinders.h +++ b/include/lldb/Symbol/FuncUnwinders.h @@ -21,7 +21,7 @@ public: // This is often sourced from the eh_frame exception handling info // 2. Unwinding from a non-call site (any location in the function) // This is often done by analyzing the function prologue assembly - // langauge instructions + // language instructions // 3. A fast unwind method for this function which only retrieves a // limited set of registers necessary to walk the stack // 4. An architectural default unwind plan when none of the above are @@ -31,7 +31,7 @@ public: // 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, const lldb::UnwindAssemblySP& assembly_profiler, AddressRange range); + FuncUnwinders (lldb_private::UnwindTable& unwind_table, AddressRange range); ~FuncUnwinders (); @@ -44,7 +44,7 @@ public: GetUnwindPlanAtCallSite (int current_offset); lldb::UnwindPlanSP - GetUnwindPlanAtNonCallSite (lldb_private::Thread& thread); + GetUnwindPlanAtNonCallSite (Target& target, lldb_private::Thread& thread, int current_offset); lldb::UnwindPlanSP GetUnwindPlanFastUnwind (lldb_private::Thread& Thread); @@ -76,8 +76,11 @@ public: InvalidateNonCallSiteUnwindPlan (lldb_private::Thread& Thread); private: + + lldb::UnwindAssemblySP + GetUnwindAssemblyProfiler (); + UnwindTable& m_unwind_table; - lldb::UnwindAssemblySP m_assembly_profiler; AddressRange m_range; Mutex m_mutex; diff --git a/include/lldb/Symbol/Function.h b/include/lldb/Symbol/Function.h index dcea24c0b632..5954cf520d70 100644 --- a/include/lldb/Symbol/Function.h +++ b/include/lldb/Symbol/Function.h @@ -24,7 +24,7 @@ namespace lldb_private { /// @class FunctionInfo Function.h "lldb/Symbol/Function.h" /// @brief A class that contains generic function information. /// -/// This provides generic function information that gets resused between +/// This provides generic function information that gets reused between /// inline functions and function types. //---------------------------------------------------------------------- class FunctionInfo @@ -94,7 +94,7 @@ public: /// supplied stream \a s. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. //------------------------------------------------------------------ void Dump (Stream *s, bool show_fullpaths) const; @@ -234,7 +234,7 @@ public: /// supplied stream \a s. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. //------------------------------------------------------------------ void Dump(Stream *s, bool show_fullpaths) const; @@ -316,14 +316,14 @@ private: /// (Function::m_type), and contains lexical blocks /// (Function::m_blocks). /// -/// The function inforation is split into a few pieces: +/// The function information is split into a few pieces: /// @li The concrete instance information /// @li The abstract information /// /// The abstract information is found in the function type (Type) that /// describes a function information, return type and parameter types. /// -/// The concreate information is the address range information and +/// The concrete information is the address range information and /// specific locations for an instance of this function. //---------------------------------------------------------------------- class Function : @@ -547,7 +547,7 @@ public: //------------------------------------------------------------------ /// Get accessor for the type that describes the function - /// return value type, and paramter types. + /// return value type, and parameter types. /// /// @return /// A type object pointer. @@ -557,7 +557,7 @@ public: //------------------------------------------------------------------ /// Get const accessor for the type that describes the function - /// return value type, and paramter types. + /// return value type, and parameter types. /// /// @return /// A const type object pointer. @@ -578,7 +578,7 @@ public: /// supplied stream \a s. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. /// /// @param[in] show_context /// If \b true, variables will dump their symbol context diff --git a/include/lldb/Symbol/LineEntry.h b/include/lldb/Symbol/LineEntry.h index d7750cd34916..082caea3b12f 100644 --- a/include/lldb/Symbol/LineEntry.h +++ b/include/lldb/Symbol/LineEntry.h @@ -59,7 +59,7 @@ struct LineEntry /// supplied stream \a s. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. /// /// @param[in] comp_unit /// The compile unit object that contains the support file @@ -98,7 +98,7 @@ struct LineEntry /// line entry to the supplied stream \a s. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. /// /// @param[in] comp_unit /// The compile unit object that contains the support file diff --git a/include/lldb/Symbol/LineTable.h b/include/lldb/Symbol/LineTable.h index 477c8455ded8..3e25ad17e94e 100644 --- a/include/lldb/Symbol/LineTable.h +++ b/include/lldb/Symbol/LineTable.h @@ -85,7 +85,7 @@ public: bool is_epilogue_begin, bool is_terminal_entry); - // Used to instantiate the LineSequence helper classw + // Used to instantiate the LineSequence helper class LineSequence* CreateLineSequenceContainer (); @@ -111,7 +111,7 @@ public: /// Dump all line entries in this line table to the stream \a s. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. /// /// @param[in] style /// The display style for the address. diff --git a/include/lldb/Symbol/ObjectContainer.h b/include/lldb/Symbol/ObjectContainer.h index 7fb686245057..679e8f03b67a 100644 --- a/include/lldb/Symbol/ObjectContainer.h +++ b/include/lldb/Symbol/ObjectContainer.h @@ -85,7 +85,7 @@ public: /// if it has been parsed. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. //------------------------------------------------------------------ virtual void Dump (Stream *s) const = 0; @@ -168,7 +168,7 @@ public: /// and the next plug-in can attempt to parse an object file. /// /// @return - /// Returns \b true if the header was parsed succesfully, \b + /// Returns \b true if the header was parsed successfully, \b /// false otherwise. //------------------------------------------------------------------ virtual bool diff --git a/include/lldb/Symbol/ObjectFile.h b/include/lldb/Symbol/ObjectFile.h index afa1f9b40902..bdc6ae8c9e81 100644 --- a/include/lldb/Symbol/ObjectFile.h +++ b/include/lldb/Symbol/ObjectFile.h @@ -21,6 +21,36 @@ #include "lldb/Symbol/UnwindTable.h" namespace lldb_private { + +class ObjectFileJITDelegate +{ +public: + ObjectFileJITDelegate () + { + } + + virtual + ~ObjectFileJITDelegate() + { + } + + virtual lldb::ByteOrder + GetByteOrder () const = 0; + + virtual uint32_t + GetAddressByteSize () const = 0; + + virtual void + PopulateSymtab (lldb_private::ObjectFile *obj_file, + lldb_private::Symtab &symtab) = 0; + + virtual void + PopulateSectionList (lldb_private::ObjectFile *obj_file, + lldb_private::SectionList §ion_list) = 0; + + virtual bool + GetArchitecture (lldb_private::ArchSpec &arch) = 0; +}; //---------------------------------------------------------------------- /// @class ObjectFile ObjectFile.h "lldb/Symbol/ObjectFile.h" @@ -32,23 +62,11 @@ namespace lldb_private { /// for an object file. /// /// Object files can be represented by the entire file, or by part of a -/// file. Examples of object files that are part of a file include -/// object files that contain information for multiple architectures in -/// the same file, or archive files that contain multiple objects -/// (ranlib archives) (possibly for multiple architectures as well). +/// file. An example of a partial file ObjectFile is one that contains +/// information for one of multiple architectures in the same file. /// -/// Object archive files (e.g. ranlib archives) can contain -/// multiple .o (object) files that must be selected by index or by name. -/// The number of objects that an ObjectFile contains can be determined -/// using the ObjectFile::GetNumObjects() const -/// function, and followed by a call to -/// ObjectFile::SelectObjectAtIndex (uint32_t) to change the currently -/// selected object. Objects can also be selected by name using the -/// ObjectFile::SelectObject(const char *) function. -/// -/// Once an architecture is selected (and an object is selected for -/// for archives), the object file information can be extracted from -/// this abstract class. +/// Once an architecture is selected the object file information can be +/// extracted from this abstract class. //---------------------------------------------------------------------- class ObjectFile: public std::enable_shared_from_this<ObjectFile>, @@ -68,6 +86,7 @@ public: eTypeObjectFile, /// An intermediate object file eTypeSharedLibrary, /// A shared library that can be used during execution eTypeStubLibrary, /// A library that can be linked against but not used for execution + eTypeJIT, /// JIT code that has symbols, sections and possibly debug info eTypeUnknown } Type; @@ -77,7 +96,8 @@ public: eStrataUnknown, eStrataUser, eStrataKernel, - eStrataRawImage + eStrataRawImage, + eStrataJIT } Strata; //------------------------------------------------------------------ @@ -91,7 +111,7 @@ public: const FileSpec *file_spec_ptr, lldb::offset_t file_offset, lldb::offset_t length, - lldb::DataBufferSP& data_sp, + const lldb::DataBufferSP& data_sp, lldb::offset_t data_offset); ObjectFile (const lldb::ModuleSP &module_sp, @@ -117,7 +137,7 @@ public: /// if it has been parsed. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. //------------------------------------------------------------------ virtual void Dump (Stream *s) = 0; @@ -354,6 +374,16 @@ 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. + //------------------------------------------------------------------ + virtual void + SectionFileAddressesChanged () + { + } + //------------------------------------------------------------------ /// Gets the symbol table for the currently selected architecture /// (and object for archives). @@ -439,7 +469,7 @@ 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 return in the FileSpecList. + /// the values will be returned in the FileSpecList. /// /// @return /// Returns filespeclist. @@ -451,6 +481,21 @@ 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. + /// + /// @return + /// Returns filespeclist. + //------------------------------------------------------------------ + virtual lldb_private::FileSpecList + GetReExportedLibraries () + { + return FileSpecList(); + } + + //------------------------------------------------------------------ /// Sets the load address for an entire module, assuming a rigid /// slide of sections, if possible in the implementation. /// @@ -486,7 +531,7 @@ public: /// and the next plug-in can attempt to parse an object file. /// /// @return - /// Returns \b true if the header was parsed succesfully, \b + /// Returns \b true if the header was parsed successfully, \b /// false otherwise. //------------------------------------------------------------------ virtual bool @@ -751,17 +796,17 @@ public: size_t byte_size); size_t - GetData (off_t offset, size_t length, DataExtractor &data) const; + GetData (lldb::offset_t offset, size_t length, DataExtractor &data) const; size_t - CopyData (off_t offset, size_t length, void *dst) const; + CopyData (lldb::offset_t offset, size_t length, void *dst) const; - size_t + virtual size_t ReadSectionData (const Section *section, - off_t section_offset, + lldb::offset_t section_offset, void *dst, size_t dst_len) const; - size_t + virtual size_t ReadSectionData (const Section *section, DataExtractor& section_data) const; diff --git a/include/lldb/Symbol/Symbol.h b/include/lldb/Symbol/Symbol.h index db32ba373e42..0dd04b7112bc 100644 --- a/include/lldb/Symbol/Symbol.h +++ b/include/lldb/Symbol/Symbol.h @@ -92,6 +92,9 @@ public: return m_addr_range.GetBaseAddress(); } + lldb::addr_t + ResolveCallableAddress(Target &target) const; + const ConstString & GetName () const { @@ -135,7 +138,7 @@ public: SetReExportedSymbolSharedLibrary (const FileSpec &fspec); Symbol * - ResolveReExportedSymbol (Target &target); + ResolveReExportedSymbol (Target &target) const; uint32_t GetSiblingIndex () const; @@ -303,7 +306,15 @@ public: Stream &strm); 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. + + Symbol * + ResolveReExportedSymbolInModuleSpec (Target &target, + ConstString &reexport_name, + lldb_private::ModuleSpec &module_spec, + lldb_private::ModuleList &seen_modules) const; + uint32_t m_uid; // User ID (usually the original symbol table index) uint16_t m_type_data; // data specific to m_type uint16_t m_type_data_resolved:1, // True if the data in m_type_data has already been calculated diff --git a/include/lldb/Symbol/SymbolContext.h b/include/lldb/Symbol/SymbolContext.h index 6fdd828bd9f2..c26b7a0b9a10 100644 --- a/include/lldb/Symbol/SymbolContext.h +++ b/include/lldb/Symbol/SymbolContext.h @@ -140,7 +140,7 @@ public: /// supplied stream \a s. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. //------------------------------------------------------------------ void Dump (Stream *s, Target *target) const; @@ -157,7 +157,7 @@ public: /// was stopped will be displayed. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. /// /// @param[in] so_addr /// The resolved section offset address. @@ -409,7 +409,7 @@ private: /// 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 addressses for a specified file and line number. +/// @li Finding all addresses for a specified file and line number. //---------------------------------------------------------------------- class SymbolContextList { @@ -465,7 +465,7 @@ public: /// the list to the supplied stream \a s. /// /// @param[in] s - /// The stream to which to dump the object descripton. + /// The stream to which to dump the object description. //------------------------------------------------------------------ void Dump(Stream *s, Target *target) const; diff --git a/include/lldb/Symbol/SymbolContextScope.h b/include/lldb/Symbol/SymbolContextScope.h index 693cc0131e27..a02b4523a4c0 100644 --- a/include/lldb/Symbol/SymbolContextScope.h +++ b/include/lldb/Symbol/SymbolContextScope.h @@ -75,7 +75,7 @@ public: ~SymbolContextScope () {} //------------------------------------------------------------------ - /// Reconstruct the object's symbolc context into \a sc. + /// 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 @@ -119,11 +119,11 @@ public: } //------------------------------------------------------------------ - /// Dump the object's symbolc context to the stream \a s. + /// 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 objets. + /// 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 5b774e3a7d13..6df3d49fc464 100644 --- a/include/lldb/Symbol/SymbolFile.h +++ b/include/lldb/Symbol/SymbolFile.h @@ -67,7 +67,7 @@ public: /// Each symbol file gets to respond with a mask of abilities that /// it supports for each object file. This happens when we are /// trying to figure out which symbol file plug-in will get used - /// for a given object file. The plug-in that resoonds with the + /// for a given object file. The plug-in that responds with the /// best mix of "SymbolFile::Abilities" bits set, will get chosen to /// be the symbol file parser. This allows each plug-in to check for /// sections that contain data a symbol file plug-in would need. For @@ -152,6 +152,16 @@ public: ObjectFile* GetObjectFile() { return m_obj_file; } const ObjectFile* GetObjectFile() const { return m_obj_file; } + + //------------------------------------------------------------------ + /// Notify the SymbolFile that the file addresses in the Sections + /// for this module have been changed. + //------------------------------------------------------------------ + virtual void + SectionFileAddressesChanged () + { + } + protected: ObjectFile* m_obj_file; // The object file that symbols can be extracted from. diff --git a/include/lldb/Symbol/SymbolVendor.h b/include/lldb/Symbol/SymbolVendor.h index 0eeea4eb466b..82f902d4e07b 100644 --- a/include/lldb/Symbol/SymbolVendor.h +++ b/include/lldb/Symbol/SymbolVendor.h @@ -173,6 +173,13 @@ public: ClearSymtab (); //------------------------------------------------------------------ + /// Notify the SymbolVendor that the file addresses in the Sections + /// for this module have been changed. + //------------------------------------------------------------------ + virtual void + SectionFileAddressesChanged (); + + //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ virtual ConstString diff --git a/include/lldb/Symbol/Symtab.h b/include/lldb/Symbol/Symtab.h index 5dfb1c822d51..dc08333e22fb 100644 --- a/include/lldb/Symbol/Symtab.h +++ b/include/lldb/Symbol/Symtab.h @@ -46,6 +46,7 @@ public: Symbol * Resize (size_t count); uint32_t AddSymbol(const Symbol& symbol); size_t GetNumSymbols() const; + void SectionFileAddressesChanged (); void Dump(Stream *s, Target *target, SortOrder sort_type); void Dump(Stream *s, Target *target, std::vector<uint32_t>& indexes) const; uint32_t GetIndexForSymbol (const Symbol *symbol) const; diff --git a/include/lldb/Symbol/Type.h b/include/lldb/Symbol/Type.h index da327439936c..eaa150e78ace 100644 --- a/include/lldb/Symbol/Type.h +++ b/include/lldb/Symbol/Type.h @@ -17,6 +17,8 @@ #include "lldb/Symbol/ClangASTType.h" #include "lldb/Symbol/Declaration.h" +#include "llvm/ADT/APSInt.h" + #include <set> namespace lldb_private { @@ -103,6 +105,11 @@ 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 + // Type instances. They can store a weak pointer to the Module; + lldb::ModuleSP + GetModule(); void GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_name); @@ -306,16 +313,18 @@ protected: // these classes are used to back the SBType* objects -class TypePair { -private: - ClangASTType clang_type; - lldb::TypeSP type_sp; - +class TypePair +{ public: - TypePair () : clang_type(), type_sp() {} + TypePair () : + clang_type(), + type_sp() + { + } + TypePair (ClangASTType type) : - clang_type(type), - type_sp() + clang_type(type), + type_sp() { } @@ -368,6 +377,16 @@ public: return ConstString (); } + ConstString + GetDisplayTypeName () const + { + if (type_sp) + return type_sp->GetClangForwardType().GetDisplayTypeName(); + if (clang_type) + return clang_type.GetDisplayTypeName(); + return ConstString(); + } + void SetType (ClangASTType type) { @@ -455,6 +474,17 @@ public: { return clang_type.GetASTContext(); } + + lldb::ModuleSP + GetModule () const + { + if (type_sp) + return type_sp->GetModule(); + return lldb::ModuleSP(); + } +protected: + ClangASTType clang_type; + lldb::TypeSP type_sp; }; class TypeImpl @@ -467,30 +497,30 @@ public: TypeImpl(const TypeImpl& rhs); - TypeImpl (lldb::TypeSP type_sp); + TypeImpl (const lldb::TypeSP &type_sp); - TypeImpl (ClangASTType clang_type); + TypeImpl (const ClangASTType &clang_type); - TypeImpl (lldb::TypeSP type_sp, ClangASTType dynamic); + TypeImpl (const lldb::TypeSP &type_sp, const ClangASTType &dynamic); - TypeImpl (ClangASTType clang_type, ClangASTType dynamic); + TypeImpl (const ClangASTType &clang_type, const ClangASTType &dynamic); - TypeImpl (TypePair pair, ClangASTType dynamic); + TypeImpl (const TypePair &pair, const ClangASTType &dynamic); void - SetType (lldb::TypeSP type_sp); + SetType (const lldb::TypeSP &type_sp); void - SetType (ClangASTType clang_type); + SetType (const ClangASTType &clang_type); void - SetType (lldb::TypeSP type_sp, ClangASTType dynamic); + SetType (const lldb::TypeSP &type_sp, const ClangASTType &dynamic); void - SetType (ClangASTType clang_type, ClangASTType dynamic); + SetType (const ClangASTType &clang_type, const ClangASTType &dynamic); void - SetType (TypePair pair, ClangASTType dynamic); + SetType (const TypePair &pair, const ClangASTType &dynamic); TypeImpl& operator = (const TypeImpl& rhs); @@ -511,6 +541,9 @@ public: ConstString GetName () const; + ConstString + GetDisplayTypeName () const; + TypeImpl GetPointerType () const; @@ -543,6 +576,11 @@ public: lldb::DescriptionLevel description_level); private: + + bool + CheckModule (lldb::ModuleSP &module_sp) const; + + lldb::ModuleWP m_module_wp; TypePair m_static_type; ClangASTType m_dynamic_type; }; @@ -772,7 +810,105 @@ private: TypePair m_type_pair; ConstString m_type_name; }; - + +class TypeEnumMemberImpl +{ +public: + TypeEnumMemberImpl () : + m_integer_type_sp(), + m_name("<invalid>"), + m_value(), + m_valid(false) + { + } + + TypeEnumMemberImpl (const clang::EnumConstantDecl* enum_member_decl, + const lldb_private::ClangASTType& integer_type); + + TypeEnumMemberImpl (const TypeEnumMemberImpl& rhs) : + m_integer_type_sp(rhs.m_integer_type_sp), + m_name(rhs.m_name), + m_value(rhs.m_value), + m_valid(rhs.m_valid) + { + } + + TypeEnumMemberImpl& + operator = (const TypeEnumMemberImpl& rhs); + + bool + IsValid () + { + return m_valid; + } + + const ConstString & + GetName () const + { + return m_name; + } + + const lldb::TypeImplSP & + GetIntegerType () const + { + return m_integer_type_sp; + } + + uint64_t + GetValueAsUnsigned () const + { + return *m_value.getRawData(); + } + + int64_t + GetValueAsSigned () const + { + return (int64_t) *m_value.getRawData(); + } + +protected: + lldb::TypeImplSP m_integer_type_sp; + ConstString m_name; + llvm::APSInt m_value; + bool m_valid; +}; + +class TypeEnumMemberListImpl +{ +public: + TypeEnumMemberListImpl() : + m_content() + { + } + + void + Append (const lldb::TypeEnumMemberImplSP& type) + { + m_content.push_back(type); + } + + void + Append (const lldb_private::TypeEnumMemberListImpl& type_list); + + lldb::TypeEnumMemberImplSP + GetTypeEnumMemberAtIndex(size_t idx) + { + lldb::TypeEnumMemberImplSP enum_member; + if (idx < GetSize()) + enum_member = m_content[idx]; + return enum_member; + } + + size_t + GetSize() + { + return m_content.size(); + } + +private: + std::vector<lldb::TypeEnumMemberImplSP> m_content; +}; + } // namespace lldb_private #endif // liblldb_Type_h_ diff --git a/include/lldb/Symbol/UnwindPlan.h b/include/lldb/Symbol/UnwindPlan.h index 6fc5ce042357..e1b146fe219e 100644 --- a/include/lldb/Symbol/UnwindPlan.h +++ b/include/lldb/Symbol/UnwindPlan.h @@ -365,6 +365,9 @@ public: void AppendRow (const RowSP& row_sp); + void + InsertRow (const RowSP& row_sp); + // 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 diff --git a/include/lldb/Symbol/UnwindTable.h b/include/lldb/Symbol/UnwindTable.h index 3a99eb463df4..3a89f9f1f3c6 100644 --- a/include/lldb/Symbol/UnwindTable.h +++ b/include/lldb/Symbol/UnwindTable.h @@ -13,7 +13,8 @@ #include <map> -#include "lldb/lldb-private.h" +#include "lldb/lldb-private.h" +#include "lldb/Host/Mutex.h" namespace lldb_private { @@ -42,6 +43,9 @@ public: lldb::FuncUnwindersSP GetUncachedFuncUnwindersContainingAddress (const Address& addr, SymbolContext &sc); + bool + GetArchitecture (lldb_private::ArchSpec &arch); + private: void Dump (Stream &s); @@ -56,8 +60,7 @@ private: collection m_unwinds; bool m_initialized; // delay some initialization until ObjectFile is set up - - lldb::UnwindAssemblySP m_assembly_profiler; + Mutex m_mutex; DWARFCallFrameInfo* m_eh_frame; diff --git a/include/lldb/Symbol/VariableList.h b/include/lldb/Symbol/VariableList.h index 08efd3d5b9a1..5f8f2a225650 100644 --- a/include/lldb/Symbol/VariableList.h +++ b/include/lldb/Symbol/VariableList.h @@ -60,10 +60,10 @@ public: AppendVariablesIfUnique(VariableList &var_list); // Returns the actual number of unique variables that were added to the - // list. "total_matches" will get updated with the actualy number of + // 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 varaibles that match "regex" were already in "var_list". + // where any variables that match "regex" were already in "var_list". size_t AppendVariablesIfUnique (const RegularExpression& regex, VariableList &var_list, |