Fix Xdebug disconnecting after php finished if multiple connections are allowed
Needs ReviewPublic

Authored by wcancino on Wed, Jan 9, 2:16 PM.

Details

Reviewers
brauch
pprkut
Summary
  • If we launch a php xdebug process (browser) multiple connections are supported by default. If the debugged script finishes, the debug session do not keep

listening for additional connections.

  • Various code fixes and some refactorization.
Test Plan
  • Launch a php script for debug (with some breakpoint defined).
  • When script finishes, reload the url(on the browser), php debugger will accept the connection and start debugging the script

Diff Detail

Repository
R68 KDevelop XDebug Support
Lint
Lint Skipped
Unit
Unit Tests Skipped
wcancino created this revision.Wed, Jan 9, 2:16 PM
Restricted Application added a project: KDevelop. · View Herald TranscriptWed, Jan 9, 2:16 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald Transcript
wcancino requested review of this revision.Wed, Jan 9, 2:16 PM
brauch added a subscriber: pprkut.Wed, Jan 9, 2:33 PM

@pprkut can you look at this? I have not used PHP or its tooling for more than 10 years ...

pprkut added a comment.Wed, Jan 9, 7:46 PM

I'm afraid I don't know much about this either :-/
The fact that the unit tests are currently completely broken doesn't help. I did try them with and without this change and what I *can* say is that it's neither worse nor better.

Since this fixes an actual issue in code that seems to be unit tested afaics, I think adding unit tests would be appreciated. But that would require fixing the current ones first :-/

I'm willing to give this the benefit of the doubt, but wonder if taking this without tests will make it harder to eventually fix them.

Well, it is true that this plugins dates from the Kdev4 days, and it is unmaintained. Anyways, with these patch, I correct the plugin to behave as described on

http://nikosams.blogspot.com/2010/02/kdevelop-xdebug-php-debugger.html (section 2)

It is also correct some crashes, due to the fact (in my opinion) that this plugins treat to map the "connection" state to the "session state" and it doesn't map

very well. The way kdevelop debugger infrastructure manages the states make that when a debug session passes to 'NotStartedState' the 'DebugLaunch/Continue'

button (in 'Debug Launch' mode) is clickable and it immediately invokes to the run method. In the Xdebug case, a connection is active while a program is running but when the

script stops, the connection stopped as well. At this moment, it is logical the debug session ends at the same time, but Xdebug plugin allows to continue

to "listen" for future incoming scripts, so session is still alive and passed to NotStartedState. Doing so, the aforementioned Debug Launch button activates

and if it is pressed invokes to the 'run' method, but there is no script to debug ( nor connection ) and that causes troubles. This patch avoids it, and as well

fixes some corner cases, where if the launch of the debugger fails, it ended properly the session (otherwhise, session remains alive in 'notstartedstate' and debug launch button activates )

I try another debugger (python and c++) and in both cases, I was not able to see the 'Debug launch' button active (just 'Continue'), that let me curious about the

intention of that aforementioned 'Debug launch'.

Moreover, I do not see the tests cases so broken, I will try to find time to fix the multiple connection test.

wcancino updated this revision to Diff 49799.Fri, Jan 18, 10:11 AM
  • Fix testcase