[Lldb-commits] [lldb] [lldb] Return index of element in ValueObject path instead of the element's value (PR #74413)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 4 21:52:20 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Pete Lawrence (PortalPete)
<details>
<summary>Changes</summary>
rdar://119169160
---
Full diff: https://github.com/llvm/llvm-project/pull/74413.diff
1 Files Affected:
- (modified) lldb/source/Core/ValueObject.cpp (+9-2)
``````````diff
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;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/74413
More information about the lldb-commits
mailing list