def do_stepout(self, data):
        self.set_return(self.curframe)
        return True

    def do_stepin(self, data):
        self.set_step()
        return True

def main():
    # save original fds
    stdout = sys.stdout
    stdin = sys.stdin

    # pipes for stdin/out for debugged script
    stdout_read, stdout_write = os.pipe()
    stdin_read, stdin_write = os.pipe()

    # start the stdout thread
    thread.start_new_thread(relay_stdout, (os.fdopen(stdout_read, 'r', 0), stdout))

    # redirect IO
    sys.stdout = os.fdopen(stdout_write, 'w', 0)
    sys.stdin = os.fdopen(stdin_read, 'r', 0)

    debugger = JsonDebugger(stdin, stdout)
    debugger.cmdloop()

if __name__ == '__main__':
    import debugger
    sys.exit(debugger.main())
    def do_stepin(self, data):
        self.set_step()
        return True


def main():
    # save original fds
    stdout = sys.stdout
    stdin = sys.stdin

    # pipes for stdin/out for debugged script
    stdout_read, stdout_write = os.pipe()
    stdin_read, stdin_write = os.pipe()

    # start the stdout thread
    thread.start_new_thread(relay_stdout,
                            (os.fdopen(stdout_read, 'r', 0), stdout))

    # redirect IO
    sys.stdout = os.fdopen(stdout_write, 'w', 0)
    sys.stdin = os.fdopen(stdin_read, 'r', 0)

    debugger = JsonDebugger(stdin, stdout)
    debugger.cmdloop()


if __name__ == '__main__':
    import debugger
    sys.exit(debugger.main())
Exemple #3
0
    if bSingleStep:
        print 'enabling ss'
        EnableSS()   
    
    return 1

def ct_handler(startaddress,tid):
    global thread_info
    thread = THREAD_INFO(startaddress,tid)
    thread_info.append(thread)
    print 'thread start:%x tid:%d'%(startaddress,tid)    
    return 1

def main():        
    pid = list_process.get_pid_exe(sys.argv[1])
    verbose = string.atoi(sys.argv[2],10)
    print 'attaching... ',pid    
    AttachPid(verbose,pid,cp_handler,load_dll_handler,bp_handler,ct_handler,ss_handler,unload_handler)

AttachPid,ExitDebugging,SetBP,FixBP,EnableSS,GetStackArgument = debugger.main()

cp_handler = debugger.CP_HANDLER(cp_handler)
load_dll_handler = debugger.LOAD_DLL_HANDLER(load_dll_handler)
bp_handler = debugger.BP_HANDLER(bp_handler)
ct_handler = debugger.CT_HANDLER(ct_handler)
ss_handler = debugger.SS_HANDLER(ss_handler)
unload_handler = debugger.UNLOAD_DLL_HANDLER(unload_handler)

if __name__ == "__main__":
    main()