<html>
<head>
</head>
<body class='hmmessage'><div dir='ltr'>

<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<div dir="ltr">Hi,<br> <br>I got it working.  <br>I follow example from the following to navigate and Nino's script to read the char.<br><a href="http://llvm.org/svn/llvm-project/lldb/trunk/examples/synthetic/libcxx.py">http://llvm.org/svn/llvm-project/lldb/trunk/examples/synthetic/libcxx.py</a></div><div dir="ltr"><br></div><div dir="ltr">I can post the script if needed.</div><div dir="ltr"><br></div><div dir="ltr">thanks,</div><div dir="ltr">PA<br><br> <br><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">Subject: Re: [lldb-dev] Formatter for std::shared_ptr<std::wstring><br>From: egranata@apple.com<br>Date: Mon, 6 Aug 2012 11:54:51 -0700<br>CC: angriawan@hotmail.com; lldb-dev@cs.uiuc.edu<br>To: nino.kettlitz@googlemail.com<br><br>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 style="color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; border-collapse: separate; orphans: 2; widows: 2;" class="ecxApple-style-span"><span style="color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; border-collapse: separate; orphans: 2; widows: 2;" class="ecxApple-style-span"><div style="word-wrap: break-word;"><span style="color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; border-collapse: separate; orphans: 2; widows: 2;" class="ecxApple-style-span"><div style="word-wrap: break-word;"><span style="text-indent: 0px; orphans: 2; widows: 2;" class="ecxApple-style-span"><div style="word-wrap: break-word;"><div style="color: rgb(0, 0, 0); text-transform: none; letter-spacing: normal; word-spacing: 0px; white-space: normal; border-collapse: separate;"><i>Enrico Granata</i></div><div style="text-transform: none; letter-spacing: normal; word-spacing: 0px; white-space: normal; border-collapse: separate;"><img class="Emoji$02709$1527 RenderedEmoji" title="Envelope" alt="Envelope" src="https://gfx6.hotmail.com/mail/w5/m4/ltr/emoji/emoji_02709.png"> egranata@<font class="ecxApple-style-span" color="#ff230e"></font>.com</div><div>✆ <span style="white-space: nowrap;" class="baec5a81-e4d6-4674-97f3-e9220f0136c1">(408) 972-7683<a style="margin: 0px; border: currentColor; left: 0px; top: 0px; width: 16px; height: 16px; right: 0px; bottom: 0px; overflow: hidden; vertical-align: middle; float: none; display: inline; white-space: nowrap; position: static !important;" title="Call: (408) 972-7683" href="#"><img style="margin: 0px; border: currentColor; left: 0px; top: 0px; width: 16px; height: 16px; right: 0px; bottom: 0px; overflow: hidden; vertical-align: middle; float: none; display: inline; white-space: nowrap; position: static !important;" title="Call: (408) 972-7683" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAKLSURBVHjadJPfS5NhFMe/21xvuhXRyJAZroiSrJnbRdT7vrAf5HBaK5RABmEEwQIvkpZ/QRcWXdSFw5soKaF0F7qZeLO13mGBDpQsf5CoxVKHOt0Pctp2uvEdrzG/V+c553w/54HnPDIiQiGpPMETABoB2AAYd9MRAMMAvGmX+RcAyAoBVJ7gZQDtABworH4AHWmX+bOMZdkjCoXiUzabvcAwzPSsob5p/VTNY9GcdpnxdmYZ9wJThSCtCr1e/4XjuNPd3d1KjUZzaGbI27ysqzGQoggAsLa1A7ehArrDxfDNr0oBlQB+wmKxbJFEL968SxoamsjkHaPU9l9piUo6A0RE1DG2QCWdASrpDAzJM5kMI8XecdjVxfEl+K9dxFgsgUvvR6HyBKHyBAEATyKLeGSsENuNcqk5kUjEGm7fzcYqr0ClVODl99+YXEvl6+c1amjVe+ahiGGYaUEQKnmeh91uL43rqheixjpdmzCL11er0PcjhrTLvMfUJsyKYUSeyWQ6enp6tgCgrKxsfbP8bB8AdE1G89cOReMAgOv+Cag8QXRNRkXAsDwcDr+am5tLCYKA3t7eo2dG+1vVK/MfpRPtA+MIReMYaKj+/xm9MiICx3EmpVL5wefzFavValis1u1vvHMkdfykCQC0kSGUTo+Ajmnx1dSC7IGD+UUCEYGIwLKsyWazrSeTSSIiMpnNf7Ttz5+ec96fr7/VnE0mk+QfHMzV3WjcKH/4rEr05QGFIA6HY4llWRLPRER+v3/HYrFMFQSIkNra2tVQKJSlfcSyLO0LECFWq3XF6XRGA4HAptTsdrsXeZ6fEHtl+31nAOA4rkUulz/I5XL63dQGgHEAN8Ph8AYA/BsAt4ube4GblQIAAAAASUVORK5CYII="></a></span></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="ecxApple-interchange-newline"><blockquote>
  
    
  
  <div>
    <div class="ecxmoz-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">
      <style><!--
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{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="ecxp1"><span class="ecxs1"><b>(lldb) </b></span><b>frame
              variable x</b></p><p class="ecxp1">(std::__1::wstring) x = {</p><p class="ecxp1">  __r_ = {</p><p class="ecxp1">   
            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="ecxp1">      __first_ = {</p><p class="ecxp1">         = {</p><p class="ecxp1">          __l = {</p><p class="ecxp1">            __cap_ = 17</p><p class="ecxp1">            __size_ = 12</p><p class="ecxp1">            __data_ = 0x00000001001009c0</p><p class="ecxp1">          }</p><p class="ecxp1">          __s = {</p><p class="ecxp1">             = {</p><p class="ecxp1">              __size_ = '\x11'</p><p class="ecxp1">              _ = \x11\0\0\0</p><p class="ecxp1">            }</p><p class="ecxp1">            __data_ = {</p><p class="ecxp1">              [0] = \0\0\0\0</p><p class="ecxp1">              [1] = \f\0\0\0</p><p class="ecxp1">              [2] = \0\0\0\0</p><p class="ecxp1">              [3] = \xc0\t\x10\0</p><p class="ecxp1">              [4] = \x01\0\0\0</p><p class="ecxp1">            }</p><p class="ecxp1">          }</p><p class="ecxp1">          __r = {</p><p class="ecxp1">            __words = {</p><p class="ecxp1">              [0] = 17</p><p class="ecxp1">              [1] = 12</p><p class="ecxp1">              [2] = 4296018368</p><p class="ecxp1">            }</p><p class="ecxp1">          }</p><p class="ecxp1">        }</p><p class="ecxp1">      }</p><p class="ecxp1">    }</p><p class="ecxp1">  }</p><p class="ecxp1">}</p><p class="ecxp2"><b>(lldb) </b></p>
        </div>
        <div><br>
        </div>
        <div>Thanks,</div>
        <div>PA</div>
        <div><br>
          <div>
            <hr id="ecxstopSpelling">Date: Mon, 6 Aug 2012 11:24:48 +0200<br>
            From: <a class="ecxmoz-txt-link-abbreviated" href="mailto:nino.kettlitz@googlemail.com">nino.kettlitz@googlemail.com</a><br>
            To: <a class="ecxmoz-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 size="3" face="Calibri">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 style="white-space: pre;" class="ecxApple-tab-span"> </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 style="font-size: 12pt;" class="ecxs2">   </span><span style="font-size: 12pt;" class="ecxs3">std</span><span style="font-size: 12pt;" class="ecxs2">::</span><span style="font-size: 12pt;" class="ecxs3">wstring</span><span style="font-size: 12pt;" class="ecxs2"> x = L</span><span style="font-size: 12pt;">"fooo"</span><span style="font-size: 12pt;" class="ecxs2">;</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 class="ecxmoz-txt-link-abbreviated" href="mailto:nino.kettlitz@googlemail.com">nino.kettlitz@googlemail.com</a><br>
                      To: <a class="ecxmoz-txt-link-abbreviated" href="mailto:angriawan@hotmail.com">angriawan@hotmail.com</a><br>
                      CC: <a 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 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 class="ecxmoz-txt-link-abbreviated" href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a>
<a 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></div></div>
                                          </div></body>
</html>