diff options
author | Enrico Granata <egranata@apple.com> | 2014-11-21 21:45:03 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2014-11-21 21:45:03 +0000 |
commit | e9a09c74fa925e8aed2de0f12cce8d86215955d3 (patch) | |
tree | e7d7e6ea5f3e460430fcf10d23c7a3220c8bed93 | |
parent | 91ffec908f8721d7cf0a58de2a9b3c0987461980 (diff) | |
download | bcm5719-llvm-e9a09c74fa925e8aed2de0f12cce8d86215955d3.tar.gz bcm5719-llvm-e9a09c74fa925e8aed2de0f12cce8d86215955d3.zip |
Add an API on SBValueList to find the first value with a given name stored in the list
llvm-svn: 222576
-rw-r--r-- | lldb/include/lldb/API/SBValueList.h | 3 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBValueList.i | 4 | ||||
-rw-r--r-- | lldb/source/API/SBValueList.cpp | 24 |
3 files changed, 31 insertions, 0 deletions
diff --git a/lldb/include/lldb/API/SBValueList.h b/lldb/include/lldb/API/SBValueList.h index b9a6aedea3c..154311d4b98 100644 --- a/lldb/include/lldb/API/SBValueList.h +++ b/lldb/include/lldb/API/SBValueList.h @@ -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); diff --git a/lldb/scripts/Python/interface/SBValueList.i b/lldb/scripts/Python/interface/SBValueList.i index a55345030c0..12aed864830 100644 --- a/lldb/scripts/Python/interface/SBValueList.i +++ b/lldb/scripts/Python/interface/SBValueList.i @@ -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()) diff --git a/lldb/source/API/SBValueList.cpp b/lldb/source/API/SBValueList.cpp index 5069ed3f562..e96f482d4c9 100644 --- a/lldb/source/API/SBValueList.cpp +++ b/lldb/source/API/SBValueList.cpp @@ -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 () { |