Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- SymbolFileDWARFDebugMap.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_SymbolFileDWARFDebugMap_h_ |
| 11 | #define liblldb_SymbolFileDWARFDebugMap_h_ |
| 12 | |
| 13 | |
| 14 | #include <vector> |
| 15 | #include <bitset> |
| 16 | #include "lldb/Symbol/SymbolFile.h" |
| 17 | |
| 18 | class SymbolFileDWARF; |
| 19 | |
| 20 | class SymbolFileDWARFDebugMap : public lldb_private::SymbolFile |
| 21 | { |
| 22 | public: |
| 23 | //------------------------------------------------------------------ |
| 24 | // Static Functions |
| 25 | //------------------------------------------------------------------ |
| 26 | static void |
| 27 | Initialize(); |
| 28 | |
| 29 | static void |
| 30 | Terminate(); |
| 31 | |
| 32 | static const char * |
| 33 | GetPluginNameStatic(); |
| 34 | |
| 35 | static const char * |
| 36 | GetPluginDescriptionStatic(); |
| 37 | |
| 38 | static lldb_private::SymbolFile * |
| 39 | CreateInstance (lldb_private::ObjectFile* obj_file); |
| 40 | |
| 41 | //------------------------------------------------------------------ |
| 42 | // Constructors and Destructors |
| 43 | //------------------------------------------------------------------ |
| 44 | SymbolFileDWARFDebugMap (lldb_private::ObjectFile* ofile); |
| 45 | virtual ~ SymbolFileDWARFDebugMap (); |
| 46 | |
| 47 | virtual uint32_t GetAbilities (); |
| 48 | |
| 49 | //------------------------------------------------------------------ |
| 50 | // Compile Unit function calls |
| 51 | //------------------------------------------------------------------ |
| 52 | virtual uint32_t GetNumCompileUnits (); |
| 53 | virtual lldb::CompUnitSP ParseCompileUnitAtIndex (uint32_t index); |
| 54 | |
| 55 | virtual size_t ParseCompileUnitFunctions (const lldb_private::SymbolContext& sc); |
| 56 | virtual bool ParseCompileUnitLineTable (const lldb_private::SymbolContext& sc); |
| 57 | virtual bool ParseCompileUnitSupportFiles (const lldb_private::SymbolContext& sc, lldb_private::FileSpecList &support_files); |
| 58 | virtual size_t ParseFunctionBlocks (const lldb_private::SymbolContext& sc); |
| 59 | virtual size_t ParseTypes (const lldb_private::SymbolContext& sc); |
| 60 | virtual size_t ParseVariablesForContext (const lldb_private::SymbolContext& sc); |
| 61 | |
| 62 | virtual lldb_private::Type* ResolveTypeUID (lldb::user_id_t type_uid); |
| 63 | virtual uint32_t ResolveSymbolContext (const lldb_private::Address& so_addr, uint32_t resolve_scope, lldb_private::SymbolContext& sc); |
| 64 | virtual uint32_t ResolveSymbolContext (const lldb_private::FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, lldb_private::SymbolContextList& sc_list); |
| 65 | virtual uint32_t FindGlobalVariables (const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::VariableList& variables); |
| 66 | virtual uint32_t FindGlobalVariables (const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables); |
Greg Clayton | 0c5cd90 | 2010-06-28 21:30:43 +0000 | [diff] [blame^] | 67 | virtual uint32_t FindFunctions (const lldb_private::ConstString &name, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 68 | virtual uint32_t FindFunctions (const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list); |
| 69 | // virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, Type::Encoding encoding, lldb::user_id_t udt_uid, TypeList& types); |
| 70 | // virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, lldb::user_id_t udt_uid, TypeList& types); |
| 71 | |
| 72 | //------------------------------------------------------------------ |
| 73 | // PluginInterface protocol |
| 74 | //------------------------------------------------------------------ |
| 75 | virtual const char * |
| 76 | GetPluginName(); |
| 77 | |
| 78 | virtual const char * |
| 79 | GetShortPluginName(); |
| 80 | |
| 81 | virtual uint32_t |
| 82 | GetPluginVersion(); |
| 83 | |
| 84 | virtual void |
| 85 | GetPluginCommandHelp (const char *command, lldb_private::Stream *strm); |
| 86 | |
| 87 | virtual lldb_private::Error |
| 88 | ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm); |
| 89 | |
| 90 | virtual lldb_private::Log * |
| 91 | EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command); |
| 92 | |
| 93 | protected: |
| 94 | enum |
| 95 | { |
| 96 | kHaveInitializedOSOs = (1 << 0), |
| 97 | kNumFlags |
| 98 | }; |
| 99 | |
| 100 | //------------------------------------------------------------------ |
| 101 | // Class specific types |
| 102 | //------------------------------------------------------------------ |
| 103 | struct CompileUnitInfo |
| 104 | { |
| 105 | lldb_private::FileSpec so_file; |
| 106 | lldb_private::Symbol *so_symbol; |
| 107 | lldb_private::Symbol *oso_symbol; |
| 108 | lldb::ModuleSP oso_module_sp; |
| 109 | lldb::CompUnitSP oso_compile_unit_sp; |
| 110 | lldb_private::SymbolVendor *oso_symbol_vendor; |
| 111 | // lldb_private::shared_ptr<SymbolFileDWARF> oso_dwarf_sp; |
| 112 | // lldb_private::shared_ptr<SymbolVendor> oso_dwarf_sp; |
| 113 | std::vector<uint32_t> function_indexes; |
| 114 | std::vector<uint32_t> static_indexes; |
| 115 | lldb::SharedPtr<lldb_private::SectionList>::Type debug_map_sections_sp; |
| 116 | |
| 117 | CompileUnitInfo() : |
| 118 | so_file(), |
| 119 | so_symbol(NULL), |
| 120 | oso_symbol(NULL), |
| 121 | oso_module_sp(), |
| 122 | oso_compile_unit_sp(), |
| 123 | oso_symbol_vendor(NULL), |
| 124 | // oso_dwarf_sp(), |
| 125 | function_indexes(), |
| 126 | static_indexes(), |
| 127 | debug_map_sections_sp() |
| 128 | { |
| 129 | } |
| 130 | }; |
| 131 | |
| 132 | //------------------------------------------------------------------ |
| 133 | // Protected Member Functions |
| 134 | //------------------------------------------------------------------ |
| 135 | void |
| 136 | InitOSO (); |
| 137 | |
| 138 | bool |
| 139 | GetFileSpecForSO (uint32_t oso_idx, lldb_private::FileSpec &file_spec); |
| 140 | |
| 141 | CompileUnitInfo * |
| 142 | GetCompUnitInfo (const lldb_private::SymbolContext& sc); |
| 143 | |
| 144 | lldb_private::Module * |
| 145 | GetModuleByCompUnitInfo (CompileUnitInfo *comp_unit_info); |
| 146 | |
| 147 | lldb_private::Module * |
| 148 | GetModuleByOSOIndex (uint32_t oso_idx); |
| 149 | |
| 150 | lldb_private::ObjectFile * |
| 151 | GetObjectFileByCompUnitInfo (CompileUnitInfo *comp_unit_info); |
| 152 | |
| 153 | lldb_private::ObjectFile * |
| 154 | GetObjectFileByOSOIndex (uint32_t oso_idx); |
| 155 | |
| 156 | SymbolFileDWARF * |
| 157 | GetSymbolFile (const lldb_private::SymbolContext& sc); |
| 158 | |
| 159 | SymbolFileDWARF * |
| 160 | GetSymbolFileByCompUnitInfo (CompileUnitInfo *comp_unit_info); |
| 161 | |
| 162 | SymbolFileDWARF * |
| 163 | GetSymbolFileByOSOIndex (uint32_t oso_idx); |
| 164 | |
| 165 | CompileUnitInfo* |
| 166 | GetCompileUnitInfoForSymbolWithIndex (uint32_t symbol_idx, uint32_t *oso_idx_ptr); |
| 167 | |
| 168 | static int |
| 169 | SymbolContainsSymbolIndex (uint32_t *symbol_idx_ptr, const CompileUnitInfo *comp_unit_info); |
| 170 | |
| 171 | uint32_t |
| 172 | PrivateFindGlobalVariables (const lldb_private::ConstString &name, |
| 173 | const std::vector<uint32_t> &name_symbol_indexes, |
| 174 | uint32_t max_matches, |
| 175 | lldb_private::VariableList& variables); |
| 176 | |
| 177 | //------------------------------------------------------------------ |
| 178 | // Member Variables |
| 179 | //------------------------------------------------------------------ |
| 180 | std::bitset<kNumFlags> m_flags; |
| 181 | std::vector<CompileUnitInfo> m_compile_unit_infos; |
| 182 | std::vector<uint32_t> m_func_indexes; // Sorted by address |
| 183 | std::vector<uint32_t> m_glob_indexes; |
| 184 | }; |
| 185 | |
| 186 | #endif // #ifndef liblldb_SymbolFileDWARFDebugMap_h_ |