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