1 //===-- DWARFDebugPubnamesSet.h ---------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef SymbolFileDWARF_DWARFDebugPubnamesSet_h_
11 #define SymbolFileDWARF_DWARFDebugPubnamesSet_h_
13 #include "SymbolFileDWARF.h"
16 #if __cplusplus >= 201103L || defined(_MSC_VER)
17 #include <unordered_map>
19 #include <ext/hash_map>
22 class DWARFDebugPubnamesSet
27 uint32_t length; // length of the set of entries for this compilation unit, not including the length field itself
28 uint16_t version; // The DWARF version number
29 uint32_t die_offset; // compile unit .debug_info offset
30 uint32_t die_length; // compile unit .debug_info length
34 die_offset(DW_INVALID_OFFSET),
48 Descriptor(dw_offset_t the_offset, const char *the_name) :
50 name(the_name ? the_name : "")
58 DWARFDebugPubnamesSet();
59 DWARFDebugPubnamesSet(dw_offset_t debug_aranges_offset, dw_offset_t cu_die_offset, dw_offset_t die_length);
60 dw_offset_t GetOffset() const { return m_offset; }
61 void SetOffset(dw_offset_t offset) { m_offset = offset; }
62 DWARFDebugPubnamesSet::Header& GetHeader() { return m_header; }
63 const DWARFDebugPubnamesSet::Header& GetHeader() const { return m_header; }
64 const DWARFDebugPubnamesSet::Descriptor* GetDescriptor(uint32_t i) const
66 if (i < m_descriptors.size())
67 return &m_descriptors[i];
70 uint32_t NumDescriptors() const { return m_descriptors.size(); }
71 void AddDescriptor(dw_offset_t cu_rel_offset, const char* name);
73 bool Extract(const lldb_private::DWARFDataExtractor& debug_pubnames_data, lldb::offset_t *offset_ptr);
74 void Dump(lldb_private::Log *s) const;
75 void InitNameIndexes() const;
76 void Find(const char* name, bool ignore_case, std::vector<dw_offset_t>& die_offset_coll) const;
77 void Find(const lldb_private::RegularExpression& regex, std::vector<dw_offset_t>& die_offsets) const;
78 dw_offset_t GetOffsetOfNextEntry() const;
83 typedef std::vector<Descriptor> DescriptorColl;
84 typedef DescriptorColl::iterator DescriptorIter;
85 typedef DescriptorColl::const_iterator DescriptorConstIter;
90 #if __cplusplus >= 201103L || defined(_MSC_VER)
91 typedef std::unordered_multimap<const char*, uint32_t, std::hash<const char*>, CStringEqualBinaryPredicate> cstr_to_index_mmap;
93 typedef __gnu_cxx::hash_multimap<const char*, uint32_t, __gnu_cxx::hash<const char*>, CStringEqualBinaryPredicate> cstr_to_index_mmap;
95 DescriptorColl m_descriptors;
96 mutable cstr_to_index_mmap m_name_to_descriptor_index;
99 #endif // SymbolFileDWARF_DWARFDebugPubnamesSet_h_