1 //===-- ValueObjectList.cpp -------------------------------------*- 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 #include "lldb/Core/ValueObjectList.h" 11 12 // C Includes 13 // C++ Includes 14 // Other libraries and framework includes 15 // Project includes 16 #include "lldb/Core/ValueObjectChild.h" 17 #include "lldb/Core/ValueObjectRegister.h" 18 #include "lldb/Core/ValueObjectVariable.h" 19 #include "lldb/Target/ExecutionContext.h" 20 #include "lldb/Target/Process.h" 21 22 using namespace lldb; 23 using namespace lldb_private; 24 25 ValueObjectList::ValueObjectList () : 26 m_value_objects() 27 { 28 } 29 30 ValueObjectList::ValueObjectList (const ValueObjectList &rhs) : 31 m_value_objects(rhs.m_value_objects) 32 { 33 } 34 35 36 ValueObjectList::~ValueObjectList () 37 { 38 } 39 40 const ValueObjectList & 41 ValueObjectList::operator = (const ValueObjectList &rhs) 42 { 43 if (this != &rhs) 44 m_value_objects = rhs.m_value_objects; 45 return *this; 46 } 47 48 void 49 ValueObjectList::Append (const ValueObjectSP &val_obj_sp) 50 { 51 m_value_objects.push_back(val_obj_sp); 52 } 53 54 uint32_t 55 ValueObjectList::GetSize() const 56 { 57 return m_value_objects.size(); 58 } 59 60 lldb::ValueObjectSP 61 ValueObjectList::GetValueObjectAtIndex (uint32_t idx) 62 { 63 lldb::ValueObjectSP valobj_sp; 64 if (idx < m_value_objects.size()) 65 valobj_sp = m_value_objects[idx]; 66 return valobj_sp; 67 } 68 69 ValueObjectSP 70 ValueObjectList::FindValueObjectByValueName (const char *name) 71 { 72 ConstString name_const_str(name); 73 ValueObjectSP val_obj_sp; 74 collection::iterator pos, end = m_value_objects.end(); 75 for (pos = m_value_objects.begin(); pos != end; ++pos) 76 { 77 if ((*pos)->GetName() == name_const_str) 78 { 79 val_obj_sp = *pos; 80 break; 81 } 82 } 83 return val_obj_sp; 84 } 85 86 ValueObjectSP 87 ValueObjectList::FindValueObjectByUID (lldb::user_id_t uid) 88 { 89 ValueObjectSP valobj_sp; 90 collection::iterator pos, end = m_value_objects.end(); 91 92 for (pos = m_value_objects.begin(); pos != end; ++pos) 93 { 94 if ((*pos)->GetID() == uid) 95 { 96 valobj_sp = *pos; 97 break; 98 } 99 } 100 return valobj_sp; 101 } 102 103 104 ValueObjectSP 105 ValueObjectList::FindValueObjectByPointer (ValueObject *valobj) 106 { 107 ValueObjectSP valobj_sp; 108 collection::iterator pos, end = m_value_objects.end(); 109 110 for (pos = m_value_objects.begin(); pos != end; ++pos) 111 { 112 if ((*pos).get() == valobj) 113 { 114 valobj_sp = *pos; 115 break; 116 } 117 } 118 return valobj_sp; 119 } 120