def get_opcode(self):
# Based on the settings decide to show the line-by-line trace
# Get the current line being executed
current_lineno = self.__exec_frame.line_no_obj.line_number(self.__exec_frame.ip)
ip = self.__exec_frame.ip
# Update the line number only if the currently executing line has changed.
if self.__exec_frame.line_no_obj.currently_executing_line is None or \
self.__exec_frame.line_no_obj.currently_executing_line != current_lineno:
self.__exec_frame.line_no_obj.currently_executing_line = current_lineno
self.__exec_frame.line_no_obj.currently_executing_line = current_lineno
if self.__config.show_line_execution:
current_line = self.__exec_frame.line_no_obj.get_source_line(current_lineno)
print("Execution Line: %s" % current_line)
op = self.__exec_frame.program[self.__exec_frame.ip]
ip += 1
opmethod = "execute_%s" % dis.opname[op]
oparg = None
if op >= dis.HAVE_ARGUMENT:
low = self.__exec_frame.program[ip]
high = self.__exec_frame.program[ip + 1]
oparg = (high << 8) | low
return opmethod, oparg, current_lineno
评论列表
文章目录