doulierong0334
doulierong0334
2012-04-03 14:31
浏览 59
已采纳

debug php使用vim和xdebug,时间设置

I use vim + xdebug to debug php. If the debug operation waste a long time, vim will lost the connection with xdebug, and I have to restart the debug by press F5 and do it from the first step again. So how can I set a longer time for the debug procedure?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douwen1006
    douwen1006 2012-04-04 17:07
    已采纳

    The 5 second timeout is hard-coded in debugger.py. You can increase it by modifying the following line:

      def accept(self):
        print 'waiting for a new connection on port '+str(self.port)+' for 5 seconds...'
        serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        try:
          serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
          serv.bind(('', self.port))
    
          # Set a higher timeout here...
          serv.listen(5)
          (self.sock, address) = serv.accept()
        except socket.timeout:
          serv.close()
          self.stop()
          print 'timeout'
          return
    

    In my plugin version, that happens to be line 556 of debugger.py. If your differs, just search in Vim for 5 or second.

    Update:

    Also found it at line 666

      def __init__(self, port = 9000, max_children = '32', max_data = '1024', max_depth = '1', minibufexpl = '0', debug = 0):
        """ initialize Debugger """
    
        # Probably need to increase here too...
        socket.setdefaulttimeout(5)
        self.port       = port
        self.debug      = debug
    
    点赞 评论
  • dongmei6426
    dongmei6426 2012-09-13 10:32

    You can try my plugin - DBGPavim

    http://www.vim.org/scripts/script.php?script_id=4059

    DBGPavim does not have such limitation, so that VIM users do not need to wait for connection from apache server. No timeout things, users press F5 to start debugger backend, and uses his/her VIM normally. Debug backend won't stop users to interact with VIM. Users can press F6 to stop debugger backend anytime.

    点赞 评论

相关推荐