仅在命令行中设置Xdebug断点 [英] Setting Xdebug breakpoints solely in command line
问题描述
我正在努力使用PHP维护脚本,我正在寻找一种方法,只使用xdebug在命令行(如gdb old-school),但我不知道如何设置断点,做一个步骤 - 进入,继续并继续。 Xdebug正在运行, phpinfo();
说。
I'm struggling with a PHP maintenance script and I was looking for a way to use xdebug solely in command line (like gdb old-school), but I couldn't figure out how to set a breakpoint, do a step-into, step-over and continue. Xdebug is up and running, as phpinfo();
says.
我发现了很多关于如何使用Eclipse和其他工具,但没有CLI。有人可以帮助我吗?我的环境是Centos 6和Bash。
I found a lot of documentation regarding how to do this using Eclipse and other tools, but none to CLI. Could anyone help me? My environment is Centos 6 and Bash.
任何帮助都很感激。
谢谢!
推荐答案
这实际上是可能的。在Xdebug源代码下载中,你会发现一个名为debugclient的目录。在此目录中,您会发现一个非常的简单客户端接受原始DBGP命令,并将输出作为XML。要编译,请运行:
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(或同等效果)
- ./buildconf
- ./ configure --with-libedit
- make
- apt-get install libedit-dev (or equivalent)
- ./buildconf
- ./configure --with-libedit
- make
然后,您可以使用 ./ debugclient
运行二进制文件。
You can then run the binary with ./debugclient
.
,然后运行以下命令:
On a different shell, you then run the following:
- export XDEBUG_CONFIG =idekey = dr
< dxdebug.remote_enable = 1 yourscript.php
debugclient会看到此连接,然后您可以发出直接DBGP命令。对于断点,您可以例如设置:
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
-i 1
数字, -f
是文件, -n
行号。设置断点后,您可以运行 run -i 2
前进到该行。对于所有其他命令,我们将引荐您访问 http://xdebug.org/docs-dbgp.php上的DBGP文档a>
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
这篇关于仅在命令行中设置Xdebug断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!