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