<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Alexander is using libcpp, part of the LLVM project, whereas you are using libstdcpp (a GNU project).<div>They both implement the C++ Standard Library but with different internals!</div><div>Luckily they are easy to differentiate because libcpp classes lived in a std::__1 namespace<br><div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="orphans: 2; text-align: -webkit-auto; text-indent: 0px; widows: 2; -webkit-text-decorations-in-effect: none; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; color: rgb(0, 0, 0); "><i>Enrico Granata</i></div><div style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">✉ egranata@<font class="Apple-style-span" color="#ff230e"></font>.com</div><div>✆ (408) 972-7683</div></div></span></div></span></div></span></span>
</div>
<br><div><div>On Aug 6, 2012, at 11:52 AM, Nino Kettlitz <<a href="mailto:nino.kettlitz@googlemail.com">nino.kettlitz@googlemail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
<div bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Alexander,<br>
<br>
your string implementation looks very complicated.<br>
<br>
Also the type of the string looks strange. I would expect that
"std::wstring" is a typedef<br>
for "std::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t>"<br>
<br>
You are using "std::__1::wstring" and the real type also contains
this "__1" stuff<br>
"std::__1::basic_string<wchar_t,
std::__1::char_traits<wchar_t>,
std::__1::allocator<wchar_t>>"<br>
and it is additionally wrapped by a std::pair or sth similar. <br>
<br>
I've never seen this before. Maybe somebody else in the mailing
list did?!<br>
<br>
So the wstring.py data formater works only for std::wstring with a
"_M_dataplus" and a "_M_p" member<br>
<br>
Cheers,<br>
Nino<br>
<br>
<br>
<br>
<br>
Am 06.08.2012 19:47, schrieb Alexander Angriawan:<br>
</div>
<blockquote cite="mid:BAY002-W149A8AC267B6A68FD2E500DA5CF0@phx.gbl" type="cite">
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<div dir="ltr">I am using Mac OS X Version 10.7.4
<div><span style="font-size: 12pt; ">The following is the lldb
output:</span></div>
<div><p class="p1"><span class="s1"><b>(lldb) </b></span><b>frame
variable x</b></p><p class="p1">(std::__1::wstring) x = {</p><p class="p1"> __r_ = {</p><p class="p1">
std::__1::__libcpp_compressed_pair_imp<std::__1::basic_string<wchar_t,
std::__1::char_traits<wchar_t>,
std::__1::allocator<wchar_t> >::__rep,
std::__1::allocator<wchar_t> > = {</p><p class="p1"> __first_ = {</p><p class="p1"> = {</p><p class="p1"> __l = {</p><p class="p1"> __cap_ = 17</p><p class="p1"> __size_ = 12</p><p class="p1"> __data_ = 0x00000001001009c0</p><p class="p1"> }</p><p class="p1"> __s = {</p><p class="p1"> = {</p><p class="p1"> __size_ = '\x11'</p><p class="p1"> _ = \x11\0\0\0</p><p class="p1"> }</p><p class="p1"> __data_ = {</p><p class="p1"> [0] = \0\0\0\0</p><p class="p1"> [1] = \f\0\0\0</p><p class="p1"> [2] = \0\0\0\0</p><p class="p1"> [3] = \xc0\t\x10\0</p><p class="p1"> [4] = \x01\0\0\0</p><p class="p1"> }</p><p class="p1"> }</p><p class="p1"> __r = {</p><p class="p1"> __words = {</p><p class="p1"> [0] = 17</p><p class="p1"> [1] = 12</p><p class="p1"> [2] = 4296018368</p><p class="p1"> }</p><p class="p1"> }</p><p class="p1"> }</p><p class="p1"> }</p><p class="p1"> }</p><p class="p1"> }</p><p class="p1">}</p><p class="p2"><b>(lldb) </b></p>
</div>
<div><br>
</div>
<div>Thanks,</div>
<div>PA</div>
<div><br>
<div>
<hr id="stopSpelling">Date: Mon, 6 Aug 2012 11:24:48 +0200<br>
From: <a class="moz-txt-link-abbreviated" href="mailto:nino.kettlitz@googlemail.com">nino.kettlitz@googlemail.com</a><br>
To: <a class="moz-txt-link-abbreviated" href="mailto:angriawan@hotmail.com">angriawan@hotmail.com</a><br>
Subject: Re: [lldb-dev] Formatter for
std::shared_ptr<std::wstring><br>
<br>
<div class="ecxmoz-cite-prefix">Hmm, thats strange.<br>
<br>
I'm currently using not the latest lldb, so maybe
something changed.<br>
<br>
What platform are you developing on? The script is written
for osx.<br>
<br>
Maybe you can just send me the output of "frame variable
x" without having the script installed. Maybe the
structure of your strings differ.<br>
<br>
<br>
N. <br>
<br>
Am 06.08.12 10:54, schrieb Alexander Angriawan:<br>
</div>
<blockquote cite="mid:BAY002-W941E7A98D9C35E7266970BA5CF0@phx.gbl">
<style><!--
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:12pt;font-family:Calibri;}
--></style>
<div dir="ltr"><font face="Calibri" size="3">Thank you
Nino.</font>
<div><font face="Calibri"><br>
</font>
<div style="font-family:Calibri;font-size:12pt"><span style="font-size:12pt">Unfortunately the script
doesn't work in my environment.</span></div>
<div style="font-family:Calibri;font-size:12pt"><span style="font-size:12pt">GetByteSize() always return
0 in my case.</span></div>
<div style="font-family:Calibri;font-size:12pt"><span style="font-size:12pt"><br>
</span></div>
<div style="font-family:Calibri;font-size:12pt"><span style="font-size:12pt">....</span></div>
<div>
<div><font face="Calibri"> </font><span style="font-family:Calibri"> if
_M_p_data.GetByteSize() == 1:</span></div>
<div><font face="Calibri"> _M_p_deref
= _M_p_data.GetUnsignedInt8(e, 0) # utf-8</font></div>
<div><font face="Calibri"> elif
_M_p_data.GetByteSize() == 2:</font></div>
<div><font face="Calibri"> _M_p_deref
= _M_p_data.GetUnsignedInt16(e, 0) # utf-16</font></div>
<div><font face="Calibri"> elif
_M_p_data.GetByteSize() == 4:</font></div>
<div><font face="Calibri"> _M_p_deref
= _M_p_data.GetSignedInt32(e, 0) # utf-32</font></div>
<div><font face="Calibri"> else:</font></div>
<div><font face="Calibri"> </font><span style="font-family:Calibri">
_M_p_deref = -1</span></div>
<div><font face="Calibri"> </font></div>
<div><font face="Calibri"> if _M_p_deref
<= 0:</font></div>
<div><font face="Calibri"> <span class="ecxApple-tab-span" style="white-space:pre"> </span>break</font></div>
</div>
<div style="font-family:Calibri;font-size:12pt">----</div>
<div style="font-family:Calibri;font-size:12pt"><br>
</div>
<div style="font-family:Calibri;font-size:12pt">My
simple test code:</div>
<div style="font-family:Calibri;font-size:12pt"><br>
</div>
<div style="font-family:Calibri;font-size:12pt"><p class="ecxp1"><span class="ecxs1">int</span>
main(<span class="ecxs1">int</span> argc, <span class="ecxs1">const</span> <span class="ecxs1">char</span>
* argv[])</p><p class="ecxp1">{</p><p class="ecxp2"><span class="ecxs2"> </span><span class="ecxs2" style="font-size:12pt"> </span><span class="ecxs3" style="font-size:12pt">std</span><span class="ecxs2" style="font-size:12pt">::</span><span class="ecxs3" style="font-size:12pt">wstring</span><span class="ecxs2" style="font-size:12pt"> x = L</span><span style="font-size:12pt">"fooo"</span><span class="ecxs2" style="font-size:12pt">;</span></p><p class="ecxp4"><span class="ecxs2"></span>
return<span class="ecxs2"> </span><span class="ecxs4">0</span><span class="ecxs2">;</span></p><p class="ecxp1">}</p>
</div>
<div style="font-family:Calibri;font-size:12pt"><br>
</div>
<div style="font-family:Calibri;font-size:12pt">---</div>
<div style="font-family:Calibri;font-size:12pt">JA</div>
<div style="font-family:Calibri;font-size:12pt"><br>
</div>
<div style="font-family:Calibri;font-size:12pt"><br>
</div>
<div style="font-family:Calibri;font-size:12pt"><br>
</div>
<div style="font-family:Calibri;font-size:12pt"><br>
</div>
<div style="font-family:Calibri;font-size:12pt"><br>
<div>
<hr id="ecxstopSpelling">Date: Mon, 6 Aug 2012
09:54:09 +0200<br>
From: <a moz-do-not-send="true" class="ecxmoz-txt-link-abbreviated" href="mailto:nino.kettlitz@googlemail.com">nino.kettlitz@googlemail.com</a><br>
To: <a moz-do-not-send="true" class="ecxmoz-txt-link-abbreviated" href="mailto:angriawan@hotmail.com">angriawan@hotmail.com</a><br>
CC: <a moz-do-not-send="true" class="ecxmoz-txt-link-abbreviated" href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>
Subject: Re: [lldb-dev] Formatter for
std::shared_ptr<std::wstring><br>
<br>
<div class="ecxmoz-cite-prefix">Oh,<br>
<br>
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.<br>
<br>
Yust copy the script to your hom directory and
ad the folowing line to your .lldbinit<br>
<br>
script sys.path[:0] = [os.path.expanduser('~')]<br>
command alias pwd script print os.getcwd()<br>
script import wstring<br>
type summary add --python-function
wstring.wstring_summary "std::wstring"<br>
type summary add --python-function
wstring.wstring_summary
"std::basic_string<int, class
std::char_traits<int>, class
std::allocator<int> >"<br>
type summary add --python-function
wstring.wstring_summary
"std::basic_string<unsigned short, class
std::char_traits<unsigned short>, class
std::allocator<unsigned short> >"<br>
type summary add --python-function
wstring.wstring_summary
"std::basic_string<wchar_t, class
std::char_traits<wchar_t>, class
std::allocator<wchar_t> >"<br>
<br>
<br>
Cheers, Nino<br>
<br>
Am 06.08.12 09:19, schrieb Alexander Angriawan:<br>
</div>
<blockquote cite="mid:BAY002-W210E45CFDD8359D8DB9B50CA5CF0@phx.gbl">
<style><!--
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:12pt;font-family:Calibri;}
--></style>
<div dir="ltr">
<div><font face="Calibri">Hello,</font></div>
<div><font face="Calibri"><br>
</font></div>
<div><font face="Calibri">I am looking to
write data formatter for
std::shared_ptr<std::wstring>.</font></div>
<div><font face="Calibri"><br>
</font></div>
<div><font face="Calibri">I found the
following old article but this doesn't
seem to work.</font></div>
<div><font face="Calibri">I have ver 159
installed.</font></div>
<font face="Calibri"><a moz-do-not-send="true" class="ecxmoz-txt-link-freetext" href="http://lists.cs.uiuc.edu/pipermail/lldb-dev/2012-February/000825.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/lldb-dev/2012-February/000825.html</a></font>
<div><font face="Calibri"><br>
</font></div>
<div><font face="Calibri">Any idea?</font></div>
<div><br>
</div>
<div><font face="Calibri">Thank you much,</font></div>
<div><font face="Calibri">PA</font></div>
</div>
<br>
<fieldset class="ecxmimeAttachmentHeader"></fieldset>
<br>
<pre>_______________________________________________
lldb-dev mailing list
<a moz-do-not-send="true" class="ecxmoz-txt-link-abbreviated" href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a>
<a moz-do-not-send="true" class="ecxmoz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
<br>
</div>
_______________________________________________<br>lldb-dev mailing list<br><a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev<br></blockquote></div><br></div></div></body></html>