SymbolFile.h revision 6916e358c9725b75ed91f31236c147f26c9af10e
1//===-- SymbolFile.h --------------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef liblldb_SymbolFile_h_ 11#define liblldb_SymbolFile_h_ 12 13#include "lldb/lldb-private.h" 14#include "lldb/Core/PluginInterface.h" 15#include "lldb/Symbol/ClangASTType.h" 16#include "lldb/Symbol/ClangNamespaceDecl.h" 17#include "lldb/Symbol/Type.h" 18 19namespace lldb_private { 20 21class SymbolFile : 22 public PluginInterface 23{ 24public: 25 enum Abilities 26 { 27 Labels = (1 << 0), 28 AddressAcceleratorTable = (1 << 1), 29 FunctionAcceleratorTable = (1 << 2), 30 TypeAcceleratorTable = (1 << 3), 31 MacroInformation = (1 << 4), 32 CallFrameInformation = (1 << 5), 33 CompileUnits = (1 << 6), 34 LineTables = (1 << 7), 35 LineColumns = (1 << 8), 36 Functions = (1 << 9), 37 Blocks = (1 << 10), 38 GlobalVariables = (1 << 11), 39 LocalVariables = (1 << 12), 40 VariableTypes = (1 << 13) 41 }; 42 43 static SymbolFile * 44 FindPlugin (ObjectFile* obj_file); 45 46 //------------------------------------------------------------------ 47 // Constructors and Destructors 48 //------------------------------------------------------------------ 49 SymbolFile(ObjectFile* obj_file) : 50 m_obj_file(obj_file) 51 { 52 } 53 54 virtual 55 ~SymbolFile() 56 { 57 } 58 59 virtual uint32_t GetAbilities () = 0; 60 61 //------------------------------------------------------------------ 62 // Compile Unit function calls 63 //------------------------------------------------------------------ 64 // Approach 1 - iterator 65 virtual uint32_t GetNumCompileUnits() = 0; 66 virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) = 0; 67 68 virtual size_t ParseCompileUnitFunctions (const SymbolContext& sc) = 0; 69 virtual bool ParseCompileUnitLineTable (const SymbolContext& sc) = 0; 70 virtual bool ParseCompileUnitSupportFiles (const SymbolContext& sc, FileSpecList& support_files) = 0; 71 virtual size_t ParseFunctionBlocks (const SymbolContext& sc) = 0; 72 virtual size_t ParseTypes (const SymbolContext& sc) = 0; 73 virtual size_t ParseVariablesForContext (const SymbolContext& sc) = 0; 74 virtual Type* ResolveTypeUID (lldb::user_id_t type_uid) = 0; 75 virtual lldb::clang_type_t ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_type) = 0; 76 virtual clang::DeclContext* GetClangDeclContextForTypeUID (lldb::user_id_t type_uid) { return NULL; } 77 virtual uint32_t ResolveSymbolContext (const Address& so_addr, uint32_t resolve_scope, SymbolContext& sc) = 0; 78 virtual uint32_t ResolveSymbolContext (const FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list) = 0; 79 virtual uint32_t FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variables) = 0; 80 virtual uint32_t FindGlobalVariables (const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables) = 0; 81 virtual uint32_t FindFunctions (const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) = 0; 82 virtual uint32_t FindFunctions (const RegularExpression& regex, bool append, SymbolContextList& sc_list) = 0; 83 virtual uint32_t FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types) = 0; 84// virtual uint32_t FindTypes (const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, TypeList& types) = 0; 85 virtual TypeList * GetTypeList (); 86 virtual ClangNamespaceDecl 87 FindNamespace (const SymbolContext& sc, 88 const ConstString &name) = 0; 89 90 ObjectFile* GetObjectFile() { return m_obj_file; } 91 const ObjectFile* GetObjectFile() const { return m_obj_file; } 92protected: 93 ObjectFile* m_obj_file; // The object file that symbols can be extracted from. 94 95private: 96 DISALLOW_COPY_AND_ASSIGN (SymbolFile); 97}; 98 99 100} // namespace lldb_private 101 102#endif // liblldb_SymbolFile_h_ 103