summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-09-26 17:53:21 +0200
committerMichael Stahl <mstahl@redhat.com>2016-09-26 17:55:58 +0200
commit79afde9b14e65c7c074617e63a094d911d0bc78f (patch)
tree8fcb65fe1e8e68766d1b6300e0db74609d1d3275 /solenv
parent097f2e8cd15b9e7b4e96aecf1964c4764b52d595 (diff)
LLDB pretty print rtl_String / OString too
Change-Id: Iaf77d03d8116273054ae3efca88f44fd926bf211
Diffstat (limited to 'solenv')
-rw-r--r--solenv/lldb/libreoffice/LO.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/solenv/lldb/libreoffice/LO.py b/solenv/lldb/libreoffice/LO.py
index 10d368f85d57..397d115380c2 100644
--- a/solenv/lldb/libreoffice/LO.py
+++ b/solenv/lldb/libreoffice/LO.py
@@ -12,6 +12,44 @@
import lldb
+def rtl_String_summary(valobj, dict):
+ if valobj.TypeIsPointerType():
+ return rtl_String_summary(valobj.Dereference(), dict)
+
+ length = valobj.GetChildMemberWithName('length').GetValueAsUnsigned(0)
+ buffer = valobj.GetChildMemberWithName('buffer')
+ buffer_ptr = buffer.AddressOf();
+
+# return '"' + buffer_ptr.GetPointeeData(0, length).GetString(lldb.SBError(), 0) + '"'
+ return sal_ascii_string(buffer_ptr, length)
+
+def rtl_OString_summary(valobj, dict):
+ return rtl_String_summary(valobj.GetChildMemberWithName('pData'), dict)
+
+def sal_ascii_string(buffer_ptr, length):
+ e = lldb.SBError()
+
+ s = '"'
+ i = 0
+ while i < length:
+ c = buffer_ptr.GetPointeeData(i, 1).GetUnsignedInt8(e, 0)
+ if c == ord('"'): s = s + '\\"'
+ elif c == ord('\\'): s = s + '\\\\'
+ elif c == ord('\n'): s = s + '\\n'
+ elif c == ord('\r'): s = s + '\\r'
+ elif c == ord('\t'):
+ s = s + '\\t'
+ elif c < ord(' '):
+ s = s + '\\{:03o}'.format(c)
+ elif c < 127:
+ s = s + chr(c)
+ else:
+ s = s + '\\u{:04x}'.format(c)
+ i = i + 1
+ s = s + '"'
+
+ return s
+
def rtl_uString_summary(valobj, dict):
# print "valobj = " + str(valobj) + ", valobj.GetData() = " + str(valobj.GetData()) + ", valobj.GetTypeName() = " + str(valobj.GetTypeName())
@@ -74,6 +112,8 @@ def sal_unicode_string(buffer_ptr, length):
# 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_String_summary rtl_String")
+ debugger.HandleCommand("type summary add --skip-pointers --skip-references --python-function LO.rtl_OString_summary rtl::OString")
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")