dbg.py 文件源码

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

项目:rekall-agent-server 作者: rekall-innovations 项目源码 文件源码
def do_environment(self):
        "return current frame local and global environment"
        env = {'locals': {}, 'globals': {}}
        # converts the frame global and locals to a short text representation:
        if self.frame:
            for scope, max_length, vars in (
                    ("locals", 255, list(self.frame_locals.items())),
                    ("globals", 20, list(self.frame.f_globals.items())), ):
                for (name, value) in vars:
                    try:
                        short_repr = pydoc.cram(repr(value), max_length)                    
                    except Exception as e:
                        # some objects cannot be represented...
                        short_repr = "**exception** %s" % repr(e)
                    env[scope][name] = (short_repr, repr(type(value)))
        return env
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号