lldbinit.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:MacHeap 作者: blankwall 项目源码 文件源码
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 '')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号