https://github.com/PortalPete created https://github.com/llvm/llvm-project/pull/74413
rdar://119169160 >From 26891e6fab2c6ecc13ee11b6c2f4adbb1c936058 Mon Sep 17 00:00:00 2001 From: Pete Lawrence <plawre...@apple.com> Date: Mon, 4 Dec 2023 18:29:37 -1000 Subject: [PATCH] [lldb] Return index of element in ValueObject path instead of the element's value rdar://119169160 --- lldb/source/Core/ValueObject.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index a7f7ee64282d8..b13bffa0ca809 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -398,13 +398,16 @@ ValueObject::GetChildAtIndexPath(llvm::ArrayRef<size_t> idxs, if (idxs.size() == 0) return GetSP(); ValueObjectSP root(GetSP()); + + size_t current_index = 0; for (size_t idx : idxs) { root = root->GetChildAtIndex(idx); if (!root) { if (index_of_error) - *index_of_error = idx; + *index_of_error = current_index; return root; } + current_index += 1; } return root; } @@ -414,13 +417,17 @@ lldb::ValueObjectSP ValueObject::GetChildAtIndexPath( if (idxs.size() == 0) return GetSP(); ValueObjectSP root(GetSP()); + + size_t current_index = 0; for (std::pair<size_t, bool> idx : idxs) { root = root->GetChildAtIndex(idx.first, idx.second); if (!root) { if (index_of_error) - *index_of_error = idx.first; + *index_of_error = current_index; return root; } + + current_index += 1; } return root; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits