Oh,
I've seen, that the script attached to the mail is not on the server, so
I attached it again, although it would be better to have it in the lldb svn.
Yust copy the script to your hom directory and ad the folowing line to
your .lldbinit
script sys.path[:0] = [os.path.expanduser('~')]
command alias pwd script print os.getcwd()
script import wstring
type summary add --python-function wstring.wstring_summary "std::wstring"
type summary add --python-function wstring.wstring_summary
"std::basic_string<int, class std::char_traits<int>, class
std::allocator<int> >"
type summary add --python-function wstring.wstring_summary
"std::basic_string<unsigned short, class std::char_traits<unsigned
short>, class std::allocator<unsigned short> >"
type summary add --python-function wstring.wstring_summary
"std::basic_string<wchar_t, class std::char_traits<wchar_t>, class
std::allocator<wchar_t> >"
Cheers, Nino
Am 06.08.12 09:19, schrieb Alexander Angriawan:
Hello,
I am looking to write data formatter for std::shared_ptr<std::wstring>.
I found the following old article but this doesn't seem to work.
I have ver 159 installed.
http://lists.cs.uiuc.edu/pipermail/lldb-dev/2012-February/000825.html
Any idea?
Thank you much,
PA
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
import lldb
def wstring_summary (val, dict):
e = lldb.SBError()
_M_dataplus = val.GetChildMemberWithName ("_M_dataplus")
_M_p = _M_dataplus.GetChildMemberWithName ("_M_p")
#
s = u'"'
#
if _M_p != 0:
i = 0;
while True:
_M_p_data = _M_p.GetPointeeData(i,1)
#
if _M_p_data.GetByteSize() == 1:
_M_p_deref = _M_p_data.GetUnsignedInt8(e, 0) # utf-8
elif _M_p_data.GetByteSize() == 2:
_M_p_deref = _M_p_data.GetUnsignedInt16(e, 0) # utf-16
elif _M_p_data.GetByteSize() == 4:
_M_p_deref = _M_p_data.GetSignedInt32(e, 0) # utf-32
else:
_M_p_deref = -1
#
if _M_p_deref <= 0:
break
#
s = s + unichr(_M_p_deref);
i = i + 1;
s = s + '"'
return s.encode('utf-8')
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev