[英]Can't get XDebug to make a connection in Vim. Getting “no attribue 'stop'” error
[英]xdebug, phpunit, and vim. 'uninitialized' variables in context
我正在使用这个vim插件https://github.com/ludovicPelle/vim-xdebug与xdebug
Xdebug和vim插件使用常规脚本正常工作。 我可以单步执行并打印出变量。
当我尝试单步执行基本单元测试时,它会很好地到达断点并停止,我可以单步执行代码,但是我无法再查看变量的内容。
我试图通过一个非常基本的单元测试来实现这一点
class testClass extends \PHPUnit_Framework_TestCase
{
public function testSomething()
{
$a = 5;
$b = 6;
$c = 7;
}
}
当我走到方法的末尾并尝试打印出$ a的内容时,我收到以下错误。
13 : send =====> property_get -i 13 -d 0 -n a
13 : recv <===== {{{ <?xml version="1.0" encoding="iso-8859-1"?>
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="property_get" transaction_id="13" status="break" reason="ok"><error code="300"><message><![CDATA[can not get property]]></message></error></response>
}}}
response status=break xmlns=urn:debugger_protocol_v1 xmlns:xdebug=http://xdebug.org/dbgp/xdebug reason=ok command=property_get transaction_id=13
error code=300 : Can not get property (when the requested property to get did not exist, this is NOT used for an existing but uninitialized property, which just gets the type "uninitialised" (See: PreferredTypeNames)).
message
can not get property
当我打印出整个上下文时,3个变量显示如下
$command = 'context_get';
a = /* uninitialized */'';
b = /* uninitialized */'';
c = /* uninitialized */'';
我知道phpunit在运行测试类的方法时会做一些有趣的技巧,所以这可能就是调试器没有返回方法中的变量的原因。 任何建议将不胜感激,谢谢。
你需要做这样的事情
class testClass extends \PHPUnit_Framework_TestCase
{
$a = 0;
$b = 0;
$c = 0;
function dosomething() {
$a = 5;
$b = 6;
$c = 7;
}
}
或者您需要包含一个变量文件
你的var.php文件
<?
$a = 0;
$b = 0;
$c = 0;
?>
问题原来是我正在使用的xdebug的版本,显然这是2.0中已知的问题,已在2.1中修复我正在调试的虚拟机是ubuntu 10.04 LTS
在发布此版本的Ubuntu时,xdebug 2.1仍然是候选版本。 我编译了最新版本的xdebug,我能够查看方法中的变量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.