[Lldb-commits] [lldb] r222576 - Add an API on SBValueList to find the first value with a given name stored in the list
Enrico Granata
egranata at apple.com
Fri Nov 21 13:45:04 PST 2014
Author: enrico
Date: Fri Nov 21 15:45:03 2014
New Revision: 222576
URL: http://llvm.org/viewvc/llvm-project?rev=222576&view=rev
Log:
Add an API on SBValueList to find the first value with a given name stored in the list
Modified:
lldb/trunk/include/lldb/API/SBValueList.h
lldb/trunk/scripts/Python/interface/SBValueList.i
lldb/trunk/source/API/SBValueList.cpp
Modified: lldb/trunk/include/lldb/API/SBValueList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValueList.h?rev=222576&r1=222575&r2=222576&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValueList.h (original)
+++ lldb/trunk/include/lldb/API/SBValueList.h Fri Nov 21 15:45:03 2014
@@ -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);
Modified: lldb/trunk/scripts/Python/interface/SBValueList.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValueList.i?rev=222576&r1=222575&r2=222576&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBValueList.i (original)
+++ lldb/trunk/scripts/Python/interface/SBValueList.i Fri Nov 21 15:45:03 2014
@@ -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())
Modified: lldb/trunk/source/API/SBValueList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValueList.cpp?rev=222576&r1=222575&r2=222576&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValueList.cpp (original)
+++ lldb/trunk/source/API/SBValueList.cpp Fri Nov 21 15:45:03 2014
@@ -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:
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 ()
{
More information about the lldb-commits
mailing list