Commit 5982961
committed
[lldb] Retcon SBValue::GetChildAtIndex(synthetic=true)
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.1 parent 8499904 commit 5982961
File tree
4 files changed
+61
-30
lines changed- lldb
- include/lldb/API
- source/API
- test/API/python_api/sbvalue_synthetic
4 files changed
+61
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
176 | 178 | | |
177 | 179 | | |
178 | 180 | | |
179 | 181 | | |
180 | 182 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | 183 | | |
189 | 184 | | |
190 | 185 | | |
| |||
193 | 188 | | |
194 | 189 | | |
195 | 190 | | |
196 | | - | |
| 191 | + | |
197 | 192 | | |
198 | 193 | | |
199 | 194 | | |
| |||
202 | 197 | | |
203 | 198 | | |
204 | 199 | | |
205 | | - | |
| 200 | + | |
206 | 201 | | |
207 | 202 | | |
208 | 203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
680 | 680 | | |
681 | 681 | | |
682 | 682 | | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
| 683 | + | |
| 684 | + | |
688 | 685 | | |
689 | 686 | | |
| 687 | + | |
| 688 | + | |
690 | 689 | | |
691 | 690 | | |
692 | | - | |
693 | | - | |
| 691 | + | |
694 | 692 | | |
695 | | - | |
| 693 | + | |
| 694 | + | |
696 | 695 | | |
697 | 696 | | |
698 | 697 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
9 | 14 | | |
10 | 15 | | |
11 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
12 | 21 | | |
13 | 22 | | |
0 commit comments