Debugger doesn't brake whatever I do

PHP Tools [?] extends Visual Studio with set of advanced features to work more efficiently with PHP code.

Debugger doesn't brake whatever I do

Postby WaldemarHasz » March 21st, 2018, 2:48 pm

Hi

As before I'm getting lots and lots of:

Auto-attach to process '[14944] php_remote.exe' on machine 'WALDEMAR-PC' succeeded.
The program '[14944] php_remote.exe' has exited with code -1 (0xffffffff).
Auto-attach to process '[21088] php_remote.exe' on machine 'WALDEMAR-PC' succeeded.
The program '[21088] php_remote.exe' has exited with code -1 (0xffffffff).
Auto-attach to process '[20760] php_remote.exe' on machine 'WALDEMAR-PC' succeeded.
The program '[20760] php_remote.exe' has exited with code -1 (0xffffffff).

But the debugger doesn't brake.

I've reinstalled the tools in VC2015 and VC2017 to last version and nothing works.
Before if I waited long enough the debugger started in half a minute (then it worked instantly), but now nothing.

Also when I execute the command the code gets executed as I see the results in the database, but why the Tools don't start is a mistery.

Help!

Br
Waldemar

------------------------------------------------------------------------------------
XDebug Remote Log

Log opened at 2018-03-21 14:47:19
I: Connecting to configured address/port: 192.168.2.1:9001.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/portal/public/manager/index.php" language="PHP" protocol_version="1.0" appid="1659" idekey="php-vs"><engine version="2.2.7"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2015 by Derick Rethans]]></copyright></init>

<- breakpoint_set -i x0-10000 -t exception -x "Fatal error"
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="x0-10000" id="16590141"></response>

<- breakpoint_set -i x1-10001 -t exception -x "Parse error"
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="x1-10001" id="16590142"></response>

<- breakpoint_set -i x2-10002 -t exception -x "Unknown error"
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="x2-10002" id="16590143"></response>

<- feature_get -i 3 -n max_children
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="3" feature_name="max_children" supported="1"><![CDATA[32]]></response>

<- step_into -i 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="4" status="break" reason="ok"><xdebug:message filename="file:///var/www/portal/public/manager/index.php" lineno="6"></xdebug:message></response>

-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>

Log closed at 2018-03-21 14:47:20

Log opened at 2018-03-21 14:47:20
I: Connecting to configured address/port: 192.168.2.1:9001.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/portal/public/manager/index.php" language="PHP" protocol_version="1.0" appid="1652" idekey="php-vs"><engine version="2.2.7"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2015 by Derick Rethans]]></copyright></init>

<- breakpoint_set -i x0-10000 -t exception -x "Fatal error"
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="x0-10000" id="16520152"></response>

<- breakpoint_set -i x1-10001 -t exception -x "Parse error"
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="x1-10001" id="16520153"></response>

<- breakpoint_set -i x2-10002 -t exception -x "Unknown error"
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="x2-10002" id="16520154"></response>

<- feature_get -i 3 -n max_children
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="3" feature_name="max_children" supported="1"><![CDATA[32]]></response>

<- step_into -i 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="4" status="break" reason="ok"><xdebug:message filename="file:///var/www/portal/public/manager/index.php" lineno="6"></xdebug:message></response>

-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>

Log closed at 2018-03-21 14:47:26
WaldemarHasz
 
Posts: 22
Joined: December 3rd, 2017, 9:14 pm

Re: Debugger doesn't brake whatever I do

Postby Miloslav Beno » March 22nd, 2018, 9:25 am

Hi Waldemar,

Thank you for the post.

From the log I can see Xdebug sucesfully connected to PHP Tools and PHP Tools is comunicating, but it didn't sent any breakpoints ( where there any? )

I can also see Xdebug you are using is 2.2.7 which is quite old. Please update to 2.5. There is 2.6 already but we still need to test it.

Also check output pane in Visual Studio to see if the path mapping is established correctly.

Thank you,
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm

Re: Debugger doesn't brake whatever I do

Postby WaldemarHasz » March 22nd, 2018, 12:53 pm

