-
Notifications
You must be signed in to change notification settings - Fork 370
Draft: XDebug support via dlopen #831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
73418e0 to
246cd40
Compare
|
This PR is now much simpler and xdebug functions work! However, connecting to a step debugger doesn't work yet. It seems like xdebug isn't even trying to open a remote socket here: |
680cd19 to
2e376d2
Compare
|
This is interesting and may enable connecting xdebug to browser devtools: https://github.com/microsoft/debug-adapter-protocol/blob/main/overview.md There's probably already an implementation of xdebug -> debug adapter protocol built for some VS code PHP debugging extension. |
|
Superseded by #2248 |
…#2326) ## Motivation for the change This is a pull request to dynamically load Xdebug in `@php-wasm` Node ASYNCIFY. [Roadmap](#2315) ## Related issues and pull requests Relative to XDebug - #2248 - #314 - #2288 - #831 Relative to dynamic library - #89 - #2290 - #673 ## Implementation details Additional steps for asyncify are implemented : - new nx commands - new `WITH_JSPI` and `WITH_DEBUG` arguments in Xdebug Dockerfile - new `xdebug.so` files are compiled and dynamically loaded ## Zend extensions and PHP versions > [!IMPORTANT] > Each version of PHP requires its own version of Xdebug because each version of PHP has a specific Zend Engine API version. Consequently, each version of Xdebug is designed to be compatible with a particular Zend Engine API version. Example using PHP `8.2` with Xdebug `8.3` : ``` Xdebug requires Zend Engine API version 420230831. The Zend Engine API version 420220829 which is installed, is outdated. ``` ## Testing Instructions Two files are needed. A PHP file to test the step debugger. A JS file to run PHP 8.4 node ASYNCIFY. `php/xdebug.php` ```php <?php $test = 42; // Set a breakpoint on this line echo "Hello Xdebug World\n"; ``` `scripts/node.js` ```javascript import { PHP } from '@php-wasm/universal'; import { loadNodeRuntime } from '@php-wasm/node'; const php = new PHP( await loadNodeRuntime( '8.4', { withXdebug : true } ) ); await php.runStream( { scriptPath : `php/xdebug.php` } ); ``` To achieve the test, you first need to start debugging [ with F5 or Run > Start debugging in VSCode ], then run : ```bash node scripts/node.js ```
What is this PR doing?
Explores support for dynamic loading of PHP extensions.
Supersedes #673, consult that PR for the progress history and helpful comments.
Related to #314, #655, #89
Minimal dlopen example without PHP involved.
Testing instructions
Clone this branch to a directory with path
/Users/cloudnik/www/Automattic/core/plugins/playground-2/wordpress-playground. It's not great, I know. I want to remove the explicit path dependency soon.Then, create a
/usr/local/etc/php.inifile with the following contents:Finally, run:
Here's what you should see:
Remaining work
trunk. This PR ships many stale files.