lldb4aoo.py (a54092f6) | lldb4aoo.py (80e5b736) |
---|---|
1# to activate run the command below when inside lldb 2# command script import /tools/lldb4aoo.py | 1# to activate LLDB helper script run the command below when inside LLDB 2# command script import /tools/lldb4aoo.py |
3# or add the line to ~/.lldbinit to always activate it 4 5def __lldb_init_module( dbg, dict): 6 # the list of AOO specific types 7 aoo_types = ['rtl_String', 'rtl::OString', 'rtl_uString', 'rtl::OUString', 8 '_ByteStringData', '_UniStringData', 'ByteString', 'UniString'] 9 # register a helper function for each type 10 for t in aoo_types: --- 10 unchanged lines hidden (view full) --- 21 aoo_breakfn += ['__cxa_throw'] 22 # register the function breakpoints 23 for t in aoo_breakfn: 24 dbg.HandleCommand( 'breakpoint set -n ' + t) 25 26 27# definitions for individual LLDB type summary helpers 28 | 3# or add the line to ~/.lldbinit to always activate it 4 5def __lldb_init_module( dbg, dict): 6 # the list of AOO specific types 7 aoo_types = ['rtl_String', 'rtl::OString', 'rtl_uString', 'rtl::OUString', 8 '_ByteStringData', '_UniStringData', 'ByteString', 'UniString'] 9 # register a helper function for each type 10 for t in aoo_types: --- 10 unchanged lines hidden (view full) --- 21 aoo_breakfn += ['__cxa_throw'] 22 # register the function breakpoints 23 for t in aoo_breakfn: 24 dbg.HandleCommand( 'breakpoint set -n ' + t) 25 26 27# definitions for individual LLDB type summary helpers 28 |
29def ret_strinfo( refs, length, ary0): 30 a = ary0.AddressOf().GetPointeeData( 0, length) 31 if ary0.GetByteSize() == 1: 32 s = ''.join([chr(x) for x in a.uint8s]) | 29def ret_strdata_info( v, refvar, lenvar, aryvar): 30 while v.TypeIsPointerType(): 31 if v.GetValueAsUnsigned() == 0: 32 return 'NULL-Pointer!' 33 v = v.Dereference() 34 r = v.GetChildMemberWithName( refvar).GetValueAsSigned() 35 l = v.GetChildMemberWithName( lenvar).GetValueAsSigned() 36 c = v.GetChildMemberWithName( aryvar) 37 d = c.AddressOf().GetPointeeData( 0, l) 38 if c.GetByteSize() == 1: # assume UTF-8 39 s = ''.join([chr(x) for x in d.uint8s]) |
33 else: # assume UTF-16 | 40 else: # assume UTF-16 |
34 s = (u''.join([unichr(x) for x in a.uint16s])).encode('utf-8') 35 return ('{refs=%d, len=%d, str="%s"}' % (refs, length, s.encode('string_escape'))) | 41 s = (u''.join([unichr(x) for x in d.uint16s])).encode('utf-8') 42 info = ('{refs=%d, len=%d, str="%s"}' % (r, l, s.encode('string_escape'))) 43 return info |
36 | 44 |
45def ret_strobject_info( v, ptrvar): 46 while v.TypeIsPointerType(): 47 if v.GetValueAsUnsigned() == 0: 48 return 'NULL-Pointer!' 49 v = v.Dereference() 50 p = v.GetChildMemberWithName( ptrvar) 51 return p.Dereference() 52 53 |
|
37def getinfo_for_rtl_String( valobj, dict): | 54def getinfo_for_rtl_String( valobj, dict): |
38 while valobj.TypeIsPointerType(): 39 valobj = valobj.Dereference() 40 r = valobj.GetChildMemberWithName('refCount').GetValueAsSigned() 41 l = valobj.GetChildMemberWithName('length').GetValueAsSigned() 42 a = valobj.GetChildMemberWithName('buffer') 43 return ret_strinfo(r,l,a) | 55 return ret_strdata_info( valobj, 'refCount', 'length', 'buffer') |
44 45def getinfo_for_rtl_uString( valobj, dict): | 56 57def getinfo_for_rtl_uString( valobj, dict): |
46 while valobj.TypeIsPointerType(): 47 valobj = valobj.Dereference() 48 r = valobj.GetChildMemberWithName('refCount').GetValueAsSigned() 49 l = valobj.GetChildMemberWithName('length').GetValueAsSigned() 50 a = valobj.GetChildMemberWithName('buffer') 51 return ret_strinfo(r,l,a) | 58 return ret_strdata_info( valobj, 'refCount', 'length', 'buffer') |
52 53def getinfo_for__ByteStringData( valobj, dict): | 59 60def getinfo_for__ByteStringData( valobj, dict): |
54 while valobj.TypeIsPointerType(): 55 valobj = valobj.Dereference() 56 r = valobj.GetChildMemberWithName('mnRefCount').GetValueAsSigned() 57 l = valobj.GetChildMemberWithName('mnLen').GetValueAsSigned() 58 a = valobj.GetChildMemberWithName('maStr') 59 return ret_strinfo(r,l,a) | 61 return ret_strdata_info( valobj, 'mnRefCount', 'mnLen', 'maStr') |
60 61def getinfo_for__UniStringData( valobj, dict): | 62 63def getinfo_for__UniStringData( valobj, dict): |
62 while valobj.TypeIsPointerType(): 63 valobj = valobj.Dereference() 64 r = valobj.GetChildMemberWithName('mnRefCount').GetValueAsSigned() 65 l = valobj.GetChildMemberWithName('mnLen').GetValueAsSigned() 66 a = valobj.GetChildMemberWithName('maStr') 67 return ret_strinfo(r,l,a) | 64 return ret_strdata_info( valobj, 'mnRefCount', 'mnLen', 'maStr') |
68 69 70def getinfo_for_rtl_OString( valobj, dict): | 65 66 67def getinfo_for_rtl_OString( valobj, dict): |
71 d = valobj.GetChildMemberWithName('pData') 72 return d.Dereference() | 68 return ret_strobject_info( valobj, 'pData') |
73 74def getinfo_for_rtl_OUString( valobj, dict): | 69 70def getinfo_for_rtl_OUString( valobj, dict): |
75 d = valobj.GetChildMemberWithName('pData') 76 return d.Dereference() | 71 return ret_strobject_jinfo( valobj, 'pData') |
77 78def getinfo_for_ByteString( valobj, dict): | 72 73def getinfo_for_ByteString( valobj, dict): |
79 d = valobj.GetChildMemberWithName('mpData') 80 return d.Dereference() | 74 return ret_strobject_jinfo( valobj, 'mpData') |
81 82def getinfo_for_UniString( valobj, dict): | 75 76def getinfo_for_UniString( valobj, dict): |
83 d = valobj.GetChildMemberWithName('mpData') 84 return d.Dereference() | 77 return ret_strobject_info( valobj, 'mpData') |
85 | 78 |