首页 > 解决方案 > Xdebug 3 在 VSCode 上运行缓慢

问题描述

我开始使用 Xdebug 3,它工作正常,但速度很慢。Xdebug 2 是立即的,但使用 Xdebug 3 需要几秒钟才能标记断点。

这个问题有一些配置解决方案吗?

这是我在php.ini文件中的配置

[XDebug]

zend_extension = C:\xampp\php\ext\php_xdebug-3.0.4-7.4-vc15-x86_64.dll
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9003
xdebug.client_host = "127.0.0.1"
xdebug.log = "C:\xampp\tmp\xdebug\xdebug.log"
xdebug.idekey = VSCODE

launch.json归档

    {
        // Use IntelliSense to learn about possible attributes.
        // Hover to view descriptions of existing attributes.
        // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Listen for Xdebug",
                "type": "php",
                "request": "launch",
                "port": 9003
            },
            {
                "name": "Launch currently open script",
                "type": "php",
                "request": "launch",
                "program": "${file}",
                "cwd": "${fileDirname}",
                "port": 9003
            }
        ]
    }

更新:

这是日志,它似乎需要尝试它来连接

[3560] Log opened at 2021-05-24 09:58:26.404140
[3560] [Step Debug] INFO: Connecting to configured address/port: 127.0.0.1:9003.
[3560] [Step Debug] ERR: Time-out connecting to debugging client, waited: 200 ms. Tried: 127.0.0.1:9003 (through xdebug.client_host/xdebug.client_port) :-(
[8380] Log opened at 2021-05-24 09:58:33.594218
[8380] [Step Debug] INFO: Connecting to configured address/port: 127.0.0.1:9003.
[8380] [Step Debug] INFO: Connected to debugging client: 127.0.0.1:9003 (through xdebug.client_host/xdebug.client_port). :-)

更新 2:

这是完整的日志

[13440] Log opened at 2021-05-24 11:23:49.098251
[13440] [Step Debug] INFO: Connecting to configured address/port: 127.0.0.1:9003.
[13440] [Step Debug] INFO: Connected to debugging client: 127.0.0.1:9003 (through xdebug.client_host/xdebug.client_port). :-)
[13440] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///C:/xampp/htdocs/prueba/index.php" language="PHP" xdebug:language_version="7.4.17RC1" protocol_version="1.0" appid="13440" idekey="VSCODE"><engine version="3.0.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>

[13440] [Step Debug] <- feature_get -i 1 -n resolved_breakpoints
[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="1" feature_name="resolved_breakpoints" supported="1"><![CDATA[0]]></response>

[13440] [Step Debug] <- feature_set -i 2 -n resolved_breakpoints -v 1
[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="resolved_breakpoints" success="1"></response>

[13440] [Step Debug] <- feature_get -i 3 -n notify_ok
[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="3" feature_name="notify_ok" supported="1"><![CDATA[0]]></response>

[13440] [Step Debug] <- feature_set -i 4 -n notify_ok -v 1
[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="notify_ok" success="1"></response>

[13440] [Step Debug] <- breakpoint_set -i 5 -t line -f file:///c:/xampp/htdocs/prueba/index.php -n 3
[13440] [Step Debug] -> <notify xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" name="breakpoint_resolved"><breakpoint type="line" resolved="resolved" filename="file:///C:/xampp/htdocs/prueba/index.php" lineno="3" state="enabled" hit_count="0" hit_value="0" id="134400003"></breakpoint></notify>

[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="5" id="134400003" resolved="resolved"></response>

[13440] [Step Debug] <- breakpoint_get -i 6 -d 134400003
[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_get" transaction_id="6"><breakpoint type="line" resolved="resolved" filename="file:///C:/xampp/htdocs/prueba/index.php" lineno="3" state="enabled" hit_count="0" hit_value="0" id="134400003"></breakpoint></response>

[13440] [Step Debug] <- run -i 7
[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="7" status="break" reason="ok"><xdebug:message filename="file:///C:/xampp/htdocs/prueba/index.php" lineno="3"></xdebug:message></response>

[13440] [Step Debug] <- stack_get -i 8
[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="8"><stack where="{main}" level="0" type="file" filename="file:///C:/xampp/htdocs/prueba/index.php" lineno="3"></stack></response>

[13440] [Step Debug] <- context_names -i 9 -d 0
[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="9"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context><context name="User defined constants" id="2"></context></response>

[13440] [Step Debug] <- context_get -i 10 -d 0 -c 0
[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="10" context="0"><property name="$saludo" fullname="$saludo" type="uninitialized"></property></response>

[13440] [Step Debug] <- step_into -i 11
[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="11" status="break" reason="ok"><xdebug:message filename="file:///C:/xampp/htdocs/prueba/index.php" lineno="4"></xdebug:message></response>

[13440] [Step Debug] <- stack_get -i 12
[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="12"><stack where="{main}" level="0" type="file" filename="file:///C:/xampp/htdocs/prueba/index.php" lineno="4"></stack></response>

[13440] [Step Debug] <- context_names -i 13 -d 0
[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="13"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context><context name="User defined constants" id="2"></context></response>

[13440] [Step Debug] <- context_get -i 14 -d 0 -c 0
[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="14" context="0"><property name="$saludo" fullname="$saludo" type="string" size="4" encoding="base64"><![CDATA[aG9sYQ==]]></property></response>

[13440] [Step Debug] <- stop -i 15
[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stop" transaction_id="15" status="stopped" reason="ok"></response>

[13440] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stop" transaction_id="15" status="stopping" reason="ok"></response>

[13440] Log closed at 2021-05-24 11:28:15.536136

标签: visual-studio-codexdebug

解决方案


推荐阅读