Hi Miroslav

1. The issue with the old XDebug is that I'm on Centos 6.9 with old PHP 5.3.29.
I can try to update but don't know if it will work (will try next week).

2. Yeah there were breakpoints... maybe not just in the logs that I've send... attached a clean XDebug log.

Currently set in VS is one breakpoint at 'RecorderController.php, line 25 character 3'.
This one is the first line in constructor that executes any recorder commands...
I've executed two as a test and breakpoint was not fired.

Is there something defined in the xdebug.log that shows what is wrong?

BrW
You do not have the required permissions to view the files attached to this post.
WaldemarHasz
 
Posts: 22
Joined: December 3rd, 2017, 9:14 pm

Re: Debugger doesn't brake whatever I do

Postby WaldemarHasz » March 22nd, 2018, 12:55 pm

Just to be complete... the debug system is a Centos 6.9 running in VM and I'm debugging it on my Wins 10 machined.

BrW

;--------------------------------------------------------------------------------------------------------
; XDebug
;
; Notice:
; Port 9001 is used because nginx server uses port 9000 for FastCGI.
;--------------------------------------------------------------------------------------------------------
zend_extension=/usr/lib64/php/20090626/xdebug.so
xdebug.remote_log="/tmp/xdebug.log"
xdebug.profiler_enable = 0
xdebug.remote_enable=1
xdebug.remote_host = 192.168.2.1
xdebug.remote_port = 9001
xdebug.remote_autostart = 1
xdebug.remote_mode = req
xdebug.idekey="php-vs"
WaldemarHasz
 
Posts: 22
Joined: December 3rd, 2017, 9:14 pm

Re: Debugger doesn't brake whatever I do

Postby Miloslav Beno » March 26th, 2018, 8:38 am

Hi Waldemar,

I think the settings is fine. The connection gets established, PHP Tools communicates as expected. Just Xdebug and PHP doesn't stop on the set breakpoin.

I would suggest:
- to update as we do not support and even test with this PHP and this Xdebug version.
- make sure the breakpoint is not on some unsupported location https://docs.devsense.com/debugging/breakpoints#known-issues
- Is path mapping correct? Is this correct file:///var/www/portal/application/manager/controllers/RecorderController.php ?

Thanks!
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm

Re: Debugger doesn't brake whatever I do

Postby DanTalash » March 27th, 2018, 8:14 pm

You can try to trigger the breakpoints manually by calling xdebug_break() from your code.
DanTalash
 
Posts: 23
Joined: November 25th, 2015, 6:19 pm

Re: Debugger doesn't brake whatever I do

Postby Miloslav Beno » April 3rd, 2018, 12:57 pm

@Dan Good idea, Thanks!
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm

Re: Debugger doesn't brake whatever I do

Postby DanTalash » April 3rd, 2018, 5:35 pm

I would also mention that if you're going to be using xdebug_break to debug, you may find yourself in the situation of littering calls to xdebug_break all over your code. If you forget to disable/remove them and the code runs on a PHP instance that doesn't have xdebug loaded then you'll receive an exception.

In these cases you may find it useful to check at boot time for xdebug_break being available, and if it isn't, defining it as a NOOP, or a log message indicating you forgot a breakpoint.

Ideally you would fix the actual debugger, as using this function gets old fast.
DanTalash
 
Posts: 23
Joined: November 25th, 2015, 6:19 pm

Re: Debugger doesn't brake whatever I do

Postby WaldemarHasz » April 4th, 2018, 3:06 pm

Hi guys

I'm back at the project.. so here are the answers.
---------------------------------------------------------------------------------------------
1. can't update XDebug as I'm forced to use PHP 5.3 and XDebug 2.2.7 is the last that supports PHP 5.3.

---------------------------------------------------------------------------------------------
2. xdebug_break(); doesn't trigger a break point.

Now I've found a small issue.. if you look at soure.png image you see that xdebug_break() is at line 83 where XDebug log defines it at line 87. But that is a valid next line, so this could be ok.

