Setting Xdebug breakpoints solely in command line

被刻印的时光 ゝ 提交于 2019-11-30 15:57:17

This is actually possible. In the Xdebug source downloads, you will find a directory called "debugclient". In this directory you will find a very simple client accepting raw DBGP commands, and giving output as XML. To compile, you run:

  • apt-get install libedit-dev (or equivalent)
  • ./buildconf
  • ./configure --with-libedit
  • make

You can then run the binary with ./debugclient.

On a different shell, you then run the following:

  • export XDEBUG_CONFIG="idekey=dr"
  • php -dxdebug.remote_enable=1 yourscript.php

The debugclient sees this connection, and you then can issue direct DBGP commands. For a breakpoint, you can for example set:

breakpoint_set -i 1 -t line -f file:///path/to/yourscript.php -n 42

the -i 1 is required to be an increasing number, -f is the file and -n the line number. After setting the breakpoint you can then run run -i 2 to advance to that line. For all other commands, I'd refer you to the DBGP documentation at http://xdebug.org/docs-dbgp.php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!