trepan/processor/command/info_subcmd/pc.py
def run(self, args):
        """Program counter."""
        mainfile = self.core.filename(None)
        if self.core.is_running():
            curframe = self.proc.curframe
            if curframe:
                line_no = inspect.getlineno(curframe)
                offset  = curframe.f_lasti
                self.msg("PC offset is %d." % offset)
                offset = max(offset, 0)
                code = curframe.f_code
                co_code = code.co_code
                disassemble_bytes(self.msg, self.msg_nocr,
                                  co_code, offset, line_no, line_no-1, line_no+1,
                                  constants=code.co_consts, cells=code.co_cellvars,
                                  varnames=code.co_varnames, freevars=code.co_freevars,
                                  linestarts=dict(findlinestarts(code)),
                                  end_offset=offset+10)
                pass
            pass
        else:
            if mainfile:
                part1 = "Python program '%s'" % mainfile
                msg   = "is not currently running. "
                self.msg(Mmisc.wrapped_lines(part1, msg,
                                             self.settings['width']))
            else:
                self.msg('No Python program is currently running.')
                pass
            self.msg(self.core.execution_status)
            pass
        return False
def run(self, args):
        mainfile = self.core.filename(None)
        if self.core.is_running():
            curframe = self.proc.curframe
            if curframe:
                line_no = inspect.getlineno(curframe)
                offset  = curframe.f_lasti
                self.msg("PC offset is %d." % offset)
                offset = max(offset, 0)
                code = curframe.f_code
                co_code = code.co_code
                disassemble_bytes(self.msg, self.msg_nocr,
                                  co_code, offset, line_no, line_no-1, line_no+1,
                                  constants=code.co_consts, cells=code.co_cellvars,
                                  varnames=code.co_varnames, freevars=code.co_freevars,
                                  linestarts=dict(findlinestarts(code)),
                                  end_offset=offset+10)
                pass
            pass
        else:
            if mainfile:
                part1 = "Python program '%s'" % mainfile
                msg   = "is not currently running. "
                self.msg(Mmisc.wrapped_lines(part1, msg,
                                             self.settings['width']))
            else:
                self.msg('No Python program is currently running.')
                pass
            self.msg(self.core.execution_status)
            pass
        return False
def run ( self , args ) : mainfile = self . core . filename ( None ) if self . core . is_running ( ) : curframe = self . proc . curframe if curframe : line_no = inspect . getlineno ( curframe ) offset = curframe . f_lasti self . msg ( "PC offset is %d." % offset ) offset = max ( offset , 0 ) code = curframe . f_code co_code = code . co_code disassemble_bytes ( self . msg , self . msg_nocr , co_code , offset , line_no , line_no - 1 , line_no + 1 , constants = code . co_consts , cells = code . co_cellvars , varnames = code . co_varnames , freevars = code . co_freevars , linestarts = dict ( findlinestarts ( code ) ) , end_offset = offset + 10 ) pass pass else : if mainfile : part1 = "Python program '%s'" % mainfile msg = "is not currently running. " self . msg ( Mmisc . wrapped_lines ( part1 , msg , self . settings [ 'width' ] ) ) else : self . msg ( 'No Python program is currently running.' ) pass self . msg ( self . core . execution_status ) pass return False
Program counter.
Program counter .