예제 #1
0
def main():
    mainpyfile =  sys.argv[1]     # Get script filename
    parentsock = sys.argv[2]
    childsock = sys.argv[3]
    # Replace pdb's dir with script's dir in front of module search path.
    sys.path[0] = os.path.dirname(mainpyfile)
    client = Debugger(parentsock, childsock)
    pdb = Pidadb(client)
    client.pdb = pdb
    client.started()
    while 1:
        try:
            pdb._runscript(mainpyfile)
            if pdb._user_requested_quit:
                break
        except SystemExit:
            pass
            # In most cases SystemExit does not warrant a post-mortem session.
        except:
            traceback.print_exc()
            print "Uncaught exception. Entering post mortem debugging"
            print "Running 'cont' or 'step' will restart the program"
            t = sys.exc_info()[2]
            while t.tb_next is not None:
                t = t.tb_next
            pdb.interaction(t.tb_frame,t)
            print "Post mortem debugger finished. The "+mainpyfile+" will be restarted"
예제 #2
0
def main():
    mainpyfile =  sys.argv[1]     # Get script filename
    parentsock = sys.argv[2]
    childsock = sys.argv[3]
    # Replace pdb's dir with script's dir in front of module search path.
    sys.path[0] = os.path.dirname(mainpyfile)
    client = Debugger(parentsock, childsock)
    pdb = Pidadb(client)
    client.pdb = pdb
    client.started()
    while 1:
        try:
            pdb._runscript(mainpyfile)
            if pdb._user_requested_quit:
                break
        except SystemExit:
            pass
            # In most cases SystemExit does not warrant a post-mortem session.
        except:
            traceback.print_exc()
            print "Uncaught exception. Entering post mortem debugging"
            print "Running 'cont' or 'step' will restart the program"
            t = sys.exc_info()[2]
            while t.tb_next is not None:
                t = t.tb_next
            pdb.interaction(t.tb_frame,t)
            print "Post mortem debugger finished. The "+mainpyfile+" will be restarted"
예제 #3
0
def main(pdb, options):
    """Invoke the debuggee as a script."""
    argv = options.args
    if not argv:
        critical('usage: Pyclewn pdb scriptfile [arg] ...')
        sys.exit(1)

    sys.stdin = sys.stdout = sys.stderr = tty_fobj(options.tty)
    mainpyfile = argv[0]
    sys.path[0] = os.path.dirname(mainpyfile)
    sys.argv = argv
    pdb._runscript(mainpyfile)
예제 #4
0
파일: pydb.py 프로젝트: dingtaocpp/VimLite
def main(pdb, options):
    """Invoke the debuggee as a script."""
    argv = options.args
    if not argv:
        critical('usage: Pyclewn pdb scriptfile [arg] ...')
        sys.exit(1)

    sys.stdin = sys.stdout = sys.stderr = tty_fobj(options.tty)
    mainpyfile = argv[0]
    sys.path[0] = os.path.dirname(mainpyfile)
    sys.argv = argv
    pdb._runscript(mainpyfile)
예제 #5
0
def main():
    if not sys.argv[1:]:
        print "usage: ipdb.py scriptfile [arg] ..."
        sys.exit(2)

    mainpyfile =  sys.argv[1]     # Get script filename
    if not os.path.exists(mainpyfile):
        print 'Error:', mainpyfile, 'does not exist'
        sys.exit(1)

    del sys.argv[0]         # Hide "pdb.py" from argument list

    # Replace pdb's dir with script's dir in front of module search path.
    sys.path[0] = os.path.dirname(mainpyfile)

    # Note on saving/restoring sys.argv: it's a good idea when sys.argv was
    # modified by the script being debugged. It's a bad idea when it was
    # changed by the user from the command line. The best approach would be to
    # have a "restart" command which would allow explicit specification of
    # command line arguments.
    pdb = tbtools.defaultPDB
    while 1:
        try:
            pdb._runscript(mainpyfile)
            if pdb._user_requested_quit:
                break
            print "The program finished and will be restarted"
        except Restart:
            # Restart is defined by pdb in Python 2.6
            print "Restarting", mainpyfile, "with arguments"
            print "\t" + " ".join(sys.argv[1:])
        except SystemExit:
            # In most cases SystemExit does not warrant a post-mortem session.
            print "The program exited via sys.exit(). Exit status: ",
            tbtools.ultraTB.print_exc()
            # print sys.exc_info()[1]
        except bdb.BdbQuit:
            # requested quit
            break
        except:
            etype, value, tb = sys.exc_info()
            tbtools.defaultTB(etype, value, tb)
            print "Uncaught exception. Entering post mortem debugging"
            print "Running 'cont' or 'step' will restart the program"
            post_mortem(tb)
            print "Post mortem debugger finished. The "+mainpyfile+" will be restarted"
