kdev-xdebug commit breaks debugging web site

Arjan van der Veen avdveen at palanthir.nl
Fri Dec 21 12:48:40 GMT 2018


Hi Alexander,

I have an OpenSuse Tumbleweed install on which I followed this guide to compile kdevelop: https://community.kde.org/KDevelop/HowToCompile_v5


I did basically the following: 

kdesrc-build kdevelop-pg-qt kdevelop
kdesrc-build kdev-php
kdesrc-build kdev-executebrowser
kdesrc-build kdev-xdebug

If you install kdev-python it breaks the debugging because then kdevelop only wants to have script launches for python3. I did not have time yet to investigate that bug. So I just disabled kdev-python.

I also tried this procedure on Fedora 29 last week, but gave up since it took a long time to figure out which -devel packages to install to prevent kdesrc-build to build the entire KDE environment instead of just compiling the packages I  wanted to build.

After making a run launch configuration for a script (see attached screenshot and forget my local script names, I was too lazy to blur them)


I just start the debugger and can debug the script. 

In /etc/php7/conf.d/xdebug.ini I added the following:
[xdebug]
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

For a website debugging I use the kdev-executebrowser plugin and that works also, but only for the first request, then the QAbstractSocket::RemoteHostClosedError occurs and the debugger stops. My change in the source code fixes that also. My website has the following configured in the nginx config that redirects every request to the index.php of the website. The index.php then handles the request according to a MVC code pattern. So for me it's simple to just set the debugger listening on requests to index.php and each request that comes in, I can debug. This is the redirect I configured in nginx for the requests:

        location /<local dev website url> {
            try_files $uri $uri/vcrs $uri/vcrs/ /<local dev website path on disk as child folder of the nginx root>/index.php?$args;
        }

I have no problems with the breakpoints. Are you sure you have the xdebug connection? Basically what happens with xdebug is that for each php script that starts PHP tries to connect to the debugger host and portname. If that doesn't work, the script is executed without debugging. When the connection from the PHP to the kdevelop is made, kdevelop is responsible for pausing on a breakpoint.

Arjan


On 21 Dec 2018, at 10:19, Alexander Zhigalin <alexander at zhigalin.tk <mailto:alexander at zhigalin.tk> > wrote:

Hello Arjan!
 O_0, you managed to get it working?
Which version of KDevelop do you have?
May you please share how you have configured it?
I'm successfully connecting to xdebug, starting and stopping works but breakpoints are not submitted and thus are not working...
I will indeed look into the multiple requests issue if it starts working at least for one request ;)
 18.12.2018, 23:18, "Arjan van der Veen" <avdveen at palanthir.nl <mailto:avdveen at palanthir.nl> >:
Hi all,
 Today I spent some time figuring out why debugging a PHP website did not worked as expected: when starting a debugging session on KDevelop 5.3.0 and 5.3.40, only the first HTTP call can be used for debugging. After the PHP script is finished, the debugger stops. This is not quite workable for debugging a web site.
When I looked into the commits to the kdev-xdebug on Github, I noticed the commit linked to this review: https://phabricator.kde.org/D9034
 If I reverse this commit by commenting out the added line 126 containing "&& m_server->hasPendingConnections()", the web site debugging works again as expected. The debugger keeps listening on port 9000 and following requests can also be debugged.
 I am not saying the commit discussed here is wrong, because I still get a QAbstractSocket::RemoteHostClosedError after each HTTP request to the PHP in my terminal. I still think though this change needs to be reviewed again since it breaks the debugging for multiple HTTP requests.
 I hope someone can look into this, I needed I am happy to provide further details.
 Kind regards,
  Arjan van der Veen
  -- 
Alexander Zhigalin — Developer Operations
Consulenze & servizi informatici
———————————————————————————————————————————
Email: alexander at zhigalin.tk
Cell: +39 380 593 0050
Tel:  +39 019 294 0240
Fax:  +39 019 924 1167
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20181221/2e6008ac/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-1.tiff
Type: image/tiff
Size: 132052 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20181221/2e6008ac/attachment.tiff>


More information about the KDevelop mailing list