简体   繁体   English

使用vim和xdebug调试php,设置时间

[英]debug php use vim and xdebug , time setting

I use vim + xdebug to debug php. 我使用vim + xdebug调试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. 如果调试操作浪费了很长时间,vim将失去与xdebug的连接,我必须按F5重新启动调试,然后从第一步开始再次进行调试。 So how can I set a longer time for the debug procedure? 那么,如何为调试过程设置更长的时间呢?

The 5 second timeout is hard-coded in debugger.py. 5秒超时在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. 在我的插件版本中,恰好是debugger.py的556行 If your differs, just search in Vim for 5 or second . 如果您不同,只需在Vim中搜索5second

Update: 更新:

Also found it at line 666 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

You can try my plugin - DBGPavim 您可以尝试我的插件-DBGPavim

http://www.vim.org/scripts/script.php?script_id=4059 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. DBGPavim没有这种限制,因此VIM用户不需要等待来自apache服务器的连接。 No timeout things, users press F5 to start debugger backend, and uses his/her VIM normally. 没有超时的情况,用户按F5键启动调试器后端,并正常使用其VIM。 Debug backend won't stop users to interact with VIM. 调试后端不会阻止用户与VIM进行交互。 Users can press F6 to stop debugger backend anytime. 用户可以随时按F6来停止调试器后端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM