cmtice 6d3ad9d9fd
[LLDB] Update DIL handling of array subscripting. (#151605)
This updates the DIL code for handling array subscripting to more
closely match and handle all the cases from the original 'frame var'
implementation. Also updates the DIL array subscripting test. This
particularly fixes some issues with handling synthetic children, objc
pointers, and accessing specific bits within scalar data types.
2025-08-15 08:26:45 -07:00

34 lines
928 B
Python

import lldb
class myArraySynthProvider:
def __init__(self, valobj, dict):
self.valobj = valobj
def num_children(self):
size_valobj = self.valobj.GetChildMemberWithName("m_arr_size")
if size_valobj:
return size_valobj.GetValueAsUnsigned(0)
return 0
def get_child_at_index(self, index):
size_valobj = self.valobj.GetChildMemberWithName("m_arr_size")
arr = self.valobj.GetChildMemberWithName("m_array")
if not size_valobj or not arr:
return None
max_idx = size_valobj.GetValueAsUnsigned(0)
if index >= max_idx:
return None
return arr.GetChildAtIndex(index)
def get_child_index(self, name):
if name == "[0]":
return 0
if name == "[1]":
return
if name == "[2]":
return 2
if name == "[3]":
return 3
return -1