1 //===-- SymbolFileDWARF.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 SymbolFileDWARF_SymbolFileDWARF_h_ 11 #define SymbolFileDWARF_SymbolFileDWARF_h_ 12 13 // C Includes 14 // C++ Includes 15 #include <list> 16 #include <map> 17 #include <set> 18 #include <vector> 19 20 // Other libraries and framework includes 21 #include "clang/AST/CharUnits.h" 22 #include "clang/AST/ExternalASTSource.h" 23 #include "llvm/ADT/DenseMap.h" 24 #include "llvm/ADT/SmallPtrSet.h" 25 #include "llvm/ADT/SmallVector.h" 26 27 #include "lldb/lldb-private.h" 28 #include "lldb/Core/ClangForward.h" 29 #include "lldb/Core/ConstString.h" 30 #include "lldb/Core/dwarf.h" 31 #include "lldb/Core/Flags.h" 32 #include "lldb/Core/RangeMap.h" 33 #include "lldb/Core/UniqueCStringMap.h" 34 #include "lldb/Symbol/ClangASTContext.h" 35 #include "lldb/Symbol/SymbolFile.h" 36 #include "lldb/Symbol/SymbolContext.h" 37 38 // Project includes 39 #include "DWARFDefines.h" 40 #include "DWARFDataExtractor.h" 41 #include "HashedNameToDIE.h" 42 #include "NameToDIE.h" 43 #include "UniqueDWARFASTType.h" 44 45 //---------------------------------------------------------------------- 46 // Forward Declarations for this DWARF plugin 47 //---------------------------------------------------------------------- 48 class DebugMapModule; 49 class DWARFAbbreviationDeclaration; 50 class DWARFAbbreviationDeclarationSet; 51 class DWARFileUnit; 52 class DWARFDebugAbbrev; 53 class DWARFDebugAranges; 54 class DWARFDebugInfo; 55 class DWARFDebugInfoEntry; 56 class DWARFDebugLine; 57 class DWARFDebugPubnames; 58 class DWARFDebugRanges; 59 class DWARFDeclContext; 60 class DWARFDIECollection; 61 class DWARFFormValue; 62 class SymbolFileDWARFDebugMap; 63 64 class SymbolFileDWARF : public lldb_private::SymbolFile, public lldb_private::UserID 65 { 66 public: 67 friend class SymbolFileDWARFDebugMap; 68 friend class DebugMapModule; 69 friend class DWARFCompileUnit; 70 //------------------------------------------------------------------ 71 // Static Functions 72 //------------------------------------------------------------------ 73 static void 74 Initialize(); 75 76 static void 77 Terminate(); 78 79 static lldb_private::ConstString 80 GetPluginNameStatic(); 81 82 static const char * 83 GetPluginDescriptionStatic(); 84 85 static lldb_private::SymbolFile* 86 CreateInstance (lldb_private::ObjectFile* obj_file); 87 //------------------------------------------------------------------ 88 // Constructors and Destructors 89 //------------------------------------------------------------------ 90 SymbolFileDWARF(lldb_private::ObjectFile* ofile); 91 virtual ~SymbolFileDWARF(); 92 93 virtual uint32_t CalculateAbilities (); 94 virtual void InitializeObject(); 95 96 //------------------------------------------------------------------ 97 // Compile Unit function calls 98 //------------------------------------------------------------------ 99 virtual uint32_t GetNumCompileUnits(); 100 virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index); 101 102 virtual lldb::LanguageType ParseCompileUnitLanguage (const lldb_private::SymbolContext& sc); 103 virtual size_t ParseCompileUnitFunctions (const lldb_private::SymbolContext& sc); 104 virtual bool ParseCompileUnitLineTable (const lldb_private::SymbolContext& sc); 105 virtual bool ParseCompileUnitSupportFiles (const lldb_private::SymbolContext& sc, lldb_private::FileSpecList& support_files); 106 virtual bool ParseImportedModules (const lldb_private::SymbolContext &sc, std::vector<lldb_private::ConstString> &imported_modules); 107 virtual size_t ParseFunctionBlocks (const lldb_private::SymbolContext& sc); 108 virtual size_t ParseTypes (const lldb_private::SymbolContext& sc); 109 virtual size_t ParseVariablesForContext (const lldb_private::SymbolContext& sc); 110 111 virtual lldb_private::Type* ResolveTypeUID(lldb::user_id_t type_uid); 112 virtual bool ResolveClangOpaqueTypeDefinition (lldb_private::ClangASTType& clang_type); 113 114 virtual lldb_private::Type* ResolveType (DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry* type_die, bool assert_not_being_parsed = true); 115 virtual clang::DeclContext* GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid); 116 virtual clang::DeclContext* GetClangDeclContextForTypeUID (const lldb_private::SymbolContext &sc, lldb::user_id_t type_uid); 117 118 virtual uint32_t ResolveSymbolContext (const lldb_private::Address& so_addr, uint32_t resolve_scope, lldb_private::SymbolContext& sc); 119 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); 120 virtual uint32_t FindGlobalVariables(const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::VariableList& variables); 121 virtual uint32_t FindGlobalVariables(const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables); 122 virtual uint32_t FindFunctions(const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool include_inlines, bool append, lldb_private::SymbolContextList& sc_list); 123 virtual uint32_t FindFunctions(const lldb_private::RegularExpression& regex, bool include_inlines, bool append, lldb_private::SymbolContextList& sc_list); 124 virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types); 125 virtual lldb_private::TypeList * 126 GetTypeList (); 127 virtual size_t GetTypes (lldb_private::SymbolContextScope *sc_scope, 128 uint32_t type_mask, 129 lldb_private::TypeList &type_list); 130 131 virtual lldb_private::ClangASTContext & 132 GetClangASTContext (); 133 134 virtual lldb_private::ClangNamespaceDecl 135 FindNamespace (const lldb_private::SymbolContext& sc, 136 const lldb_private::ConstString &name, 137 const lldb_private::ClangNamespaceDecl *parent_namespace_decl); 138 139 140 //------------------------------------------------------------------ 141 // ClangASTContext callbacks for external source lookups. 142 //------------------------------------------------------------------ 143 static void 144 CompleteTagDecl (void *baton, clang::TagDecl *); 145 146 static void 147 CompleteObjCInterfaceDecl (void *baton, clang::ObjCInterfaceDecl *); 148 149 static void 150 FindExternalVisibleDeclsByName (void *baton, 151 const clang::DeclContext *DC, 152 clang::DeclarationName Name, 153 llvm::SmallVectorImpl <clang::NamedDecl *> *results); 154 155 static bool LayoutRecordType(void *baton, const clang::RecordDecl *record_decl, uint64_t &size, uint64_t &alignment, 156 llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets, 157 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &base_offsets, 158 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &vbase_offsets); 159 160 bool LayoutRecordType(const clang::RecordDecl *record_decl, uint64_t &size, uint64_t &alignment, 161 llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets, 162 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &base_offsets, 163 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &vbase_offsets); 164 165 struct LayoutInfo 166 { LayoutInfoLayoutInfo167 LayoutInfo () : 168 bit_size(0), 169 alignment(0), 170 field_offsets(), 171 base_offsets(), 172 vbase_offsets() 173 { 174 } 175 uint64_t bit_size; 176 uint64_t alignment; 177 llvm::DenseMap<const clang::FieldDecl *, uint64_t> field_offsets; 178 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> base_offsets; 179 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> vbase_offsets; 180 }; 181 //------------------------------------------------------------------ 182 // PluginInterface protocol 183 //------------------------------------------------------------------ 184 virtual lldb_private::ConstString 185 GetPluginName(); 186 187 virtual uint32_t 188 GetPluginVersion(); 189 190 // Approach 2 - count + accessor 191 // Index compile units would scan the initial compile units and register 192 // them with the module. This would only be done on demand if and only if 193 // the compile units were needed. 194 //virtual size_t GetCompUnitCount() = 0; 195 //virtual CompUnitSP GetCompUnitAtIndex(size_t cu_idx) = 0; 196 197 const lldb_private::DWARFDataExtractor& get_debug_abbrev_data (); 198 const lldb_private::DWARFDataExtractor& get_debug_aranges_data (); 199 const lldb_private::DWARFDataExtractor& get_debug_frame_data (); 200 const lldb_private::DWARFDataExtractor& get_debug_info_data (); 201 const lldb_private::DWARFDataExtractor& get_debug_line_data (); 202 const lldb_private::DWARFDataExtractor& get_debug_loc_data (); 203 const lldb_private::DWARFDataExtractor& get_debug_ranges_data (); 204 const lldb_private::DWARFDataExtractor& get_debug_str_data (); 205 const lldb_private::DWARFDataExtractor& get_apple_names_data (); 206 const lldb_private::DWARFDataExtractor& get_apple_types_data (); 207 const lldb_private::DWARFDataExtractor& get_apple_namespaces_data (); 208 const lldb_private::DWARFDataExtractor& get_apple_objc_data (); 209 210 211 DWARFDebugAbbrev* DebugAbbrev(); 212 const DWARFDebugAbbrev* DebugAbbrev() const; 213 214 DWARFDebugInfo* DebugInfo(); 215 const DWARFDebugInfo* DebugInfo() const; 216 217 DWARFDebugRanges* DebugRanges(); 218 const DWARFDebugRanges* DebugRanges() const; 219 220 const lldb_private::DWARFDataExtractor& 221 GetCachedSectionData (uint32_t got_flag, 222 lldb::SectionType sect_type, 223 lldb_private::DWARFDataExtractor &data); 224 225 static bool 226 SupportedVersion(uint16_t version); 227 228 clang::DeclContext * GetCachedClangDeclContextForDIE(const DWARFDebugInfoEntry * die)229 GetCachedClangDeclContextForDIE (const DWARFDebugInfoEntry *die) 230 { 231 DIEToDeclContextMap::iterator pos = m_die_to_decl_ctx.find(die); 232 if (pos != m_die_to_decl_ctx.end()) 233 return pos->second; 234 else 235 return NULL; 236 } 237 238 clang::DeclContext * 239 GetClangDeclContextForDIE (const lldb_private::SymbolContext &sc, DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die); 240 241 clang::DeclContext * 242 GetClangDeclContextForDIEOffset (const lldb_private::SymbolContext &sc, dw_offset_t die_offset); 243 244 clang::DeclContext * 245 GetClangDeclContextContainingDIE (DWARFCompileUnit *cu, 246 const DWARFDebugInfoEntry *die, 247 const DWARFDebugInfoEntry **decl_ctx_die); 248 249 clang::DeclContext * 250 GetClangDeclContextContainingDIEOffset (dw_offset_t die_offset); 251 252 const DWARFDebugInfoEntry * 253 GetDeclContextDIEContainingDIE (DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die); 254 255 void 256 SearchDeclContext (const clang::DeclContext *decl_context, 257 const char *name, 258 llvm::SmallVectorImpl <clang::NamedDecl *> *results); 259 260 lldb_private::Flags& GetFlags()261 GetFlags () 262 { 263 return m_flags; 264 } 265 266 const lldb_private::Flags& GetFlags()267 GetFlags () const 268 { 269 return m_flags; 270 } 271 272 bool 273 HasForwardDeclForClangType (const lldb_private::ClangASTType &clang_type); 274 275 protected: 276 277 enum 278 { 279 flagsGotDebugAbbrevData = (1 << 0), 280 flagsGotDebugArangesData = (1 << 1), 281 flagsGotDebugFrameData = (1 << 2), 282 flagsGotDebugInfoData = (1 << 3), 283 flagsGotDebugLineData = (1 << 4), 284 flagsGotDebugLocData = (1 << 5), 285 flagsGotDebugMacInfoData = (1 << 6), 286 flagsGotDebugPubNamesData = (1 << 7), 287 flagsGotDebugPubTypesData = (1 << 8), 288 flagsGotDebugRangesData = (1 << 9), 289 flagsGotDebugStrData = (1 << 10), 290 flagsGotAppleNamesData = (1 << 11), 291 flagsGotAppleTypesData = (1 << 12), 292 flagsGotAppleNamespacesData = (1 << 13), 293 flagsGotAppleObjCData = (1 << 14) 294 }; 295 296 bool NamespaceDeclMatchesThisSymbolFile (const lldb_private::ClangNamespaceDecl *namespace_decl); 297 298 bool DIEIsInNamespace (const lldb_private::ClangNamespaceDecl *namespace_decl, 299 DWARFCompileUnit* dwarf_cu, 300 const DWARFDebugInfoEntry* die); 301 302 DISALLOW_COPY_AND_ASSIGN (SymbolFileDWARF); 303 lldb::CompUnitSP ParseCompileUnit (DWARFCompileUnit* dwarf_cu, uint32_t cu_idx); 304 DWARFCompileUnit* GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit); 305 DWARFCompileUnit* GetNextUnparsedDWARFCompileUnit(DWARFCompileUnit* prev_cu); 306 lldb_private::CompileUnit* GetCompUnitForDWARFCompUnit(DWARFCompileUnit* dwarf_cu, uint32_t cu_idx = UINT32_MAX); 307 bool GetFunction (DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry* func_die, lldb_private::SymbolContext& sc); 308 lldb_private::Function * ParseCompileUnitFunction (const lldb_private::SymbolContext& sc, DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry *die); 309 size_t ParseFunctionBlocks (const lldb_private::SymbolContext& sc, 310 lldb_private::Block *parent_block, 311 DWARFCompileUnit* dwarf_cu, 312 const DWARFDebugInfoEntry *die, 313 lldb::addr_t subprogram_low_pc, 314 uint32_t depth); 315 size_t ParseTypes (const lldb_private::SymbolContext& sc, DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry *die, bool parse_siblings, bool parse_children); 316 lldb::TypeSP ParseType (const lldb_private::SymbolContext& sc, DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry *die, bool *type_is_new); 317 lldb_private::Type* ResolveTypeUID (DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry* die, bool assert_not_being_parsed); 318 319 lldb::VariableSP ParseVariableDIE( 320 const lldb_private::SymbolContext& sc, 321 DWARFCompileUnit* dwarf_cu, 322 const DWARFDebugInfoEntry *die, 323 const lldb::addr_t func_low_pc); 324 325 size_t ParseVariables( 326 const lldb_private::SymbolContext& sc, 327 DWARFCompileUnit* dwarf_cu, 328 const lldb::addr_t func_low_pc, 329 const DWARFDebugInfoEntry *die, 330 bool parse_siblings, 331 bool parse_children, 332 lldb_private::VariableList* cc_variable_list = NULL); 333 334 class DelayedAddObjCClassProperty; 335 typedef std::vector <DelayedAddObjCClassProperty> DelayedPropertyList; 336 337 bool ClassOrStructIsVirtual ( 338 DWARFCompileUnit* dwarf_cu, 339 const DWARFDebugInfoEntry *parent_die); 340 341 size_t ParseChildMembers( 342 const lldb_private::SymbolContext& sc, 343 DWARFCompileUnit* dwarf_cu, 344 const DWARFDebugInfoEntry *die, 345 lldb_private::ClangASTType &class_clang_type, 346 const lldb::LanguageType class_language, 347 std::vector<clang::CXXBaseSpecifier *>& base_classes, 348 std::vector<int>& member_accessibilities, 349 DWARFDIECollection& member_function_dies, 350 DelayedPropertyList& delayed_properties, 351 lldb::AccessType &default_accessibility, 352 bool &is_a_class, 353 LayoutInfo &layout_info); 354 355 size_t ParseChildParameters( 356 const lldb_private::SymbolContext& sc, 357 clang::DeclContext *containing_decl_ctx, 358 DWARFCompileUnit* dwarf_cu, 359 const DWARFDebugInfoEntry *parent_die, 360 bool skip_artificial, 361 bool &is_static, 362 bool &is_variadic, 363 std::vector<lldb_private::ClangASTType>& function_args, 364 std::vector<clang::ParmVarDecl*>& function_param_decls, 365 unsigned &type_quals); 366 // lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos); // not currently needed 367 368 369 size_t ParseChildEnumerators( 370 const lldb_private::SymbolContext& sc, 371 lldb_private::ClangASTType &clang_type, 372 bool is_signed, 373 uint32_t enumerator_byte_size, 374 DWARFCompileUnit* dwarf_cu, 375 const DWARFDebugInfoEntry *enum_die); 376 377 void ParseChildArrayInfo( 378 const lldb_private::SymbolContext& sc, 379 DWARFCompileUnit* dwarf_cu, 380 const DWARFDebugInfoEntry *parent_die, 381 int64_t& first_index, 382 std::vector<uint64_t>& element_orders, 383 uint32_t& byte_stride, 384 uint32_t& bit_stride); 385 386 // Given a die_offset, figure out the symbol context representing that die. 387 bool ResolveFunction (dw_offset_t offset, 388 DWARFCompileUnit *&dwarf_cu, 389 bool include_inlines, 390 lldb_private::SymbolContextList& sc_list); 391 392 bool ResolveFunction (DWARFCompileUnit *cu, 393 const DWARFDebugInfoEntry *die, 394 bool include_inlines, 395 lldb_private::SymbolContextList& sc_list); 396 397 bool FunctionDieMatchesPartialName ( 398 const DWARFDebugInfoEntry* die, 399 const DWARFCompileUnit *dwarf_cu, 400 uint32_t name_type_mask, 401 const char *partial_name, 402 const char *base_name_start, 403 const char *base_name_end); 404 405 void FindFunctions( 406 const lldb_private::ConstString &name, 407 const NameToDIE &name_to_die, 408 bool include_inlines, 409 lldb_private::SymbolContextList& sc_list); 410 411 void FindFunctions ( 412 const lldb_private::RegularExpression ®ex, 413 const NameToDIE &name_to_die, 414 bool include_inlines, 415 lldb_private::SymbolContextList& sc_list); 416 417 void FindFunctions ( 418 const lldb_private::RegularExpression ®ex, 419 const DWARFMappedHash::MemoryTable &memory_table, 420 bool include_inlines, 421 lldb_private::SymbolContextList& sc_list); 422 423 lldb::TypeSP FindDefinitionTypeForDWARFDeclContext ( 424 const DWARFDeclContext &die_decl_ctx); 425 426 lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE ( 427 const DWARFDebugInfoEntry *die, 428 const lldb_private::ConstString &type_name, 429 bool must_be_implementation); 430 431 bool Supports_DW_AT_APPLE_objc_complete_type (DWARFCompileUnit *cu); 432 433 lldb::TypeSP FindCompleteObjCDefinitionType (const lldb_private::ConstString &type_name, 434 bool header_definition_ok); 435 436 lldb_private::Symbol * GetObjCClassSymbol (const lldb_private::ConstString &objc_class_name); 437 438 void ParseFunctions (const DIEArray &die_offsets, 439 bool include_inlines, 440 lldb_private::SymbolContextList& sc_list); 441 lldb::TypeSP GetTypeForDIE (DWARFCompileUnit *cu, 442 const DWARFDebugInfoEntry* die); 443 444 uint32_t FindTypes(std::vector<dw_offset_t> die_offsets, uint32_t max_matches, lldb_private::TypeList& types); 445 446 void Index(); 447 448 void DumpIndexes(); 449 SetDebugMapModule(const lldb::ModuleSP & module_sp)450 void SetDebugMapModule (const lldb::ModuleSP &module_sp) 451 { 452 m_debug_map_module_wp = module_sp; 453 } 454 455 SymbolFileDWARFDebugMap * 456 GetDebugMapSymfile (); 457 458 const DWARFDebugInfoEntry * 459 FindBlockContainingSpecification (dw_offset_t func_die_offset, 460 dw_offset_t spec_block_die_offset, 461 DWARFCompileUnit **dwarf_cu_handle); 462 463 const DWARFDebugInfoEntry * 464 FindBlockContainingSpecification (DWARFCompileUnit* dwarf_cu, 465 const DWARFDebugInfoEntry *die, 466 dw_offset_t spec_block_die_offset, 467 DWARFCompileUnit **dwarf_cu_handle); 468 469 clang::NamespaceDecl * 470 ResolveNamespaceDIE (DWARFCompileUnit *curr_cu, const DWARFDebugInfoEntry *die); 471 472 UniqueDWARFASTTypeMap & 473 GetUniqueDWARFASTTypeMap (); 474 LinkDeclContextToDIE(clang::DeclContext * decl_ctx,const DWARFDebugInfoEntry * die)475 void LinkDeclContextToDIE (clang::DeclContext *decl_ctx, 476 const DWARFDebugInfoEntry *die) 477 { 478 m_die_to_decl_ctx[die] = decl_ctx; 479 // There can be many DIEs for a single decl context 480 m_decl_ctx_to_die[decl_ctx].insert(die); 481 } 482 483 bool UserIDMatches(lldb::user_id_t uid)484 UserIDMatches (lldb::user_id_t uid) const 485 { 486 const lldb::user_id_t high_uid = uid & 0xffffffff00000000ull; 487 if (high_uid) 488 return high_uid == GetID(); 489 return true; 490 } 491 492 lldb::user_id_t MakeUserID(dw_offset_t die_offset)493 MakeUserID (dw_offset_t die_offset) const 494 { 495 return GetID() | die_offset; 496 } 497 498 static bool DeclKindIsCXXClass(clang::Decl::Kind decl_kind)499 DeclKindIsCXXClass (clang::Decl::Kind decl_kind) 500 { 501 switch (decl_kind) 502 { 503 case clang::Decl::CXXRecord: 504 case clang::Decl::ClassTemplateSpecialization: 505 return true; 506 default: 507 break; 508 } 509 return false; 510 } 511 512 bool 513 ParseTemplateParameterInfos (DWARFCompileUnit* dwarf_cu, 514 const DWARFDebugInfoEntry *parent_die, 515 lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos); 516 517 bool 518 ParseTemplateDIE (DWARFCompileUnit* dwarf_cu, 519 const DWARFDebugInfoEntry *die, 520 lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos); 521 522 clang::ClassTemplateDecl * 523 ParseClassTemplateDecl (clang::DeclContext *decl_ctx, 524 lldb::AccessType access_type, 525 const char *parent_name, 526 int tag_decl_kind, 527 const lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos); 528 529 bool 530 DIEDeclContextsMatch (DWARFCompileUnit* cu1, const DWARFDebugInfoEntry *die1, 531 DWARFCompileUnit* cu2, const DWARFDebugInfoEntry *die2); 532 533 bool 534 ClassContainsSelector (DWARFCompileUnit *dwarf_cu, 535 const DWARFDebugInfoEntry *class_die, 536 const lldb_private::ConstString &selector); 537 538 bool 539 CopyUniqueClassMethodTypes (SymbolFileDWARF *class_symfile, 540 lldb_private::Type *class_type, 541 DWARFCompileUnit* src_cu, 542 const DWARFDebugInfoEntry *src_class_die, 543 DWARFCompileUnit* dst_cu, 544 const DWARFDebugInfoEntry *dst_class_die, 545 DWARFDIECollection &failures); 546 547 bool 548 FixupAddress (lldb_private::Address &addr); 549 550 typedef std::set<lldb_private::Type *> TypeSet; 551 552 typedef struct { 553 lldb_private::ConstString m_name; 554 lldb::ModuleSP m_module_sp; 555 } ClangModuleInfo; 556 557 typedef std::map<uint64_t, ClangModuleInfo> ExternalTypeModuleMap; 558 559 void 560 GetTypes (DWARFCompileUnit* dwarf_cu, 561 const DWARFDebugInfoEntry *die, 562 dw_offset_t min_die_offset, 563 dw_offset_t max_die_offset, 564 uint32_t type_mask, 565 TypeSet &type_set); 566 567 typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t, lldb_private::Variable *> GlobalVariableMap; 568 569 GlobalVariableMap & 570 GetGlobalAranges(); 571 572 void 573 UpdateExternalModuleListIfNeeded(); 574 575 lldb::ModuleWP m_debug_map_module_wp; 576 SymbolFileDWARFDebugMap * m_debug_map_symfile; 577 clang::TranslationUnitDecl * m_clang_tu_decl; 578 lldb_private::Flags m_flags; 579 lldb_private::DWARFDataExtractor m_dwarf_data; 580 lldb_private::DWARFDataExtractor m_data_debug_abbrev; 581 lldb_private::DWARFDataExtractor m_data_debug_aranges; 582 lldb_private::DWARFDataExtractor m_data_debug_frame; 583 lldb_private::DWARFDataExtractor m_data_debug_info; 584 lldb_private::DWARFDataExtractor m_data_debug_line; 585 lldb_private::DWARFDataExtractor m_data_debug_loc; 586 lldb_private::DWARFDataExtractor m_data_debug_ranges; 587 lldb_private::DWARFDataExtractor m_data_debug_str; 588 lldb_private::DWARFDataExtractor m_data_apple_names; 589 lldb_private::DWARFDataExtractor m_data_apple_types; 590 lldb_private::DWARFDataExtractor m_data_apple_namespaces; 591 lldb_private::DWARFDataExtractor m_data_apple_objc; 592 593 // The unique pointer items below are generated on demand if and when someone accesses 594 // them through a non const version of this class. 595 std::unique_ptr<DWARFDebugAbbrev> m_abbr; 596 std::unique_ptr<DWARFDebugInfo> m_info; 597 std::unique_ptr<DWARFDebugLine> m_line; 598 std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_names_ap; 599 std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_types_ap; 600 std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_namespaces_ap; 601 std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_objc_ap; 602 std::unique_ptr<GlobalVariableMap> m_global_aranges_ap; 603 ExternalTypeModuleMap m_external_type_modules; 604 NameToDIE m_function_basename_index; // All concrete functions 605 NameToDIE m_function_fullname_index; // All concrete functions 606 NameToDIE m_function_method_index; // All inlined functions 607 NameToDIE m_function_selector_index; // All method names for functions of classes 608 NameToDIE m_objc_class_selectors_index; // Given a class name, find all selectors for the class 609 NameToDIE m_global_index; // Global and static variables 610 NameToDIE m_type_index; // All type DIE offsets 611 NameToDIE m_namespace_index; // All type DIE offsets 612 bool m_indexed:1, 613 m_is_external_ast_source:1, 614 m_using_apple_tables:1, 615 m_fetched_external_modules:1; 616 lldb_private::LazyBool m_supports_DW_AT_APPLE_objc_complete_type; 617 618 std::unique_ptr<DWARFDebugRanges> m_ranges; 619 UniqueDWARFASTTypeMap m_unique_ast_type_map; 620 typedef llvm::SmallPtrSet<const DWARFDebugInfoEntry *, 4> DIEPointerSet; 621 typedef llvm::DenseMap<const DWARFDebugInfoEntry *, clang::DeclContext *> DIEToDeclContextMap; 622 typedef llvm::DenseMap<const clang::DeclContext *, DIEPointerSet> DeclContextToDIEMap; 623 typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb_private::Type *> DIEToTypePtr; 624 typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb::VariableSP> DIEToVariableSP; 625 typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb::clang_type_t> DIEToClangType; 626 typedef llvm::DenseMap<lldb::clang_type_t, const DWARFDebugInfoEntry *> ClangTypeToDIE; 627 typedef llvm::DenseMap<const clang::RecordDecl *, LayoutInfo> RecordDeclToLayoutMap; 628 DIEToDeclContextMap m_die_to_decl_ctx; 629 DeclContextToDIEMap m_decl_ctx_to_die; 630 DIEToTypePtr m_die_to_type; 631 DIEToVariableSP m_die_to_variable_sp; 632 DIEToClangType m_forward_decl_die_to_clang_type; 633 ClangTypeToDIE m_forward_decl_clang_type_to_die; 634 RecordDeclToLayoutMap m_record_decl_to_layout_map; 635 }; 636 637 #endif // SymbolFileDWARF_SymbolFileDWARF_h_ 638