diff options
-rw-r--r-- | solenv/lldb/libreoffice/LO.py | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/solenv/lldb/libreoffice/LO.py b/solenv/lldb/libreoffice/LO.py index 594af092e167..352bb3141533 100644 --- a/solenv/lldb/libreoffice/LO.py +++ b/solenv/lldb/libreoffice/LO.py @@ -29,14 +29,10 @@ # script sys.path[:0] = [os.path.expanduser('~/lo/ios/solenv/lldb/libreoffice')] # script import LO -# 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 rtl_uString_summary(valobj, dict): - e = lldb.SBError() - # 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, @@ -49,6 +45,28 @@ def rtl_uString_summary(valobj, dict): buffer_ptr = buffer.AddressOf(); + return sal_unicode_string(buffer_ptr, length) + +def rtl_OUString_summary(valobj, dict): + return rtl_uString_summary(valobj.GetChildMemberWithName('pData'), dict) + +def UniStringData_summary(valobj, dict): + if valobj.TypeIsPointerType(): + return UniStringData_summary(valobj.Dereference(), dict) + + length = valobj.GetChildMemberWithName('mnLen').GetValueAsUnsigned(0) + buffer = valobj.GetChildMemberWithName('maStr') + + buffer_ptr = buffer.AddressOf(); + + return sal_unicode_string(buffer_ptr, length) + +def String_summary(valobj, dict): + return UniStringData_summary(valobj.GetChildMemberWithName('mpData'), dict) + +def sal_unicode_string(buffer_ptr, length): + e = lldb.SBError() + s = '"' i = 0 while i < length: @@ -74,7 +92,11 @@ def rtl_uString_summary(valobj, dict): return s -def rtl_OUString_summary(valobj, dict): - return rtl_uString_summary(valobj.GetChildMemberWithName('pData'), dict) +# Automatically install the above summary functions when this is loaded +def __lldb_init_module(debugger, dict): + debugger.HandleCommand("type summary add --skip-references --python-function LO.rtl_uString_summary rtl_uString") + debugger.HandleCommand("type summary add --skip-pointers --skip-references --python-function LO.rtl_OUString_summary rtl::OUString") + debugger.HandleCommand("type summary add --skip-references --python-function LO.UniStringData_summary UniStringData") + debugger.HandleCommand("type summary add --skip-pointers --skip-references --python-function LO.String_summary String") # vim:set shiftwidth=4 softtabstop=4 expandtab: |