Esempio n. 1
0
 def reloadControl(self): #this wont work because it wont write or something....
     printD('reiniting controller')
     rpdb2.setbreak()
     try:
         self.ctrl.cleanup()
         del(self.ctrl)
         from mcc import mccControl
         self.ctrl=Control()
         self.ikCtrlDict[self.__mode__]=self
         self.updateModeDict()
     except:
         printD('FAILURE')
         raise IOError
     return self
Esempio n. 2
0
def start(*args, **kargs):
    global g_debugging, g_debug_session_ready

    python = get_python_interpreter()

    log("START (g_debugging: %s)" % g_debugging)

    # todo wrap at exit, such that end of winpdb without detaching does not make
    # plugin host stop and st2 exit

    rpdb2 = import_rpdb2()

    if g_debugging:
        if g_winpdb is None:
            winpdb = debug_session(python, shutdown_at_exit=False)
            rpdb2.g_thread_start_new_thread(debug_session_monitor, (winpdb, ))

        time.sleep(0.1)

        rpdb2.setbreak(depth=1)
        return

    #rpdb2.g_thread_start_new_thread(debug_session, tuple(python, False))

    time.sleep(0.1)

    # initialize debugger (there is a thread starting, so we have to wait for it)
    rpdb2.start_embedded_debugger("sublime",
                                  timeout=0,
                                  source_provider=SublimeTextSourceProvider())

    log("wait for debug server")

    # wait for running debugger thread
    wait_for_debug_server()

    if g_winpdb is None:
        winpdb = debug_session(python, shutdown_at_exit=False)
        rpdb2.g_thread_start_new_thread(debug_session_monitor, (winpdb, ))

    #g_debug_session_ready = False

    #while not g_debug_session_ready:
    #time.sleep(0.1)

    log("break")
    rpdb2.setbreak(depth=1)

    g_debugging = True
Esempio n. 3
0
def winpdb(depth=0):
    import rpdb2
    depth += 1
    if rpdb2.g_debugger is not None:
        return rpdb2.setbreak(depth)
    script = rpdb2.calc_frame_path(sys._getframe(depth))
    pwd = str(os.getpid()) + os.getcwd().replace('/', '_').replace('-', '_')
    pid = os.fork()
    if pid:
        try:
            rpdb2.start_embedded_debugger(pwd, depth=depth)
        finally:
            os.waitpid(pid, 0)
    else:
        try:
            os.execlp(
                'python', 'python', '-c', """import os\nif not os.fork():
                import rpdb2, winpdb
                rpdb2_raw_input = rpdb2._raw_input
                rpdb2._raw_input = lambda s: \
                    s == rpdb2.STR_PASSWORD_INPUT and %r or rpdb2_raw_input(s)
                winpdb.g_ignored_warnings[winpdb.STR_EMBEDDED_WARNING] = True
                winpdb.main()
            """ % pwd, '-a', script)
        finally:
            os.abort()
Esempio n. 4
0
def winpdb(depth=0):
    import rpdb2
    depth += 1
    if rpdb2.g_debugger is not None:
        return rpdb2.setbreak(depth)
    script = rpdb2.calc_frame_path(sys._getframe(depth))
    pwd = str(os.getpid()) + os.getcwd().replace('/', '_').replace('-', '_')
    pid = os.fork()
    if pid:
        try:
            rpdb2.start_embedded_debugger(pwd, depth=depth)
        finally:
            os.waitpid(pid, 0)
    else:
        try:
            os.execlp('python', 'python', '-c', """import os\nif not os.fork():
                import rpdb2, winpdb
                rpdb2_raw_input = rpdb2._raw_input
                rpdb2._raw_input = lambda s: \
                    s == rpdb2.STR_PASSWORD_INPUT and %r or rpdb2_raw_input(s)
                winpdb.g_ignored_warnings[winpdb.STR_EMBEDDED_WARNING] = True
                winpdb.main()
            """ % pwd, '-a', script)
        finally:
            os.abort()
Esempio n. 5
0
def attach(pid, ip='127.0.0.1', password='******', gui=False, break_exit=False):
  vdb.attach(pid)
  import sys
  old_args = sys.argv

  #attach must come last for some STUPID reason. Dumb parser
  sys.argv = ['', '--pwd=%s' % password, '--host=%s' % ip, '--attach', str(pid)]
  print sys.argv
  if gui:
    import winpdb
    winpdb.main()
  else:
    rpdb2.main()

  # Debuggee breaks (pauses) here 
  # before program termination. 
  #
  # You can step to debug any exit handlers.
  #
  if break_exit:
    rpdb2.setbreak()
  sys.argv = old_args
Esempio n. 6
0
def attach(pid, ip='127.0.0.1', password='******', gui=False, break_exit=False):
    ''' Parameters
      ----------
      pid : int
        The Process ID
      ip : str
        The IP Address
      password : str
        The Password
      gui : bool
        If true use winpbd GUI
      break_exit : bool
        If break_exit is true, it set's a breakpoint when the program extis.
  '''
    vdb.attach(pid)
    import sys
    old_args = sys.argv

    #attach must come last for some STUPID reason. Dumb parser
    sys.argv = [
        '', '--pwd=%s' % password,
        '--host=%s' % ip, '--attach',
        str(pid)
    ]
    print(sys.argv)
    if gui:
        import winpdb
        winpdb.main()
    else:
        rpdb2.main()

    # Debuggee breaks (pauses) here
    # before program termination.
    #
    # You can step to debug any exit handlers.
    #
    if break_exit:
        rpdb2.setbreak()
    sys.argv = old_args
Esempio n. 7
0
def setbreak(depth=0):
    rpdb2 = import_rpdb2()
    rpdb2.setbreak(depth=depth + 1)