[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 4 commits - solenv/inc
Herbert Dürr
hdu at apache.org
Wed Feb 20 17:05:21 PST 2013
solenv/inc/lldb4aoo.py | 78 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
New commits:
commit 76d674c4aea0a40a3c46453e653055859a6a7ba9
Author: Herbert Dürr <hdu at apache.org>
Date: Wed Feb 20 15:35:52 2013 +0000
lldb4aoo: consolidate AOO string data/object/nullptr handling
diff --git a/solenv/inc/lldb4aoo.py b/solenv/inc/lldb4aoo.py
index 2319c16..6172207 100644
--- a/solenv/inc/lldb4aoo.py
+++ b/solenv/inc/lldb4aoo.py
@@ -1,5 +1,5 @@
-# to activate run the command below when inside lldb
-# command script import /tools/lldb4aoo.py
+# to activate LLDB helper script run the command below when inside LLDB
+# command script import /tools/lldb4aoo.py
# or add the line to ~/.lldbinit to always activate it
def __lldb_init_module( dbg, dict):
@@ -26,60 +26,53 @@ def __lldb_init_module( dbg, dict):
# definitions for individual LLDB type summary helpers
-def ret_strinfo( refs, length, ary0):
- a = ary0.AddressOf().GetPointeeData( 0, length)
- if ary0.GetByteSize() == 1:
- s = ''.join([chr(x) for x in a.uint8s])
+def ret_strdata_info( v, refvar, lenvar, aryvar):
+ while v.TypeIsPointerType():
+ if v.GetValueAsUnsigned() == 0:
+ return 'NULL-Pointer!'
+ v = v.Dereference()
+ r = v.GetChildMemberWithName( refvar).GetValueAsSigned()
+ l = v.GetChildMemberWithName( lenvar).GetValueAsSigned()
+ c = v.GetChildMemberWithName( aryvar)
+ d = c.AddressOf().GetPointeeData( 0, l)
+ if c.GetByteSize() == 1: # assume UTF-8
+ s = ''.join([chr(x) for x in d.uint8s])
else: # assume UTF-16
- s = (u''.join([unichr(x) for x in a.uint16s])).encode('utf-8')
- return ('{refs=%d, len=%d, str="%s"}' % (refs, length, s.encode('string_escape')))
+ s = (u''.join([unichr(x) for x in d.uint16s])).encode('utf-8')
+ info = ('{refs=%d, len=%d, str="%s"}' % (r, l, s.encode('string_escape')))
+ return info
+
+def ret_strobject_info( v, ptrvar):
+ while v.TypeIsPointerType():
+ if v.GetValueAsUnsigned() == 0:
+ return 'NULL-Pointer!'
+ v = v.Dereference()
+ p = v.GetChildMemberWithName( ptrvar)
+ return p.Dereference()
+
def getinfo_for_rtl_String( valobj, dict):
- while valobj.TypeIsPointerType():
- valobj = valobj.Dereference()
- r = valobj.GetChildMemberWithName('refCount').GetValueAsSigned()
- l = valobj.GetChildMemberWithName('length').GetValueAsSigned()
- a = valobj.GetChildMemberWithName('buffer')
- return ret_strinfo(r,l,a)
+ return ret_strdata_info( valobj, 'refCount', 'length', 'buffer')
def getinfo_for_rtl_uString( valobj, dict):
- while valobj.TypeIsPointerType():
- valobj = valobj.Dereference()
- r = valobj.GetChildMemberWithName('refCount').GetValueAsSigned()
- l = valobj.GetChildMemberWithName('length').GetValueAsSigned()
- a = valobj.GetChildMemberWithName('buffer')
- return ret_strinfo(r,l,a)
+ return ret_strdata_info( valobj, 'refCount', 'length', 'buffer')
def getinfo_for__ByteStringData( valobj, dict):
- while valobj.TypeIsPointerType():
- valobj = valobj.Dereference()
- r = valobj.GetChildMemberWithName('mnRefCount').GetValueAsSigned()
- l = valobj.GetChildMemberWithName('mnLen').GetValueAsSigned()
- a = valobj.GetChildMemberWithName('maStr')
- return ret_strinfo(r,l,a)
+ return ret_strdata_info( valobj, 'mnRefCount', 'mnLen', 'maStr')
def getinfo_for__UniStringData( valobj, dict):
- while valobj.TypeIsPointerType():
- valobj = valobj.Dereference()
- r = valobj.GetChildMemberWithName('mnRefCount').GetValueAsSigned()
- l = valobj.GetChildMemberWithName('mnLen').GetValueAsSigned()
- a = valobj.GetChildMemberWithName('maStr')
- return ret_strinfo(r,l,a)
+ return ret_strdata_info( valobj, 'mnRefCount', 'mnLen', 'maStr')
def getinfo_for_rtl_OString( valobj, dict):
- d = valobj.GetChildMemberWithName('pData')
- return d.Dereference()
+ return ret_strobject_info( valobj, 'pData')
def getinfo_for_rtl_OUString( valobj, dict):
- d = valobj.GetChildMemberWithName('pData')
- return d.Dereference()
+ return ret_strobject_jinfo( valobj, 'pData')
def getinfo_for_ByteString( valobj, dict):
- d = valobj.GetChildMemberWithName('mpData')
- return d.Dereference()
+ return ret_strobject_jinfo( valobj, 'mpData')
def getinfo_for_UniString( valobj, dict):
- d = valobj.GetChildMemberWithName('mpData')
- return d.Dereference()
+ return ret_strobject_info( valobj, 'mpData')
commit 7af1212f664f46af44e97316d549641de9a31522
Author: Herbert Dürr <hdu at apache.org>
Date: Wed Feb 20 14:53:37 2013 +0000
consolidate presentation of AOO-strings in LLDB
diff --git a/solenv/inc/lldb4aoo.py b/solenv/inc/lldb4aoo.py
index b37d99a..2319c16 100644
--- a/solenv/inc/lldb4aoo.py
+++ b/solenv/inc/lldb4aoo.py
@@ -26,42 +26,45 @@ def __lldb_init_module( dbg, dict):
# definitions for individual LLDB type summary helpers
+def ret_strinfo( refs, length, ary0):
+ a = ary0.AddressOf().GetPointeeData( 0, length)
+ if ary0.GetByteSize() == 1:
+ s = ''.join([chr(x) for x in a.uint8s])
+ else: # assume UTF-16
+ s = (u''.join([unichr(x) for x in a.uint16s])).encode('utf-8')
+ return ('{refs=%d, len=%d, str="%s"}' % (refs, length, s.encode('string_escape')))
+
def getinfo_for_rtl_String( valobj, dict):
while valobj.TypeIsPointerType():
valobj = valobj.Dereference()
r = valobj.GetChildMemberWithName('refCount').GetValueAsSigned()
l = valobj.GetChildMemberWithName('length').GetValueAsSigned()
- a = valobj.GetChildMemberWithName('buffer').AddressOf().GetPointeeData(0,l)
- s = ''.join([chr(x) for x in a.uint8s])
- return '{refs=%d, len=%d, str="%s"}'%(r,l,s)
- return info
+ a = valobj.GetChildMemberWithName('buffer')
+ return ret_strinfo(r,l,a)
def getinfo_for_rtl_uString( valobj, dict):
while valobj.TypeIsPointerType():
valobj = valobj.Dereference()
r = valobj.GetChildMemberWithName('refCount').GetValueAsSigned()
l = valobj.GetChildMemberWithName('length').GetValueAsSigned()
- a = valobj.GetChildMemberWithName('buffer').AddressOf().GetPointeeData(0,l)
- s = (u''.join([unichr(x) for x in a.uint16s])).encode('utf-8')
- return '{refs=%d, len=%d, str="%s"}'%(r,l,s)
+ a = valobj.GetChildMemberWithName('buffer')
+ return ret_strinfo(r,l,a)
def getinfo_for__ByteStringData( valobj, dict):
while valobj.TypeIsPointerType():
valobj = valobj.Dereference()
r = valobj.GetChildMemberWithName('mnRefCount').GetValueAsSigned()
l = valobj.GetChildMemberWithName('mnLen').GetValueAsSigned()
- a = valobj.GetChildMemberWithName('maStr').AddressOf().GetPointeeData(0,l)
- s = ''.join([chr(x) for x in a.uint8s])
- return '{refs=%d, len=%d, str="%s"}'%(r,l,s)
+ a = valobj.GetChildMemberWithName('maStr')
+ return ret_strinfo(r,l,a)
def getinfo_for__UniStringData( valobj, dict):
while valobj.TypeIsPointerType():
valobj = valobj.Dereference()
r = valobj.GetChildMemberWithName('mnRefCount').GetValueAsSigned()
l = valobj.GetChildMemberWithName('mnLen').GetValueAsSigned()
- a = valobj.GetChildMemberWithName('maStr').AddressOf().GetPointeeData(0,l)
- s = (u''.join([unichr(x) for x in a.uint16s])).encode('utf-8')
- return '{refs=%d, len=%d, str="%s"}'%(r,l,s)
+ a = valobj.GetChildMemberWithName('maStr')
+ return ret_strinfo(r,l,a)
def getinfo_for_rtl_OString( valobj, dict):
commit a5592360de789371d9a1d8e2e2ecb32ceb9f67ee
Author: Herbert Dürr <hdu at apache.org>
Date: Wed Feb 20 14:31:34 2013 +0000
fix revised function names in lldb4aoo.py
diff --git a/solenv/inc/lldb4aoo.py b/solenv/inc/lldb4aoo.py
index 4a36726..b37d99a 100644
--- a/solenv/inc/lldb4aoo.py
+++ b/solenv/inc/lldb4aoo.py
@@ -45,7 +45,7 @@ def getinfo_for_rtl_uString( valobj, dict):
s = (u''.join([unichr(x) for x in a.uint16s])).encode('utf-8')
return '{refs=%d, len=%d, str="%s"}'%(r,l,s)
-def getinfo_for_rtl__ByteStringData( valobj, dict):
+def getinfo_for__ByteStringData( valobj, dict):
while valobj.TypeIsPointerType():
valobj = valobj.Dereference()
r = valobj.GetChildMemberWithName('mnRefCount').GetValueAsSigned()
@@ -54,7 +54,7 @@ def getinfo_for_rtl__ByteStringData( valobj, dict):
s = ''.join([chr(x) for x in a.uint8s])
return '{refs=%d, len=%d, str="%s"}'%(r,l,s)
-def getinfo_for_rtl__UniStringData( valobj, dict):
+def getinfo_for__UniStringData( valobj, dict):
while valobj.TypeIsPointerType():
valobj = valobj.Dereference()
r = valobj.GetChildMemberWithName('mnRefCount').GetValueAsSigned()
@@ -72,11 +72,11 @@ def getinfo_for_rtl_OUString( valobj, dict):
d = valobj.GetChildMemberWithName('pData')
return d.Dereference()
-def getinfo_for_rtl_ByteString( valobj, dict):
+def getinfo_for_ByteString( valobj, dict):
d = valobj.GetChildMemberWithName('mpData')
return d.Dereference()
-def getinfo_for_rtl_UniString( valobj, dict):
+def getinfo_for_UniString( valobj, dict):
d = valobj.GetChildMemberWithName('mpData')
return d.Dereference()
commit 0baa51eb9889b6ebeb025063461a3d70a9826663
Author: Herbert Dürr <hdu at apache.org>
Date: Wed Feb 20 13:36:06 2013 +0000
add LLDB helper script to allow more enjoyable AOO debugging sessions
diff --git a/solenv/inc/lldb4aoo.py b/solenv/inc/lldb4aoo.py
new file mode 100644
index 0000000..4a36726
--- /dev/null
+++ b/solenv/inc/lldb4aoo.py
@@ -0,0 +1,82 @@
+# to activate run the command below when inside lldb
+# command script import /tools/lldb4aoo.py
+# or add the line to ~/.lldbinit to always activate it
+
+def __lldb_init_module( dbg, dict):
+ # the list of AOO specific types
+ aoo_types = ['rtl_String', 'rtl::OString', 'rtl_uString', 'rtl::OUString',
+ '_ByteStringData', '_UniStringData', 'ByteString', 'UniString']
+ # register a helper function for each type
+ for t in aoo_types:
+ f = 'getinfo_for_' + t.replace( '::', '_')
+ if f in globals():
+ dbg.HandleCommand( 'type summary add %s -F %s.%s' % (t,__name__,f))
+ else:
+ print( 'AOO-LLDB helper function "%s" is not yet defined: "%s" types cannot be displayed properly!' % (f,t))
+
+ # perform some goodies if the process is ready to run or already running
+ if dbg.GetNumTargets() > 0:
+ # the list of interesting function breakpoints
+ aoo_breakfn = ['main', '__cxa_call_unexpected', 'objc_exception_throw']
+ aoo_breakfn += ['__cxa_throw']
+ # register the function breakpoints
+ for t in aoo_breakfn:
+ dbg.HandleCommand( 'breakpoint set -n ' + t)
+
+
+# definitions for individual LLDB type summary helpers
+
+def getinfo_for_rtl_String( valobj, dict):
+ while valobj.TypeIsPointerType():
+ valobj = valobj.Dereference()
+ r = valobj.GetChildMemberWithName('refCount').GetValueAsSigned()
+ l = valobj.GetChildMemberWithName('length').GetValueAsSigned()
+ a = valobj.GetChildMemberWithName('buffer').AddressOf().GetPointeeData(0,l)
+ s = ''.join([chr(x) for x in a.uint8s])
+ return '{refs=%d, len=%d, str="%s"}'%(r,l,s)
+ return info
+
+def getinfo_for_rtl_uString( valobj, dict):
+ while valobj.TypeIsPointerType():
+ valobj = valobj.Dereference()
+ r = valobj.GetChildMemberWithName('refCount').GetValueAsSigned()
+ l = valobj.GetChildMemberWithName('length').GetValueAsSigned()
+ a = valobj.GetChildMemberWithName('buffer').AddressOf().GetPointeeData(0,l)
+ s = (u''.join([unichr(x) for x in a.uint16s])).encode('utf-8')
+ return '{refs=%d, len=%d, str="%s"}'%(r,l,s)
+
+def getinfo_for_rtl__ByteStringData( valobj, dict):
+ while valobj.TypeIsPointerType():
+ valobj = valobj.Dereference()
+ r = valobj.GetChildMemberWithName('mnRefCount').GetValueAsSigned()
+ l = valobj.GetChildMemberWithName('mnLen').GetValueAsSigned()
+ a = valobj.GetChildMemberWithName('maStr').AddressOf().GetPointeeData(0,l)
+ s = ''.join([chr(x) for x in a.uint8s])
+ return '{refs=%d, len=%d, str="%s"}'%(r,l,s)
+
+def getinfo_for_rtl__UniStringData( valobj, dict):
+ while valobj.TypeIsPointerType():
+ valobj = valobj.Dereference()
+ r = valobj.GetChildMemberWithName('mnRefCount').GetValueAsSigned()
+ l = valobj.GetChildMemberWithName('mnLen').GetValueAsSigned()
+ a = valobj.GetChildMemberWithName('maStr').AddressOf().GetPointeeData(0,l)
+ s = (u''.join([unichr(x) for x in a.uint16s])).encode('utf-8')
+ return '{refs=%d, len=%d, str="%s"}'%(r,l,s)
+
+
+def getinfo_for_rtl_OString( valobj, dict):
+ d = valobj.GetChildMemberWithName('pData')
+ return d.Dereference()
+
+def getinfo_for_rtl_OUString( valobj, dict):
+ d = valobj.GetChildMemberWithName('pData')
+ return d.Dereference()
+
+def getinfo_for_rtl_ByteString( valobj, dict):
+ d = valobj.GetChildMemberWithName('mpData')
+ return d.Dereference()
+
+def getinfo_for_rtl_UniString( valobj, dict):
+ d = valobj.GetChildMemberWithName('mpData')
+ return d.Dereference()
+
More information about the Libreoffice-commits
mailing list