Closed C-Collamar closed 3 years ago
Hello @C-Collamar, thanks for the report.
There are a few strange things here. From Xdebug log:
Script starts in file:///C:/Users/ccoll/Documents/repositories/some-repo/public/index.php
But then the breakpoint is set to file:///app/Http/Controllers/Some/Controller.php
On the other hand, vscode tells de adapter to set BP at c:\\Users\\ccoll\\Documents\\repositories\\some-repo\\app\\Http\\Controllers\\Some\\Controller.php
I'm guessing you have some path mapping set up in launch.json
?
Another way to debug this is that in the place where you wanted to place a breakpoint you add the php function call xdebug_break();
Xdebug will do a breakpoint there, and you can see if vscode reacts correctly.
If it does not, can you please generate the report again (both log files) and also add the breakpoint that does work.
Best, Damjan
Thanks for looking to this @zobo!
The contents of my launch.json
is basically the same as above (without VS Code's auto-generated comments). As stated in my launch.json
, my only path mapping is to map the path "/app"
to "${workspaceFolder}/app"
.
I tried xdebug_break()
and it works. It pauses the execution for step-debugging in VS Code, but it pauses on the next line, not on the line where xdebug_break()
is invoked. Is that intentional? Because of it, unless I click Step Over twice, the step-debugger looks like it's not moving. To demonstrate, see the screen recording 1.mp4.
In case you might still need it, here are the xdebug and adapter logs I regenerated by doing the following in 2.mp4. In this demonstration, I was expecting that when I continue the execution, it would eventually pause in line 13, but it didn't, and just continued on.
I hope this helps.
Hi. I had a quick look. First, I tried xdebug_break()
realy does "break" on the next line. So the stopped execution on line 12 is OK. Even the "step after xdebug_break()" is the same here. Perhaps is an issue for Xdebug. So that's OK too.
The breakpoint issue is still the same:
breakpoint_set -i 2 -t line -f file:///app/Http/Controllers/Some/Controller.php -n 13
<response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="5" status="break" reason="ok"><xdebug:message filename="file:///C:/Users/ccoll/Documents/repositories/beatrix-laravel7-restapi/app/Http/Controllers/Some/Controller.php" lineno="12"></xdebug:message></response>
Please remove this part from you launch.json
"pathMappings": {
"/app": "${workspaceFolder}/app"
}
Best, Damjan
Oh right! Silly me. Thank you so much @zobo, it's working now.
PHP version: 7.4.14 XDebug version: 3.0.2 Adapter version: 1.14.5
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):Code snippet to reproduce:
I have setup xdebug multiple times before and got them working without problems, but that was for version 2. Here's a sample snippet for testing, in the context of a simple Laravel application.