def get_current_frame_data(self):
"""
Get all date about the current execution frame
:return: current frame data
:rtype: dict
:raises AttributeError: if the debugger does hold any execution frame.
:raises IOError: if source code for the current execution frame is not accessible.
"""
filename = self.curframe.f_code.co_filename
lines, start_line = inspect.findsource(self.curframe)
if sys.version_info[0] == 2:
lines = [line.decode('utf-8') for line in lines]
return {
'filename': os.path.basename(filename),
'listing': ''.join(lines),
'curr_line': self.curframe.f_lineno,
'total_lines': len(lines),
'breaklist': self.get_file_breaks(filename),
}
评论列表
文章目录