Add an API on SBValueList to find the first value with a given name stored in the list

llvm-svn: 222576
This commit is contained in:
Enrico Granata 2014-11-21 21:45:03 +00:00
parent 91ffec908f
commit e9a09c74fa
3 changed files with 31 additions and 0 deletions

View File

@ -43,6 +43,9 @@ public:
lldb::SBValue
GetValueAtIndex (uint32_t idx) const;
lldb::SBValue
GetValueByName (const char* name) const;
lldb::SBValue
FindValueObjectByUID (lldb::user_id_t uid);

View File

@ -96,6 +96,10 @@ public:
lldb::SBValue
FindValueObjectByUID (lldb::user_id_t uid);
lldb::SBValue
GetValueByName (const char* name) const;
%pythoncode %{
def __len__(self):
return int(self.GetSize())

View File

@ -78,6 +78,21 @@ public:
}
return lldb::SBValue();
}
lldb::SBValue
GetValueByName (const char* name) const
{
if (name)
{
for (auto val : m_values)
{
if (val.IsValid() && val.GetName() &&
strcmp(name,val.GetName()) == 0)
return val;
}
}
return lldb::SBValue();
}
private:
std::vector<lldb::SBValue> m_values;
@ -261,6 +276,15 @@ SBValueList::FindValueObjectByUID (lldb::user_id_t uid)
return sb_value;
}
SBValue
SBValueList::GetValueByName (const char* name) const
{
SBValue sb_value;
if (m_opaque_ap.get())
sb_value = m_opaque_ap->GetValueByName(name);
return sb_value;
}
void *
SBValueList::opaque_ptr ()
{