swoole / yasd

Yet Another Swoole Debugger
https://huanghantao.github.io/yasd-wiki/
Apache License 2.0
357 stars 35 forks source link

vscode breakpoint doesn't work under wsl2 #110

Closed GO111MODULE closed 3 years ago

GO111MODULE commented 3 years ago

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provides a simple script and debug step to reproduce the problem.

After setting breakpoint and starting debugging (F5) under VS Code, I enter php -e test.php under wsl2, and nothing happened.

  1. What did you expect to see? The breakpoint should normally work, just like this video - 在IDE中使用yasd调试器.

  2. What did you see instead? Breakpoint doesn't work on vscode. image

  3. What is your machine environment used (show your uname -a & php -v & gcc -v) ?

    Linux xxxxxxx 5.4.72-microsoft-standard-WSL2 #1 SMP xxxxxxxx x86_64 x86_64 x86_64 GNU/Linux
PHP 7.4.3 (cli) (built: Oct  6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Yasd v0.3.7, Our Copyright, by codinghuang
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)

And here's my launch.json image

(cli) php.ini image

php --ri yasd image

huanghantao commented 3 years ago

Perhaps you need to modify remote_host, you should not be able to access Windows by 127.0.0.1 in WSL.

GO111MODULE commented 3 years ago

Perhaps you need to modify remote_host, you should not be able to access Windows by 127.0.0.1 in WSL.

Thanks for you reply,

After following your advice, I have googled and tried 2 ways to find ip address could access Windows from WSL2, all comes out the same ip address ( and I guess that's it? )

# bash
grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'

ipconfig.exe | grep 'vEthernet (WSL)' -A4 | cut -d":" -f 2 | tail -n1 | sed -e 's/\s*//g'

image

In additional, I have turn off windows defender firewall

# cmd
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound  -InterfaceAlias "vEthernet (WSL)"  -Action Allow

And modified php.ini yasd.remote.host ( also I have tried another port , of course I have modified launch.json too)

image

Even reboot Windows and WSL2...

Unfortunately, just as the same, it seems not work. XD

GO111MODULE commented 3 years ago

WTF, I found my php.ini have a TYPO ysad -> yasd

GO111MODULE commented 3 years ago

Thanks, it could successfully debug now !!

And 127.0.0.1 is working, just for me.

Here's my configure if anyone needed:

VS Code launch.json image

php.ini image