return 0;
return 6;
- def read_unicode(self, pointer):
+ def read_unicode(self, pointer,max_len=2048):
logger = lldb.formatters.Logger.Logger()
process = self.valobj.GetTarget().GetProcess()
error = lldb.SBError()
pystr = u''
# cannot do the read at once because the length value has
# a weird encoding. better play it safe here
- while True:
+ while max_len > 0:
content = process.ReadMemory(pointer, 2, error)
new_bytes = bytearray(content)
b0 = new_bytes[0]
else:
value = b0 * 256 + b1
pystr = pystr + unichr(value)
+ # read max_len unicode values, not max_len bytes
+ max_len = max_len - 1
return pystr
# handle the special case strings
data = self.valobj.CreateChildAtOffset("content",
offset, self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar).GetPointerType());
data_value = data.GetValueAsUnsigned(0)
- data_value = data_value + 1
- return self.valobj.CreateValueFromExpression("content", "(char*)(" + str(data_value) + ")")
+ if self.explicit and self.unicode:
+ return self.read_unicode(data_value).encode('utf-8')
+ else:
+ data_value = data_value + 1
+ return self.valobj.CreateValueFromExpression("content", "(char*)(" + str(data_value) + ")")
def handle_UTF8_inline(self):
logger = lldb.formatters.Logger.Logger()
self.expect('frame variable french', substrs = ['Que veut cette horde d\'esclaves, De traîtres, de rois conjurés?'])
self.expect('frame variable german', substrs = ['Über-Ich und aus den Ansprüchen der sozialen Umwelt'])
self.expect('frame variable japanese', substrs = ['色は匂へど散りぬるを'])
+ self.expect('frame variable hebrew', substrs = ['לילה טוב'])
+
def plain_data_formatter_commands(self):
"""Test basic ObjC formatting behavior."""