vscode-php-debug: Unable to continue if breakpoint is reached and cannot access variable in watched expresion

PHP version: 7.0.15-0ubuntu0.16.10.4 XDebug version: Xdebug v2.4.0 Adapter version: 1.10.0

Steps:

  • press F5 on the code below
  • set breakpoint to the line echo "Hello";
  • add the expression self::a to the section Watch (it’s a variable nowhere used in the script)
  • load the PHP script in web browser - redirect to VScode is done
  • press Continue in VScode

Expected result:

  • script finishes

Actual result:

  • nothing happens, no GUI response

Code snippet to reproduce:

<?php
echo "Hello";
echo "World";
?>

Your launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}

XDebug php.ini config:

xdebug.remote_enable=1
xdebug.remote_autostart = 1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.max_nesting_level=300
xdebug.remote_log=/tmp/xdebug.log

XDebug logfile - after you click on Continue in debugger:

<- run -i 28
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="12" status="running" reason="ok"><error code="206"><message><![CDATA[error evaluating code]]></message></error></response>

Adapter logfile - after you click on Continue in debugger:

-> continueRequest
{ command: 'continue',
  arguments: { threadId: 1 },
  type: 'request',
  seq: 25 }

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 29 (12 by maintainers)

Most upvoted comments

The tip in #150 helped me solve the issue!

Here’s a minimal test case to show how easy that bug is to trigger in what can easily be a real-life test scenario:

<?php

class MyClass {
    const A = 'A';

    function print_a() {
        // Try setting a watch expression on self::A
        xdebug_break();
        echo(self::A); // self::A is in scope, everything is fine
    }
}

$obj = new MyClass();
$obj->print_a();
xdebug_break(); // self::A is out of scope, evaluation fails
// XDebug/VSCode debugger becomes unresponsive and needs to be terminated

Reproduces the issue 100% of the time on the following configuration :

  • Windows 7
  • PHP 7.0.30
  • XDebug 2.6.0
  • VSCode 1.30.2
  • PHP Debug 1.12.6

EDIT: Full execution logs for the adapter (vscode debug console) and XDebug for the test case specified above.

Same problem here … 😕 xdebug and vscode driver worked beautifully untill yesterday (vscode update) xdebug was from xenial package. Something seen to be stuck in the pipe … right now. And this is quite a blocking situation.

XDebug seems to operate fine until a breakpoint is reached and it is requested a stepIn/Out or next or continue, in which case no answer seems to be received, debugger is still operational though (evaluteRequest is answered ok).

providing some log data : xdbgvscode.log

and install details : Linux 4.4.0-96-generic #119-Ubuntu x86_64 GNU/Linux Xdebug v2.6.0-dev (now compiled/installed from github head) DBGp - Common DeBuGger Protocol Revision : 1.145 (from phpInfo()) VSCode : Version 1.16.1 Commit 27492b6bf3acb0775d82d2f87b25a93490673c6d .vscode/extensions/felixfbecker.php-debug-1.11.1 .vscode/extensions/felixfbecker.php-intellisense-1.5.1

Thanks for any info on this … Lorenzo