diff options
author | Tor Lillqvist <tml@iki.fi> | 2013-01-03 11:06:37 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2013-01-03 20:21:50 +0200 |
commit | 8df455d7b9d3fb4df5f35b49453756133724de81 (patch) | |
tree | 227b81a247f2c2fd26e6c1084baa1c49ad8639cc /solenv/lldb/libreoffice | |
parent | 92dbf9df486c3f77f48756ffae424990158d9963 (diff) |
Make the rtl_uString pretty-printer work better
Change-Id: I4c376f53af0a20203a4c8ea34abbf607ac7e987e
Diffstat (limited to 'solenv/lldb/libreoffice')
-rw-r--r-- | solenv/lldb/libreoffice/LO.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/solenv/lldb/libreoffice/LO.py b/solenv/lldb/libreoffice/LO.py index 8f7c2474d203..594af092e167 100644 --- a/solenv/lldb/libreoffice/LO.py +++ b/solenv/lldb/libreoffice/LO.py @@ -29,21 +29,30 @@ # script sys.path[:0] = [os.path.expanduser('~/lo/ios/solenv/lldb/libreoffice')] # script import LO -# type summary add --python-function LO.rtluString_summary rtl_uString -# type summary add --python-function LO.rtl_OUString_summary rtl::OUString +# type summary add --skip-references --python-function LO.rtl_uString_summary rtl_uString +# type summary add --skip-pointers --skip-references --python-function LO.rtl_OUString_summary rtl::OUString import lldb -def rtluString_summary(rtlustring, dict): +def rtl_uString_summary(valobj, dict): e = lldb.SBError() - length = rtlustring.GetChildMemberWithName('length').GetValueAsUnsigned(0) - buffer = rtlustring.GetChildMemberWithName('buffer') + # print "valobj = " + str(valobj) + ", valobj.GetData() = " + str(valobj.GetData()) + ", valobj.GetTypeName() = " + str(valobj.GetTypeName()) + + # As we don't use --skip-pointers when doing the "type summary add" for this function, + # the value to be printed might actually be a pointer to a rtl_uString. Weird, huh? + if valobj.TypeIsPointerType(): + return rtl_uString_summary(valobj.Dereference(), dict) + + length = valobj.GetChildMemberWithName('length').GetValueAsUnsigned(0) + buffer = valobj.GetChildMemberWithName('buffer') + + buffer_ptr = buffer.AddressOf(); s = '"' i = 0 while i < length: - c = buffer.GetPointeeData(i, 1).GetUnsignedInt16(e, 0) + c = buffer_ptr.GetPointeeData(i, 1).GetUnsignedInt16(e, 0) if c == ord('"'): s = s + '\\"' elif c == ord('\\'): @@ -65,7 +74,7 @@ def rtluString_summary(rtlustring, dict): return s -def rtl_OUString_summary(rtloustring, dict): - return rtluString_summary(rtloustring.GetChildMemberWithName('pData'), dict) +def rtl_OUString_summary(valobj, dict): + return rtl_uString_summary(valobj.GetChildMemberWithName('pData'), dict) # vim:set shiftwidth=4 softtabstop=4 expandtab: |