def repr(cls, s):
TYPE_PREFIX = 'eTypeClass'
start = cls.address(s)
end = start + cls.size(s)
types = {getattr(lldb,n) : n[len(TYPE_PREFIX):] for n in dir(lldb) if n.startswith(TYPE_PREFIX)}
attributes = (n for n in ('external','synthetic') if getattr(s,n))
if s.type in (lldb.eTypeClassFunction,):
attributes = itertools.chain(attributes, ('instructions={:d}'.format(len(s.instructions))))
attributes=filter(None,attributes)
return '{name:s}{opt_mangled:s} type={type:s} 0x{addr:x}{opt_size:s}'.format(name=s.name, type=types.get(s.type,str(s.type)), opt_mangled=(' ('+s.mangled+')') if s.mangled else '', addr=start, opt_size=':+0x{:x}'.format(end-start) if end > start else '') + ((' ' + ' '.join(attributes)) if attributes else '')
评论列表
文章目录