From e2e220a805b143d9bc8544abedff30204dcf6629 Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Thu, 12 Sep 2013 00:48:47 +0000 Subject: SVN r189964 provided a sample Python script to inspect unordered(multi){set|map} with synthetic children, contribued by Jared Grubb This checkin converts that sample script to a C++ provider built into LLDB A test case is also provided llvm-svn: 190564 --- lldb/source/Core/ValueObject.cpp | 80 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'lldb/source/Core/ValueObject.cpp') diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index a30cc1306c6..8bb285db05d 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -595,6 +595,86 @@ ValueObject::GetChildAtIndexPath (const std::vector< std::pair > & return root; } +lldb::ValueObjectSP +ValueObject::GetChildAtNamePath (const std::initializer_list &names, + ConstString* name_of_error) +{ + if (names.size() == 0) + return GetSP(); + ValueObjectSP root(GetSP()); + for (ConstString name : names) + { + root = root->GetChildMemberWithName(name, true); + if (!root) + { + if (name_of_error) + *name_of_error = name; + return root; + } + } + return root; +} + +lldb::ValueObjectSP +ValueObject::GetChildAtNamePath (const std::vector &names, + ConstString* name_of_error) +{ + if (names.size() == 0) + return GetSP(); + ValueObjectSP root(GetSP()); + for (ConstString name : names) + { + root = root->GetChildMemberWithName(name, true); + if (!root) + { + if (name_of_error) + *name_of_error = name; + return root; + } + } + return root; +} + +lldb::ValueObjectSP +ValueObject::GetChildAtNamePath (const std::initializer_list< std::pair > &names, + ConstString* name_of_error) +{ + if (names.size() == 0) + return GetSP(); + ValueObjectSP root(GetSP()); + for (std::pair name : names) + { + root = root->GetChildMemberWithName(name.first, name.second); + if (!root) + { + if (name_of_error) + *name_of_error = name.first; + return root; + } + } + return root; +} + +lldb::ValueObjectSP +ValueObject::GetChildAtNamePath (const std::vector< std::pair > &names, + ConstString* name_of_error) +{ + if (names.size() == 0) + return GetSP(); + ValueObjectSP root(GetSP()); + for (std::pair name : names) + { + root = root->GetChildMemberWithName(name.first, name.second); + if (!root) + { + if (name_of_error) + *name_of_error = name.first; + return root; + } + } + return root; +} + size_t ValueObject::GetIndexOfChildWithName (const ConstString &name) { -- cgit v1.2.3