phptools-docs icon indicating copy to clipboard operation
phptools-docs copied to clipboard

XDebug: A way to ignore all subsequent requests

Open tanzanite777 opened this issue 1 year ago • 4 comments

Type: Feature Request

Encountered a situation where currently exposed XDebug interface makes it impossible to use.

Situation: code i debug, using breakpoints, executes other php scripts that touch the same code i am debugging and thous executions have a time limit i cannot affect (not that manually adding thread id filters would be in any way a sane workaround in my case - too many breakpoints and too many executions and i am trying to pin down a race condition that happens only around 25% of full runs x_x).

Consequently - debugging via XDebug is completely impossible.

Proposal: add a toggle in call stack window to "do not listen to new requests".

Extension version: 1.53.16379 VS Code version: Code 1.95.3 (f1a4fb101478ce6ec82fe9627c43efbf9e98c813, 2024-11-13T14:50:04.152Z) OS version: Windows_NT x64 10.0.19045 Modes:

tanzanite777 avatar Nov 28 '24 16:11 tanzanite777

Thank you for your suggestion! The situation you're describing, with multiple scripts executing and interfering with debugging, is definitely challenging. While there's currently no built-in toggle to "stop listening to new requests", here are some approaches you can try in the meantime:

  1. maxConnections Setting: In your launch.json, set maxConnections to limit the number of simultaneous debug sessions:
"maxConnections": 1

This will prevent XDebug from handling multiple connections at once and help focus on a single session.

  1. Trigger-based Debugging: Set xdebug.start_with_request=trigger in your php.ini, and use XDEBUG_SESSION_START=session_name in your URLs or requests to control when debugging starts. This ensures debugging only occurs when explicitly triggered, avoiding unwanted interruptions.

While we do not currently filter by idekey (session_name), we could consider adding this feature in the future to further isolate debugging sessions.

Miloslav avatar Nov 29 '24 15:11 Miloslav

The second workaround is unfortunately unusable in my case, but the first one should work (*) - will try that. Thanks! :D

*) don't need in my current case - fingers crossed - , but i hope that changes in the config take effect immediately (ie. can change at any time in the middle of debug session) vs launch time only.

tanzanite777 avatar Dec 02 '24 13:12 tanzanite777

Great, Please let me know if that works for you.

Changes in launch.json only take effect for new debug sessions. To have immediate effect(for some settings, not all), we would have to overcome the VS Code API and do it ourselves.

Miloslav avatar Dec 06 '24 14:12 Miloslav

#927

gumbubbli953-max avatar Oct 13 '25 22:10 gumbubbli953-max