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 lldb_private::ConstString
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 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::DataExtractor&      get_debug_abbrev_data ();
198     const lldb_private::DataExtractor&      get_debug_aranges_data ();
199     const lldb_private::DataExtractor&      get_debug_frame_data ();
200     const lldb_private::DataExtractor&      get_debug_info_data ();
201     const lldb_private::DataExtractor&      get_debug_line_data ();
202     const lldb_private::DataExtractor&      get_debug_loc_data ();
203     const lldb_private::DataExtractor&      get_debug_ranges_data ();
204     const lldb_private::DataExtractor&      get_debug_str_data ();
205     const lldb_private::DataExtractor&      get_apple_names_data ();
206     const lldb_private::DataExtractor&      get_apple_types_data ();
207     const lldb_private::DataExtractor&      get_apple_namespaces_data ();
208     const lldb_private::DataExtractor&      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::DataExtractor&
221     GetCachedSectionData (uint32_t got_flag,
222                           lldb::SectionType sect_type,
223                           lldb_private::DataExtractor &data);
224 
225     static bool
226     SupportedVersion(uint16_t version);
227 
228     clang::DeclContext *
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&
261     GetFlags ()
262     {
263         return m_flags;
264     }
265 
266     const lldb_private::Flags&
267     GetFlags () const
268     {
269         return m_flags;
270     }
271 
272     bool
273     HasForwardDeclForClangType (lldb::clang_type_t 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::clang_type_t 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                                 lldb_private::TypeList* type_list,
363                                 std::vector<lldb::clang_type_t>& function_args,
364                                 std::vector<clang::ParmVarDecl*>& function_param_decls,
365                                 unsigned &type_quals,
366                                 lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos);
367 
368     size_t                  ParseChildEnumerators(
369                                 const lldb_private::SymbolContext& sc,
370                                 lldb::clang_type_t enumerator_qual_type,
371                                 bool is_signed,
372                                 uint32_t enumerator_byte_size,
373                                 DWARFCompileUnit* dwarf_cu,
374                                 const DWARFDebugInfoEntry *enum_die);
375 
376     void                    ParseChildArrayInfo(
377                                 const lldb_private::SymbolContext& sc,
378                                 DWARFCompileUnit* dwarf_cu,
379                                 const DWARFDebugInfoEntry *parent_die,
380                                 int64_t& first_index,
381                                 std::vector<uint64_t>& element_orders,
382                                 uint32_t& byte_stride,
383                                 uint32_t& bit_stride);
384 
385                             // Given a die_offset, figure out the symbol context representing that die.
386     bool                    ResolveFunction (dw_offset_t offset,
387                                              DWARFCompileUnit *&dwarf_cu,
388                                              lldb_private::SymbolContextList& sc_list);
389 
390     bool                    ResolveFunction (DWARFCompileUnit *cu,
391                                              const DWARFDebugInfoEntry *die,
392                                              lldb_private::SymbolContextList& sc_list);
393 
394     bool                    FunctionDieMatchesPartialName (
395                                 const DWARFDebugInfoEntry* die,
396                                 const DWARFCompileUnit *dwarf_cu,
397                                 uint32_t name_type_mask,
398                                 const char *partial_name,
399                                 const char *base_name_start,
400                                 const char *base_name_end);
401 
402     void                    FindFunctions(
403                                 const lldb_private::ConstString &name,
404                                 const NameToDIE &name_to_die,
405                                 lldb_private::SymbolContextList& sc_list);
406 
407     void                    FindFunctions (
408                                 const lldb_private::RegularExpression &regex,
409                                 const NameToDIE &name_to_die,
410                                 lldb_private::SymbolContextList& sc_list);
411 
412     void                    FindFunctions (
413                                 const lldb_private::RegularExpression &regex,
414                                 const DWARFMappedHash::MemoryTable &memory_table,
415                                 lldb_private::SymbolContextList& sc_list);
416 
417     lldb::TypeSP            FindDefinitionTypeForDIE (
418                                 DWARFCompileUnit* dwarf_cu,
419                                 const DWARFDebugInfoEntry *die,
420                                 const lldb_private::ConstString &type_name);
421 
422     lldb::TypeSP            FindDefinitionTypeForDWARFDeclContext (
423                                 const DWARFDeclContext &die_decl_ctx);
424 
425     lldb::TypeSP            FindCompleteObjCDefinitionTypeForDIE (
426                                 const DWARFDebugInfoEntry *die,
427                                 const lldb_private::ConstString &type_name,
428                                 bool must_be_implementation);
429 
430     bool                    Supports_DW_AT_APPLE_objc_complete_type (DWARFCompileUnit *cu);
431 
432     lldb::TypeSP            FindCompleteObjCDefinitionType (const lldb_private::ConstString &type_name,
433                                                             bool header_definition_ok);
434 
435     lldb_private::Symbol *  GetObjCClassSymbol (const lldb_private::ConstString &objc_class_name);
436 
437     void                    ParseFunctions (const DIEArray &die_offsets,
438                                             lldb_private::SymbolContextList& sc_list);
439     lldb::TypeSP            GetTypeForDIE (DWARFCompileUnit *cu,
440                                            const DWARFDebugInfoEntry* die);
441 
442     uint32_t                FindTypes(std::vector<dw_offset_t> die_offsets, uint32_t max_matches, lldb_private::TypeList& types);
443 
444     void                    Index();
445 
446     void                    DumpIndexes();
447 
448     void                    SetDebugMapModule (const lldb::ModuleSP &module_sp)
449                             {
450                                 m_debug_map_module_wp = module_sp;
451                             }
452 
453     SymbolFileDWARFDebugMap *
454                             GetDebugMapSymfile ();
455 
456     const DWARFDebugInfoEntry *
457                             FindBlockContainingSpecification (dw_offset_t func_die_offset,
458                                                               dw_offset_t spec_block_die_offset,
459                                                               DWARFCompileUnit **dwarf_cu_handle);
460 
461     const DWARFDebugInfoEntry *
462                             FindBlockContainingSpecification (DWARFCompileUnit* dwarf_cu,
463                                                               const DWARFDebugInfoEntry *die,
464                                                               dw_offset_t spec_block_die_offset,
465                                                               DWARFCompileUnit **dwarf_cu_handle);
466 
467     clang::NamespaceDecl *
468     ResolveNamespaceDIE (DWARFCompileUnit *curr_cu, const DWARFDebugInfoEntry *die);
469 
470     UniqueDWARFASTTypeMap &
471     GetUniqueDWARFASTTypeMap ();
472 
473     void                    LinkDeclContextToDIE (clang::DeclContext *decl_ctx,
474                                                   const DWARFDebugInfoEntry *die)
475                             {
476                                 m_die_to_decl_ctx[die] = decl_ctx;
477                                 // There can be many DIEs for a single decl context
478                                 m_decl_ctx_to_die[decl_ctx].insert(die);
479                             }
480 
481     bool
482     UserIDMatches (lldb::user_id_t uid) const
483     {
484         const lldb::user_id_t high_uid = uid & 0xffffffff00000000ull;
485         if (high_uid)
486             return high_uid == GetID();
487         return true;
488     }
489 
490     lldb::user_id_t
491     MakeUserID (dw_offset_t die_offset) const
492     {
493         return GetID() | die_offset;
494     }
495 
496     static bool
497     DeclKindIsCXXClass (clang::Decl::Kind decl_kind)
498     {
499         switch (decl_kind)
500         {
501             case clang::Decl::CXXRecord:
502             case clang::Decl::ClassTemplateSpecialization:
503                 return true;
504             default:
505                 break;
506         }
507         return false;
508     }
509 
510     bool
511     ParseTemplateParameterInfos (DWARFCompileUnit* dwarf_cu,
512                                  const DWARFDebugInfoEntry *parent_die,
513                                  lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos);
514 
515     bool
516     ParseTemplateDIE (DWARFCompileUnit* dwarf_cu,
517                       const DWARFDebugInfoEntry *die,
518                       lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos);
519 
520     clang::ClassTemplateDecl *
521     ParseClassTemplateDecl (clang::DeclContext *decl_ctx,
522                             lldb::AccessType access_type,
523                             const char *parent_name,
524                             int tag_decl_kind,
525                             const lldb_private::ClangASTContext::TemplateParameterInfos &template_param_infos);
526 
527     bool
528     DIEDeclContextsMatch (DWARFCompileUnit* cu1, const DWARFDebugInfoEntry *die1,
529                           DWARFCompileUnit* cu2, const DWARFDebugInfoEntry *die2);
530 
531     bool
532     ClassContainsSelector (DWARFCompileUnit *dwarf_cu,
533                            const DWARFDebugInfoEntry *class_die,
534                            const lldb_private::ConstString &selector);
535 
536     bool
537     CopyUniqueClassMethodTypes (SymbolFileDWARF *class_symfile,
538                                 lldb_private::Type *class_type,
539                                 DWARFCompileUnit* src_cu,
540                                 const DWARFDebugInfoEntry *src_class_die,
541                                 DWARFCompileUnit* dst_cu,
542                                 const DWARFDebugInfoEntry *dst_class_die,
543                                 llvm::SmallVectorImpl <const DWARFDebugInfoEntry *> &failures);
544 
545     bool
546     FixupAddress (lldb_private::Address &addr);
547 
548     lldb::ModuleWP                  m_debug_map_module_wp;
549     SymbolFileDWARFDebugMap *       m_debug_map_symfile;
550     clang::TranslationUnitDecl *    m_clang_tu_decl;
551     lldb_private::Flags             m_flags;
552     lldb_private::DataExtractor     m_dwarf_data;
553     lldb_private::DataExtractor     m_data_debug_abbrev;
554     lldb_private::DataExtractor     m_data_debug_aranges;
555     lldb_private::DataExtractor     m_data_debug_frame;
556     lldb_private::DataExtractor     m_data_debug_info;
557     lldb_private::DataExtractor     m_data_debug_line;
558     lldb_private::DataExtractor     m_data_debug_loc;
559     lldb_private::DataExtractor     m_data_debug_ranges;
560     lldb_private::DataExtractor     m_data_debug_str;
561     lldb_private::DataExtractor     m_data_apple_names;
562     lldb_private::DataExtractor     m_data_apple_types;
563     lldb_private::DataExtractor     m_data_apple_namespaces;
564     lldb_private::DataExtractor     m_data_apple_objc;
565 
566     // The unique pointer items below are generated on demand if and when someone accesses
567     // them through a non const version of this class.
568     std::unique_ptr<DWARFDebugAbbrev>     m_abbr;
569     std::unique_ptr<DWARFDebugInfo>       m_info;
570     std::unique_ptr<DWARFDebugLine>       m_line;
571     std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_names_ap;
572     std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_types_ap;
573     std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_namespaces_ap;
574     std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_objc_ap;
575     NameToDIE                           m_function_basename_index;  // All concrete functions
576     NameToDIE                           m_function_fullname_index;  // All concrete functions
577     NameToDIE                           m_function_method_index;    // All inlined functions
578     NameToDIE                           m_function_selector_index;  // All method names for functions of classes
579     NameToDIE                           m_objc_class_selectors_index; // Given a class name, find all selectors for the class
580     NameToDIE                           m_global_index;             // Global and static variables
581     NameToDIE                           m_type_index;               // All type DIE offsets
582     NameToDIE                           m_namespace_index;          // All type DIE offsets
583     bool                                m_indexed:1,
584                                         m_is_external_ast_source:1,
585                                         m_using_apple_tables:1;
586     lldb_private::LazyBool              m_supports_DW_AT_APPLE_objc_complete_type;
587 
588     std::unique_ptr<DWARFDebugRanges>     m_ranges;
589     UniqueDWARFASTTypeMap m_unique_ast_type_map;
590     typedef llvm::SmallPtrSet<const DWARFDebugInfoEntry *, 4> DIEPointerSet;
591     typedef llvm::DenseMap<const DWARFDebugInfoEntry *, clang::DeclContext *> DIEToDeclContextMap;
592     typedef llvm::DenseMap<const clang::DeclContext *, DIEPointerSet> DeclContextToDIEMap;
593     typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb_private::Type *> DIEToTypePtr;
594     typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb::VariableSP> DIEToVariableSP;
595     typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb::clang_type_t> DIEToClangType;
596     typedef llvm::DenseMap<lldb::clang_type_t, const DWARFDebugInfoEntry *> ClangTypeToDIE;
597     typedef llvm::DenseMap<const clang::RecordDecl *, LayoutInfo> RecordDeclToLayoutMap;
598     DIEToDeclContextMap m_die_to_decl_ctx;
599     DeclContextToDIEMap m_decl_ctx_to_die;
600     DIEToTypePtr m_die_to_type;
601     DIEToVariableSP m_die_to_variable_sp;
602     DIEToClangType m_forward_decl_die_to_clang_type;
603     ClangTypeToDIE m_forward_decl_clang_type_to_die;
604     RecordDeclToLayoutMap m_record_decl_to_layout_map;
605 };
606 
607 #endif  // SymbolFileDWARF_SymbolFileDWARF_h_
608