SymbolFileDWARF.h revision e5748d889fb7fb97b3ff07444894d7714776b609
1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com//===-- SymbolFileDWARF.h --------------------------------------*- C++ -*-===//
2ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com//
3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com//                     The LLVM Compiler Infrastructure
4ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com//
5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com// This file is distributed under the University of Illinois Open Source
60f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com// License. See LICENSE.TXT for details.
70f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com//
80f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com//===----------------------------------------------------------------------===//
9ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com
100f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#ifndef liblldb_SymbolFileDWARF_h_
110f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#define liblldb_SymbolFileDWARF_h_
120f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
131744f97ea73384b9f75b0ccee0a36a213c681d3absalomon@google.com// C Includes
141744f97ea73384b9f75b0ccee0a36a213c681d3absalomon@google.com// C++ Includes
151744f97ea73384b9f75b0ccee0a36a213c681d3absalomon@google.com#include <list>
161744f97ea73384b9f75b0ccee0a36a213c681d3absalomon@google.com#include <memory>
171744f97ea73384b9f75b0ccee0a36a213c681d3absalomon@google.com#include <map>
180f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#include <vector>
190f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
200f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com// Other libraries and framework includes
210f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#include "llvm/ADT/DenseMap.h"
220f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
230f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#include "lldb/Core/ClangForward.h"
240f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#include "lldb/Core/ConstString.h"
250f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#include "lldb/Core/dwarf.h"
260f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#include "lldb/Core/DataExtractor.h"
270f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#include "lldb/Core/Flags.h"
280f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#include "lldb/Core/UniqueCStringMap.h"
290f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#include "lldb/Symbol/ClangASTContext.h"
300f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#include "lldb/Symbol/SymbolFile.h"
310f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#include "lldb/Symbol/SymbolContext.h"
320f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
330f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com// Project includes
340f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#include "DWARFDefines.h"
350f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#include "NameToDIE.h"
360f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
370f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
380f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com//----------------------------------------------------------------------
390f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com// Forward Declarations for this DWARF plugin
400f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com//----------------------------------------------------------------------
410f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.comclass DWARFAbbreviationDeclaration;
420f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.comclass DWARFAbbreviationDeclarationSet;
430f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.comclass DWARFCompileUnit;
440f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.comclass DWARFDebugAbbrev;
450f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.comclass DWARFDebugAranges;
460f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.comclass DWARFDebugInfo;
470f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.comclass DWARFDebugInfoEntry;
48bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdaltonclass DWARFDebugLine;
49bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdaltonclass DWARFDebugPubnames;
50bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdaltonclass DWARFDebugRanges;
51bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdaltonclass DWARFDIECollection;
52bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdaltonclass DWARFFormValue;
53bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdaltonclass SymbolFileDWARFDebugMap;
54bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdalton
55bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdaltonclass SymbolFileDWARF : public lldb_private::SymbolFile
56bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdalton{
57bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdaltonpublic:
58bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdalton    friend class SymbolFileDWARFDebugMap;
59bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdalton
60bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdalton    //------------------------------------------------------------------
61bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdalton    // Static Functions
62bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdalton    //------------------------------------------------------------------
63bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdalton    static void
64bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdalton    Initialize();
65bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdalton
66bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdalton    static void
67bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdalton    Terminate();
68bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdalton
69bae6f6c3ec927bc1f87cd4c13fec0b52e5677c23cdalton    static const char *
700f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    GetPluginNameStatic();
710f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
720f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    static const char *
730f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    GetPluginDescriptionStatic();
740f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
750f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    static lldb_private::SymbolFile*
760f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    CreateInstance (lldb_private::ObjectFile* obj_file);
770f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    //------------------------------------------------------------------
780f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    // Constructors and Destructors
790f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    //------------------------------------------------------------------
800f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                            SymbolFileDWARF(lldb_private::ObjectFile* ofile);
810f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual                 ~SymbolFileDWARF();
820f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
830f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual uint32_t        GetAbilities ();
840f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
850f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    //------------------------------------------------------------------
860f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    // Compile Unit function calls
870f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    //------------------------------------------------------------------
880f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual uint32_t        GetNumCompileUnits();
890f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index);
900f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
91271cffc77bd2fcb3458559e509634442517ca1e9bsalomon@google.com    virtual size_t          ParseCompileUnitFunctions (const lldb_private::SymbolContext& sc);
92271cffc77bd2fcb3458559e509634442517ca1e9bsalomon@google.com    virtual bool            ParseCompileUnitLineTable (const lldb_private::SymbolContext& sc);
93271cffc77bd2fcb3458559e509634442517ca1e9bsalomon@google.com    virtual bool            ParseCompileUnitSupportFiles (const lldb_private::SymbolContext& sc, lldb_private::FileSpecList& support_files);
94271cffc77bd2fcb3458559e509634442517ca1e9bsalomon@google.com    virtual size_t          ParseFunctionBlocks (const lldb_private::SymbolContext& sc);
95271cffc77bd2fcb3458559e509634442517ca1e9bsalomon@google.com    virtual size_t          ParseTypes (const lldb_private::SymbolContext& sc);
96271cffc77bd2fcb3458559e509634442517ca1e9bsalomon@google.com    virtual size_t          ParseVariablesForContext (const lldb_private::SymbolContext& sc);
970f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
980f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual lldb_private::Type* ResolveTypeUID(lldb::user_id_t type_uid);
990f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual lldb::clang_type_t ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_opaque_type);
1000f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1010f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual lldb_private::Type* ResolveType (DWARFCompileUnit* cu, const DWARFDebugInfoEntry* type_die, bool assert_not_being_parsed = true);
1020f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual clang::DeclContext* GetClangDeclContextForTypeUID (lldb::user_id_t type_uid);
1030f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1040f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual uint32_t        ResolveSymbolContext (const lldb_private::Address& so_addr, uint32_t resolve_scope, lldb_private::SymbolContext& sc);
1050f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    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);
1060f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual uint32_t        FindGlobalVariables(const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
1070f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual uint32_t        FindGlobalVariables(const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables);
1080f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual uint32_t        FindFunctions(const lldb_private::ConstString &name, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list);
1090f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual uint32_t        FindFunctions(const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list);
1100f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual uint32_t        FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::TypeList& types);
1110f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com//  virtual uint32_t        FindTypes(const lldb_private::SymbolContext& sc, const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb::Type::Encoding encoding, lldb::user_id_t udt_uid, lldb_private::TypeList& types);
1120f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
11373063dc517f424ad5660db0fbc5fe6fcc13f77f7jvanverth
11473063dc517f424ad5660db0fbc5fe6fcc13f77f7jvanverth    //------------------------------------------------------------------
1150f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    // PluginInterface protocol
116d7a2c1f5fd710581d6233de5c202d3f2627948e0jvanverth    //------------------------------------------------------------------
117d7a2c1f5fd710581d6233de5c202d3f2627948e0jvanverth    virtual const char *
118d7a2c1f5fd710581d6233de5c202d3f2627948e0jvanverth    GetPluginName();
1190f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
12073063dc517f424ad5660db0fbc5fe6fcc13f77f7jvanverth    virtual const char *
1210f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    GetShortPluginName();
1220f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1230f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual uint32_t
1240f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    GetPluginVersion();
1250f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1260f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual void
1270f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    GetPluginCommandHelp (const char *command, lldb_private::Stream *strm);
1280f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1290f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual lldb_private::Error
1300f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    ExecutePluginCommand (lldb_private::Args &command, lldb_private::Stream *strm);
1310f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1320f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    virtual lldb_private::Log *
1330f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    EnablePluginLogging (lldb_private::Stream *strm, lldb_private::Args &command);
1340f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1350f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    // Approach 2 - count + accessor
1360f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    // Index compile units would scan the initial compile units and register
1370f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    // them with the module. This would only be done on demand if and only if
1380f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    // the compile units were needed.
1390f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    //virtual size_t        GetCompUnitCount() = 0;
1400f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    //virtual CompUnitSP    GetCompUnitAtIndex(size_t cu_idx) = 0;
1410f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1420f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    const lldb_private::DataExtractor&      get_debug_abbrev_data();
1430f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    const lldb_private::DataExtractor&      get_debug_frame_data();
1440f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    const lldb_private::DataExtractor&      get_debug_info_data();
1450f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    const lldb_private::DataExtractor&      get_debug_line_data();
1460f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    const lldb_private::DataExtractor&      get_debug_loc_data();
1470f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    const lldb_private::DataExtractor&      get_debug_ranges_data();
1480f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    const lldb_private::DataExtractor&      get_debug_str_data();
1490f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1500f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    DWARFDebugAbbrev*       DebugAbbrev();
1510f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    const DWARFDebugAbbrev* DebugAbbrev() const;
1520f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1530f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    DWARFDebugAranges*      DebugAranges();
1540f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    const DWARFDebugAranges*DebugAranges() const;
155469d0dd944833444a363591be1ee6a76bdecf96dbsalomon@google.com
156469d0dd944833444a363591be1ee6a76bdecf96dbsalomon@google.com    DWARFDebugInfo*         DebugInfo();
157469d0dd944833444a363591be1ee6a76bdecf96dbsalomon@google.com    const DWARFDebugInfo*   DebugInfo() const;
158469d0dd944833444a363591be1ee6a76bdecf96dbsalomon@google.com
159469d0dd944833444a363591be1ee6a76bdecf96dbsalomon@google.com    DWARFDebugRanges*       DebugRanges();
160469d0dd944833444a363591be1ee6a76bdecf96dbsalomon@google.com    const DWARFDebugRanges* DebugRanges() const;
161469d0dd944833444a363591be1ee6a76bdecf96dbsalomon@google.com
162469d0dd944833444a363591be1ee6a76bdecf96dbsalomon@google.com    const lldb_private::DataExtractor&
16399babf2848095febfc5f98b47f3a6c232411147fjvanverth    GetCachedSectionData (uint32_t got_flag, lldb::SectionType sect_type, lldb_private::DataExtractor &data);
1642279325d539700ee3da29d6e874b3b3ce1dcf49cethannicholas
1650f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    static bool
1660f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    SupportedVersion(uint16_t version);
1670f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1680f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    clang::DeclContext *
1690f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    GetClangDeclContextForDIE (DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die);
1700f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1710f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    clang::DeclContext *
1720f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    GetClangDeclContextForDIEOffset (dw_offset_t die_offset);
1730f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1740f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    lldb_private::Flags&
1750f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    GetFlags ()
1760f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    {
1770f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com        return m_flags;
1780f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    }
1790f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1800f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    const lldb_private::Flags&
1810f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    GetFlags () const
1820f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    {
1830f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com        return m_flags;
1840f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    }
1850f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1860f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.comprotected:
1870f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
1880f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    enum
1890f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    {
1900f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com        flagsGotDebugAbbrevData     = (1 << 0),
1910f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com        flagsGotDebugArangesData    = (1 << 1),
1920f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com        flagsGotDebugFrameData      = (1 << 2),
1930f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com        flagsGotDebugInfoData       = (1 << 3),
1940f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com        flagsGotDebugLineData       = (1 << 4),
1950f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com        flagsGotDebugLocData        = (1 << 5),
1960f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com        flagsGotDebugMacInfoData    = (1 << 6),
1970f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com        flagsGotDebugPubNamesData   = (1 << 7),
1980f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com        flagsGotDebugPubTypesData   = (1 << 8),
1990f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com        flagsGotDebugRangesData     = (1 << 9),
2000f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com        flagsGotDebugStrData        = (1 << 10),
2010f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    };
2020f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
2030f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    DISALLOW_COPY_AND_ASSIGN (SymbolFileDWARF);
2040f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    bool                    ParseCompileUnit (DWARFCompileUnit* cu, lldb::CompUnitSP& compile_unit_sp);
2050f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    DWARFCompileUnit*       GetDWARFCompileUnitForUID(lldb::user_id_t cu_uid);
2060f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    DWARFCompileUnit*       GetNextUnparsedDWARFCompileUnit(DWARFCompileUnit* prev_cu);
2070f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    lldb_private::CompileUnit*      GetCompUnitForDWARFCompUnit(DWARFCompileUnit* cu, uint32_t cu_idx = UINT32_MAX);
2080f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    bool                    GetFunction (DWARFCompileUnit* cu, const DWARFDebugInfoEntry* func_die, lldb_private::SymbolContext& sc);
2098ef3fd0ca6595adb9a8172c84dc0c55c9c096e09bsalomon@google.com    lldb_private::Function *        ParseCompileUnitFunction (const lldb_private::SymbolContext& sc, DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry *die);
2100f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    size_t                  ParseFunctionBlocks (const lldb_private::SymbolContext& sc,
21156d11e097b1975371d0e0b1452ac0c4d5fc46930bsalomon@google.com                                                 lldb_private::Block *parent_block,
2120f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                                 DWARFCompileUnit* dwarf_cu,
2130f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                                 const DWARFDebugInfoEntry *die,
2140f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                                 lldb::addr_t subprogram_low_pc,
2150f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                                 bool parse_siblings,
2160f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                                 bool parse_children);
2170f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    size_t                  ParseTypes (const lldb_private::SymbolContext& sc, DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry *die, bool parse_siblings, bool parse_children);
2180f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    lldb::TypeSP            ParseType (const lldb_private::SymbolContext& sc, DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry *die, bool *type_is_new);
2190f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
2200f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    lldb::VariableSP        ParseVariableDIE(
2210f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                const lldb_private::SymbolContext& sc,
2220f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                DWARFCompileUnit* dwarf_cu,
2230f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                const DWARFDebugInfoEntry *die,
2240f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                const lldb::addr_t func_low_pc);
2250f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
2260f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    size_t                  ParseVariables(
2270f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                const lldb_private::SymbolContext& sc,
2280f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                DWARFCompileUnit* dwarf_cu,
229c9668ecdb7188a90b050771727da899c54dc7013bsalomon@google.com                                const lldb::addr_t func_low_pc,
230c9668ecdb7188a90b050771727da899c54dc7013bsalomon@google.com                                const DWARFDebugInfoEntry *die,
231c9668ecdb7188a90b050771727da899c54dc7013bsalomon@google.com                                bool parse_siblings,
232c9668ecdb7188a90b050771727da899c54dc7013bsalomon@google.com                                bool parse_children,
2330f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                lldb_private::VariableList* cc_variable_list = NULL);
2340f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
2350f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    size_t                  ParseChildMembers(
2360f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                const lldb_private::SymbolContext& sc,
2370f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                DWARFCompileUnit* dwarf_cu,
2380f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                const DWARFDebugInfoEntry *die,
2390f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                lldb::clang_type_t class_clang_type,
2400f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                const lldb::LanguageType class_language,
2410f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                std::vector<clang::CXXBaseSpecifier *>& base_classes,
2420f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com                                std::vector<int>& member_accessibilities,
243c2dbbb6ac2fee5461a906d1a18e5f410acadb452commit-bot@chromium.org                                DWARFDIECollection& member_function_dies,
244d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                lldb::AccessType &default_accessibility,
245d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                bool &is_a_class);
246d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel
247d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel    size_t                  ParseChildParameters(
248d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                const lldb_private::SymbolContext& sc,
249d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                lldb::TypeSP& type_sp,
250d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                DWARFCompileUnit* dwarf_cu,
251d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                const DWARFDebugInfoEntry *parent_die,
252d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                bool skip_artificial,
253d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                lldb_private::TypeList* type_list,
254d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                std::vector<lldb::clang_type_t>& function_args,
255d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                std::vector<clang::ParmVarDecl*>& function_param_decls);
256d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel
257d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel    size_t                  ParseChildEnumerators(
258d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                const lldb_private::SymbolContext& sc,
259d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                lldb::clang_type_t enumerator_qual_type,
260d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                uint32_t enumerator_byte_size,
261d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                DWARFCompileUnit* dwarf_cu,
262d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                const DWARFDebugInfoEntry *enum_die);
263d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel
264d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel    void                    ParseChildArrayInfo(
265d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                const lldb_private::SymbolContext& sc,
266d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                DWARFCompileUnit* dwarf_cu,
267d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                const DWARFDebugInfoEntry *parent_die,
268d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                int64_t& first_index,
269d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                std::vector<uint64_t>& element_orders,
270d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                uint32_t& byte_stride,
271d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                uint32_t& bit_stride);
272d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel
273d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel    void                    FindFunctions(
274d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                const lldb_private::ConstString &name,
275d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                const NameToDIE &name_to_die,
276d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                lldb_private::SymbolContextList& sc_list);
277d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel
278d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel    void                    FindFunctions (
279d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                const lldb_private::RegularExpression &regex,
280d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                const NameToDIE &name_to_die,
281d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                lldb_private::SymbolContextList& sc_list);
282d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel
283d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel    lldb::TypeSP            FindDefinitionTypeForDIE (
284d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                DWARFCompileUnit* cu,
285d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                const DWARFDebugInfoEntry *die,
286d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel                                const lldb_private::ConstString &type_name);
287d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel
288d588c01c7e48663d6d61686e47daf63b9b0b3d12egdaniel    lldb::TypeSP            GetTypeForDIE (DWARFCompileUnit *cu,
28954c6fe8519f2927181a0847d22a61190529645e8bsalomon                                           const DWARFDebugInfoEntry* die);
29054c6fe8519f2927181a0847d22a61190529645e8bsalomon
29154c6fe8519f2927181a0847d22a61190529645e8bsalomon    uint32_t                FindTypes(std::vector<dw_offset_t> die_offsets, uint32_t max_matches, lldb_private::TypeList& types);
29254c6fe8519f2927181a0847d22a61190529645e8bsalomon
29354c6fe8519f2927181a0847d22a61190529645e8bsalomon    void                    Index();
29454c6fe8519f2927181a0847d22a61190529645e8bsalomon
29554c6fe8519f2927181a0847d22a61190529645e8bsalomon    void                    SetDebugMapSymfile (SymbolFileDWARFDebugMap *debug_map_symfile)
29654c6fe8519f2927181a0847d22a61190529645e8bsalomon                            {
29754c6fe8519f2927181a0847d22a61190529645e8bsalomon                                m_debug_map_symfile = debug_map_symfile;
29854c6fe8519f2927181a0847d22a61190529645e8bsalomon                            }
29954c6fe8519f2927181a0847d22a61190529645e8bsalomon
30054c6fe8519f2927181a0847d22a61190529645e8bsalomon    SymbolFileDWARFDebugMap *       m_debug_map_symfile;
30154c6fe8519f2927181a0847d22a61190529645e8bsalomon    clang::TranslationUnitDecl *    m_clang_tu_decl;
30254c6fe8519f2927181a0847d22a61190529645e8bsalomon    lldb_private::Flags             m_flags;
30354c6fe8519f2927181a0847d22a61190529645e8bsalomon    lldb_private::DataExtractor     m_dwarf_data;
30454c6fe8519f2927181a0847d22a61190529645e8bsalomon    lldb_private::DataExtractor     m_data_debug_abbrev;
30554c6fe8519f2927181a0847d22a61190529645e8bsalomon    lldb_private::DataExtractor     m_data_debug_frame;
30654c6fe8519f2927181a0847d22a61190529645e8bsalomon    lldb_private::DataExtractor     m_data_debug_info;
30754c6fe8519f2927181a0847d22a61190529645e8bsalomon    lldb_private::DataExtractor     m_data_debug_line;
30854c6fe8519f2927181a0847d22a61190529645e8bsalomon    lldb_private::DataExtractor     m_data_debug_loc;
30954c6fe8519f2927181a0847d22a61190529645e8bsalomon    lldb_private::DataExtractor     m_data_debug_ranges;
31054c6fe8519f2927181a0847d22a61190529645e8bsalomon    lldb_private::DataExtractor     m_data_debug_str;
31154c6fe8519f2927181a0847d22a61190529645e8bsalomon
31254c6fe8519f2927181a0847d22a61190529645e8bsalomon    // The auto_ptr items below are generated on demand if and when someone accesses
31354c6fe8519f2927181a0847d22a61190529645e8bsalomon    // them through a non const version of this class.
31454c6fe8519f2927181a0847d22a61190529645e8bsalomon    std::auto_ptr<DWARFDebugAbbrev>     m_abbr;
31554c6fe8519f2927181a0847d22a61190529645e8bsalomon    std::auto_ptr<DWARFDebugAranges>    m_aranges;
31654c6fe8519f2927181a0847d22a61190529645e8bsalomon    std::auto_ptr<DWARFDebugInfo>       m_info;
31754c6fe8519f2927181a0847d22a61190529645e8bsalomon    std::auto_ptr<DWARFDebugLine>       m_line;
318c2dbbb6ac2fee5461a906d1a18e5f410acadb452commit-bot@chromium.org    NameToDIE                           m_function_basename_index;  // All concrete functions
3190f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    NameToDIE                           m_function_fullname_index;  // All concrete functions
3200f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    NameToDIE                           m_function_method_index;    // All inlined functions
3210f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    NameToDIE                           m_function_selector_index;  // All method names for functions of classes
3220f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    NameToDIE                           m_objc_class_selectors_index; // Given a class name, find all selectors for the class
3230f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    NameToDIE                           m_global_index;                 // Global and static variables
3240f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    NameToDIE                           m_type_index;                  // All type DIE offsets
3250f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    NameToDIE                           m_namespace_index;              // All type DIE offsets
3260f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    bool m_indexed;
3270f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
3280f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    std::auto_ptr<DWARFDebugRanges>     m_ranges;
3290f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
3300f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    typedef llvm::DenseMap<const DWARFDebugInfoEntry *, clang::DeclContext *> DIEToDeclContextMap;
3310f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb_private::Type *> DIEToTypePtr;
3320f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb::VariableSP> DIEToVariableSP;
3330f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb::clang_type_t> DIEToClangType;
3340f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    typedef llvm::DenseMap<lldb::clang_type_t, const DWARFDebugInfoEntry *> ClangTypeToDIE;
33528f9c606e4c8e61015e864219c4bc83a3fdb4a86jvanverth    DIEToDeclContextMap m_die_to_decl_ctx;
3360f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    DIEToTypePtr m_die_to_type;
33728f9c606e4c8e61015e864219c4bc83a3fdb4a86jvanverth    DIEToVariableSP m_die_to_variable_sp;
3380f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    DIEToClangType m_forward_decl_die_to_clang_type;
3390f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com    ClangTypeToDIE m_forward_decl_clang_type_to_die;
3400f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com};
3410f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com
3420f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com#endif  // liblldb_SymbolFileDWARF_h_
3430f31ca79bde088e6caac219734c35c1ae3e9e8b9twiz@google.com