【问题标题】:Xdebug - Visual Studio Code - Step into / Step over - Nothing happensXdebug - Visual Studio 代码 - 进入/跳过 - 没有任何反应
【发布时间】:2020-01-15 09:43:30
【问题描述】:

我在使用 Visual Studio Code 和 Xdebug 时遇到问题。

我的系统:

我正在使用带有IIS 网络服务器和PHP 7.4 版的Windows 10 系统。 我已经成功下载并安装了最新版本(2.9.0)的Xdebug(请参阅下面php.ini 的摘录)。 Visual Studio Code 配置为使用 Xdebug(请参阅下面的 launch.json 文件)。

我的问题是:

当我设置一个断点时,它会在这个断点处停止。到现在为止还挺好。但是,如果我按下“步入”(F11)或“步过”(F10)按钮,则什么也没有发生。初始断点仍然突出显示 - 它停留在断点处。

也许有些地方配置错了,但实际上我无法弄清楚它是什么。

在这里查看配置文件:

php.ini:

[XDEBUG]
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_port = 9000
xdebug.remote_autostart = 1
xdebug.idekey=VSCODE
xdebug.remote_log ="C:\temp\xdebug.log"

[PHP_XDEBUG-2.9.0-7.4-VC15-NTS]
zend_extension = "C:\Program Files (x86)\PHP\v7.4\ext\php_xdebug-2.9.0-7.4-vc15-nts-x86_64.dll"

Visual Studio Code 的launch.json:

{
    // Verwendet IntelliSense zum Ermitteln möglicher Attribute.
    // Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen.
    // Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "ignore": [
                "**/vendor/**/*.php"
            ]
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}

【问题讨论】:

  • 在 php.ini 中设置一个日志:xdebug.remote_log=/tmp/xdebug.org,然后tail -f /tmp/xdebug.org 看看线路上发生了什么。
  • 非常感谢。这有助于找出问题所在。问题是,已删除文件上有断点。
  • 这应该不会造成问题。你的日志里发生了什么? (或者你可以分享它,同时通过bugs.xdebug.org 指出哪里出错了)
  • 然后在bugs.xdebug.org 附上日志提交一个错误报告,这样我们就可以检查它是否不是 Xdebug 中的错误。
  • @Derick 我在那里创建了一个错误报告。 ID 0001735

标签: php visual-studio-code windows-10 xdebug


【解决方案1】:

这在 Xdebug 中原来是 bug,当以下几点都成立时会发生这种情况:

  • error handler 将警告/通知转换为异常
  • 在此特定异常上设置了异常断点,或设置了通配符异常断点
  • IDE 经常使用 DBGp eval command 来实现监视,在这种情况下,由于未定义的变量而创建了警告或通知。

原因是尽管eval 命令在运行之前使用 breakpoints_allowed 标志轮换断点,但 exceptions 的断点处理程序并没有检查这是否breakpoints_allowed 标志实际上已设置。

fix 用于检查处理程序中的 breakpoints_allowed 标志是否存在异常断点,并将成为即将发布的 Xdebug 2.9.2 版本的一部分。如果您不想等待,请从 Github 下载 Xdebug 并确保使用 xdebug_2_9 分支(除非您想进行真正的实验)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-11
    • 2018-09-11
    • 1970-01-01
    相关资源
    最近更新 更多