[all-commits] [llvm/llvm-project] 6181f4: [lldb] Retcon SBValue::GetChildAtIndex(synthetic=t...
Pavel Labath via All-commits
all-commits at lists.llvm.org
Mon May 19 22:45:19 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6181f4f89d022ebf33ed8a449655347eb1b9b6c0
https://github.com/llvm/llvm-project/commit/6181f4f89d022ebf33ed8a449655347eb1b9b6c0
Author: Pavel Labath <pavel at labath.sk>
Date: 2025-05-20 (Tue, 20 May 2025)
Changed paths:
M lldb/include/lldb/API/SBValue.h
M lldb/source/API/SBValue.cpp
M lldb/test/API/python_api/sbvalue_synthetic/TestSBValueSynthetic.py
M lldb/test/API/python_api/sbvalue_synthetic/main.cpp
Log Message:
-----------
[lldb] Retcon SBValue::GetChildAtIndex(synthetic=true) (#140065)
The motivation here is being (un)able to treat pointer values as an
array consistently. This works for pointers to simple/scalar values, but
for aggregates, we get a very surprising result:
- GetChildAtIndex(x, ??, true) returns the `x` child of the zeroth array
member (the one you get by dereferencing the pointer/array) for all `x`
which are smaller than the number of children of that value.
- for other values of `x`, we get `v[x]`, where `v` is treated like a
(C) pointer
This patch reimagines this interface so that the value of `true` always
treats (pointer and array) values as pointers. For `false`, we always
dereference pointers, while in the case of arrays, we only return the
values as far as the array bounds will allow.
This has the potential to break existing code, but I have a suspicion
that code was already broken to begin with, which is why I think this
would be better than introducing a new API and keeping the old (and
surprising) behavior. If our own test coverage is any indication,
breakage should be minimal.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list