1 //===-- DWARFDIECollection.cpp ----------------------------------*- 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 #include "DWARFDIECollection.h"
14 #include "lldb/Core/Stream.h"
16 #include "DWARFDebugInfoEntry.h"
18 using namespace lldb_private;
22 DWARFDIECollection::Insert(const DWARFDebugInfoEntry *die)
24 iterator end_pos = m_dies.end();
25 iterator insert_pos = upper_bound(m_dies.begin(), end_pos, die);
26 if (insert_pos != end_pos && (*insert_pos == die))
28 m_dies.insert(insert_pos, die);
33 DWARFDIECollection::Append (const DWARFDebugInfoEntry *die)
35 m_dies.push_back (die);
38 const DWARFDebugInfoEntry *
39 DWARFDIECollection::GetDIEPtrAtIndex(uint32_t idx) const
41 if (idx < m_dies.size())
48 DWARFDIECollection::Size() const
54 DWARFDIECollection::Dump(Stream *s, const char* title) const
56 if (title && title[0] != '\0')
57 s->Printf( "%s\n", title);
58 const_iterator end_pos = m_dies.end();
60 for (pos = m_dies.begin(); pos != end_pos; ++pos)
61 s->Printf( "0x%8.8x\n", (*pos)->GetOffset());