예제 #6
0
def main():
    if not sys.argv[1:]:
        print "usage: pdb.py scriptfile [arg] ..."
        sys.exit(2)
    mainpyfile =  sys.argv[1]     # Get script filename
    if not os.path.exists(mainpyfile):
        print 'Error:', mainpyfile, 'does not exist'
        sys.exit(1)

    sid = sys.argv[2]
    #del sys.argv[0]         # Hide "pdb.py" from argument list

    # Replace pdb's dir with script's dir in front of module search path.
    sys.path[0] = os.path.dirname(mainpyfile)

    # Note on saving/restoring sys.argv: it's a good idea when sys.argv was
    # modified by the script being debugged. It's a bad idea when it was
    # changed by the user from the command line. The best approach would be to
    # have a "restart" command which would allow explicit specification of
    # command line arguments.
    client = Debugger(sid)
    pdb = Pidadb(client)
    client.pdb = pdb
    client.started()
    while 1:
        try:
            pdb._runscript(mainpyfile)
            if pdb._user_requested_quit:
                break
            print "The program finished and will be restarted"
        except SystemExit:
            # In most cases SystemExit does not warrant a post-mortem session.
            print "The program exited via sys.exit(). Exit status: ",
            print sys.exc_info()[1]
        except:
            traceback.print_exc()
            print "Uncaught exception. Entering post mortem debugging"
            print "Running 'cont' or 'step' will restart the program"
            t = sys.exc_info()[2]
            while t.tb_next is not None:
                t = t.tb_next
            pdb.interaction(t.tb_frame,t)
            print "Post mortem debugger finished. The "+mainpyfile+" will be restarted"
예제 #7
0
def main():
    if not sys.argv[1:]:
        print "usage: pdb.py scriptfile [arg] ..."
        sys.exit(2)
    mainpyfile = sys.argv[1]  # Get script filename
    if not os.path.exists(mainpyfile):
        print 'Error:', mainpyfile, 'does not exist'
        sys.exit(1)

    sid = sys.argv[2]
    #del sys.argv[0]         # Hide "pdb.py" from argument list

    # Replace pdb's dir with script's dir in front of module search path.
    sys.path[0] = os.path.dirname(mainpyfile)

    # Note on saving/restoring sys.argv: it's a good idea when sys.argv was
    # modified by the script being debugged. It's a bad idea when it was
    # changed by the user from the command line. The best approach would be to
    # have a "restart" command which would allow explicit specification of
    # command line arguments.
    client = Debugger(sid)
    pdb = Pidadb(client)
    client.pdb = pdb
    client.started()
    while 1:
        try:
            pdb._runscript(mainpyfile)
            if pdb._user_requested_quit:
                break
            print "The program finished and will be restarted"
        except SystemExit:
            # In most cases SystemExit does not warrant a post-mortem session.
            print "The program exited via sys.exit(). Exit status: ",
            print sys.exc_info()[1]
        except:
            traceback.print_exc()
            print "Uncaught exception. Entering post mortem debugging"
            print "Running 'cont' or 'step' will restart the program"
            t = sys.exc_info()[2]
            while t.tb_next is not None:
                t = t.tb_next
            pdb.interaction(t.tb_frame, t)
            print "Post mortem debugger finished. The " + mainpyfile + " will be restarted"