[英]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.