Log opened at 2018-04-04 15:01:50
I: Connecting to configured address/port: 192.168.2.1:9001.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/portal/tools/iptv" language="PHP" protocol_version="1.0" appid="63534" idekey="php-vs"><engine version="2.2.7"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2015 by Derick Rethans]]></copyright></init>

<- breakpoint_set -i x0-10000 -t exception -x "Fatal error"
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="x0-10000" id="635340001"></response>

<- breakpoint_set -i x1-10001 -t exception -x "Parse error"
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="x1-10001" id="635340002"></response>

<- breakpoint_set -i x2-10002 -t exception -x "Unknown error"
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="x2-10002" id="635340003"></response>

<- feature_get -i 3 -n max_children
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="3" feature_name="max_children" supported="1"><![CDATA[32]]></response>

<- step_into -i 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="4" status="break" reason="ok"><xdebug:message filename="file:///var/www/portal/tools/iptv" lineno="4"></xdebug:message></response>

-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="break" reason="ok"><xdebug:message filename="file:///var/www/portal/library/Iptv/Tools/Console/Command/Cron/Minute.php" lineno="87"></xdebug:message></response>

---------------------------------------------------------------------------------------------
3. path mappings are:
Mapping dir "E:\Podjetja\Nevron\Hospitality Interface\Design\PHP - VS2017\Iptv\Source" to "file:///var/www/portal/library/Iptv"
Mapping dir "E:\Podjetja\Nevron\Hospitality Interface\Design\PHP - VS2017\Zend\Source" to "file:///opt/ZendFramework-1.12.17/library/Zend"
Mapping dir "E:\Podjetja\Nevron\Hospitality Interface\Design\PHP - VS2017\Doctrine\Source" to "file:///var/www/portal/library/Doctrine"
Mapping dir "E:\Podjetja\Nevron\Hospitality Interface\Design\PHP - VS2017\Manager\Source" to "file:///var/www/portal/application"

So the shared folders are linked to the Windows disk with:
mklink /d "E:\Podjetja\Nevron\Hospitality Interface\Design\PHP - VS2017\Iptv\Source" "\\192.168.200.254\Root\var\www\portal\library\Iptv"
You can see the folders in mappings.png.

The reason for this is that PHP Project doesn't work if I use shared path as a file path (it crashed or it doesn't load files or something... forgot exactly what it was).


Now the question here is which component doesn't fire the breakpoint? Is there a log I can inspect or TCP communication or anything which could tell me what is wrong?

Waldemar

Side request: Can you please auto expand mappings table width to the width of the panel in the same way as Runtime listbox. See what I mean in expandWidth.png.
You do not have the required permissions to view the files attached to this post.
WaldemarHasz
 
Posts: 22
Joined: December 3rd, 2017, 9:14 pm

Re: Debugger doesn't brake whatever I do

Postby Miloslav Beno » April 6th, 2018, 9:10 am

Hi Waldemar,

Thank you for such a detailed infomration. Let me setup similiar environment and test it.

From the log I can see xdebug did fire a break of the program. The line is fine, because xdebug_break doesn't break on itself but after it's executed, so the program should be broken in the next statement.

What's strange is it didn't broke you in the VS. I have to investigate more, currently I just suspect some issue with mapping. You can do that to if it's not a big hassle. Remove spaces and - character from the path. Or it can be related to mlink, but that's just guessing right now.

About PHP 5.3 and xdebug. I understand you cannot update it on production, but would it be possible just to try so we can rule that out?

Also is the first screenshot after it was supposed to break? I can see in the VS title there is running but not Debugging, so VS just thinks program is not broken but it runs.

About the width of the path mapping, that shouldn't be an issue, we will look at it.

Thank you,
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm

Next

Return to PHP Tools

Who is online

Users browsing this forum: No registered users and 46 guests

cron

User Control Panel

Login

Who is online

In total there are 46 users online :: 0 registered, 0 hidden and 46 guests (based on users active over the past 5 minutes)
Most users ever online was 256 on March 28th, 2024, 9:42 am

Users browsing this forum: No registered users and 46 guests