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