-
-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XDebug Breakpoints Initially Ignored with Visual Studio Code over Docker #240
Comments
Same issue here! A workaround seems to be putting the absolute path instead of "pathMappings": {
// "/var/www/html": "${workspaceRoot}"
"/var/www/html": "c:/Users/path/to/project"
} And of course stopping/starting the debugger.... |
@serl Switching to absolute paths works! I read that ${workspaceRoot} is deprecated, so I tried switching to the updated environment variable ${workspaceFolder} to see if it works, but that was still no good. How curious...I wonder what value was ${workspaceRoot} or ${workspaceFolder} giving me? |
Did anyone raise this issue at the vscode repo? It doesn't seem like this is a bug in the extension |
Thanks @serl ! Yes, with the absolute path set, it works for me too!!!! Finally, now back up to the latest version of vscode :) |
From the post made by @kestrelhawk from the above referenced issue, it sounds like PHP Debug uses lower-case drive letters. VS Code $(workspaceFolder) gives upper-case drive letters. So there's a mismatch in casing. Why does PHP Debug need to use lower-case drive letters for path mappings? |
Feel free to do a PR. The adapter doesn't enforce lowercase drive letters, but I think XDebug does. |
It seems VS Code 1.21 changes the drive letter to upper case even when using hard coded paths. The extension is using upper case drive letters for setBreakpointsRequest even though my pathMapping has a lower case one. The mapping itself isn't the problem because xdebug_break() works fine. |
Referencing microsoft/vscode#43959 |
To be honest, I don't get the point of reporting that over there. It's working fine on the VS Code side of things, Windows drive letters are generally upper case. If XDebug is the one that has issues with this, the obvious fix would be to just change it to lowercase before sending requests. |
I'm having the same issue with not being able to step into/over breakpoints, the only option to proceed executing code is to stop the debugger. I'm on PHP 7.1.15 NTS and VS Code 1.21.1.
Unfortunatly, this workaround does not work for me. See my launch.json below: `{
}` edit: I'm not using Docker though edit 2: The tip by @chriswatt in #150 helped me solve the issue |
Everyone please try v1.12.2 |
Works fine again. |
I've had problems with using Example: Not working: Working: |
Had this issue but only when setting breakpoints on certain files (exactly which files would/wouldn't work was changing when re-starting vscode). After some digging this was caused by the watcher limit, resolved as per |
@ddegasperi
? Does that work? |
I tried everything described in here, I still can't set breakpoints. Instead I just write some invalid code where I want to stop now. |
dude, thank you, this is amazing! |
@felixfbecker This still does not work on Docker 23.0.5, Linux Mint 21.1, VSCode 1.77.3, XDebug 3.2.1. Instead of &{workspaceFolder}, I had to use /home/user/Sites/php-app/src/. |
The Issue
Followed the instructions outlined in the below link to get docker working with Visual Studio Code.
Setting Up and Debugging PHP7 in Docker
I followed the above tutorial using:
• PHP version 7.0.17
• XDebug 2.5.5
• VS Code 1.20.1
• PHP Debug 1.12.1.
The issue is the Visual Studio Code doesn’t seem to function correctly with XDebug over Docker. Any breakpoints added are ignored.
The strange thing is the breakpoints would behave and trigger correctly after XDebug halts the code execution from:
• Hitting a “xdebug_break();” PHP line, which programmatically creates a breakpoint
• Intentionally make a run-time error (such as a call for a non-existing function, or divide by zero error), which causes a breakpoint to where the exception occurred
However, this is inconvenient, as the above to happen would always need to happen before breakpoints could be used normally per debugging session.
What I've Tried so Far
• I tried upgrading to the latest PHP version 7.2.2 with XDebug Version 2.6.0, and still had the same issue.
• I’ve made sure XDebug was installed correctly through "<php? phpinfo() ?> and XDebug Wizard (https://xdebug.org/wizard.php)
• It seems like the PHP Debug is connecting to XDebug correctly, as shown in below logs, however breakpoints aren’t triggering
• Tried WAMP to see if this issue also happens there, but its behaving fine
• Checked with Notepad++ with DBGP plugin to work with XDebug using NotePad++. It actually worked fine with the Docker setup.
Basically, this issue seems to only occur with VSCode and PHPDebug with Docker?
Logs
My Launch.Json:
XDebug php.ini config:
XDebug logfile (from setting
xdebug.remote_log
in php.ini):Adapter logfile (from setting
"log": true
in launch.json):The text was updated successfully, but these errors were encountered: