Hi Nino,
just a quick note to keep you in the loop.
After a few minor changes, this is the version of the std::wstring data formatter that we will be testing with for inclusion in the LLDB ToT.
Let me know if you have any suggestions for improvements/changes :-)

Enrico Granata
✉ egranata@.com
✆ (408) 972-7683
import lldb

def wstring_SummaryProvider(valobj, dict):
	e = lldb.SBError()
	_M_dataplus = valobj.GetChildMemberWithName ("_M_dataplus")
	_M_p = _M_dataplus.GetChildMemberWithName ("_M_p")
	s = u'"'
	if _M_p != 0:
		i = 0;
		while i < _string_summary_size:
			data_val = _M_p.GetPointeeData(i,1)
			if i == 0:
				size = data_val.GetByteSize()
				if size != 1 and size != 2 and size != 4:
					break
			if size == 1:
				newchar = data_val.GetUnsignedInt8(e, 0)    # utf-8
			elif size == 2:
				newchar = data_val.GetUnsignedInt16(e, 0)   # utf-16
			else:
				newchar = data_val.GetSignedInt32(e, 0)     # utf-32
			if e.fail:
				return '<error>'
			if newchar <= 0:
				break
			i = i + 1
			s = s + unichr(newchar);
	s = s + u'"'
	return s.encode('utf-8')

_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to