@@ -91,6 +91,35 @@ def get_summary(self):
9191
9292 return f"Min=({ minX } , { minY } ) Max=({ maxX } , { maxY } ) Size=({ maxX - minX } , { maxY - minY } )"
9393
94+ class ImStrvSummary (object ):
95+ def __init__ (self , valobj , internal_dict ):
96+ self .valobj = valobj
97+
98+ def update (self ):
99+ pass
100+
101+ def get_summary (self ):
102+ begin = self .valobj .GetChildMemberWithName ("Begin" ).GetValueAsUnsigned ()
103+ end = self .valobj .GetChildMemberWithName ("End" ).GetValueAsUnsigned ()
104+
105+ if begin == 0 :
106+ return "<null>"
107+
108+ if end < begin :
109+ return "<invalid>"
110+
111+ error = lldb .SBError ()
112+ data = self .valobj .GetProcess ().ReadMemory (begin , end - begin , error )
113+
114+ if not error .Success ():
115+ return "<failed to read memory>"
116+
117+ # Turn the byte sequence into utf-8, escape non-printables
118+ data = data .decode ("utf-8" , errors = "backslashreplace" )
119+ data = repr (data )[1 :- 1 ]
120+
121+ return f'"{ data } "'
122+
94123def get_active_enum_flags (valobj ):
95124 flag_set = set ()
96125
@@ -187,3 +216,4 @@ def add_synthetic(typename, impl):
187216 add_summary ("^ImVec4$" , "x=${var.x} y=${var.y} z=${var.z} w=${var.w}" )
188217 add_summary ("^ImRect$" , ImRectSummary )
189218 add_summary ("^ImGuiWindow$" , ImGuiWindowSummary )
219+ add_summary ("^ImStrv" , ImStrvSummary )
0 commit comments