File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -694,6 +694,13 @@ def get_child_index(self, name):
694
694
except :
695
695
return - 1
696
696
697
+ @staticmethod
698
+ def _subscript (ptr : lldb .SBValue , idx : int , name : str ) -> lldb .SBValue :
699
+ """Access a pointer value as if it was an array. Returns ptr[idx]."""
700
+ deref_t = ptr .GetType ().GetPointeeType ()
701
+ offset = idx * deref_t .GetByteSize ()
702
+ return ptr .CreateChildAtOffset (name , offset , deref_t )
703
+
697
704
def get_child_at_index (self , index ):
698
705
logger = lldb .formatters .Logger .Logger ()
699
706
logger .write ("Fetching child " + str (index ))
@@ -703,11 +710,8 @@ def get_child_at_index(self, index):
703
710
return None
704
711
try :
705
712
i , j = divmod (self .start + index , self .block_size )
706
-
707
- return self .first .CreateValueFromExpression (
708
- "[" + str (index ) + "]" ,
709
- "*(*(%s + %d) + %d)" % (self .map_begin .get_expr_path (), i , j ),
710
- )
713
+ val = stddeque_SynthProvider ._subscript (self .map_begin , i , "" )
714
+ return stddeque_SynthProvider ._subscript (val , j , f"[{ index } ]" )
711
715
except :
712
716
return None
713
717
You can’t perform that action at this time.
0 commit comments