View Issue Details

IDProjectCategoryView StatusLast Update
0001566XdebugStep Debuggingpublic2021-03-17 08:43
Reporterleonxing Assigned Toderick  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionwon't fix 
Summary0001566: Add support for debugging with Swoole
Description

this fix(2.7.0alpha1) https://bugs.xdebug.org/bug_view_page.php?bug_id=00000938
brings other bug

https://github.com/swoole/swoole-src [^]
swoole http svr cannot break with xdebug 2.7.0alpha1(in child process)
bug xdebug 2.6.0 is ok(both in parent and child processes)

Steps To Reproduce

here is an example <<simple_http.php>>
<pre>
<?php
xdebug_break();
$http = new swoole_http_server('0.0.0.0', 9502); //parent process can break with both 2.6.0&2.7.0alpha
$conf = [
'pid_file' => DIR . '/server.pid',
'worker_num' => 1,
'max_request' => 10,
'daemonize' => 0,
];
$http->set($conf);

$http->on('request', function ($request, $response) {
xdebug_break(); //child process cannot break with 2.7.0alpha, but 2.6.0 is OK
$response->header('Content-Type', 'text/html; charset=utf-8');
$response->end('<h1>Hello Swoole. #' . rand(1000, 9999) . '</h1>');
});

$http->start();
</pre>

I do remote debug with phpstorm

  1. phpstorm "Run/Debug Configurations",add "PHP Remote Debug",give it an arbitrary name,no other settings in this dialog

  2. phpstorm
    File | Settings | Languages & Frameworks | PHP | Servers
    Name: simple_http(should be the same with serverName in PHP_IDE_CONFIG in step 3)
    Host: your server ip
    Port: your server port(9502 in this example)
    Debugger: xdebug
    select "Use path mappings"
    and config the path mapping

  3. before start(tell phpstorm to use which server configuration)
    export PHP_IDE_CONFIG="serverName=simple_http"

  4. start cmd
    php -dxdebug.remote_enable=1 -dxdebug.remote_mode=jit -dxdebug.remote_port=9000 -dxdebug.remote_host=10.25.161.110 -dxdebug.remote_autostart=1 simple_http.php

it breaks in first xdebug_break()

but when i send
"curl http://127.0.0.1:9502&quot; [^]
xdebug 2.6.0 can break in second xdebug_break()
xdebug 2.7.0alpha cannot break

TagsNo tags attached.
Operating System
PHP Version7.2.0-7.2.4

Activities

derick

2021-03-17 08:43

administrator   ~0005723

Xdebug does not support Swoole, as Swoole uses internal structures that are different to PHP's.

Issue History

Date Modified Username Field Change
2018-07-22 04:02 leonxing New Issue
2020-03-12 16:13 derick Target Version => 3.0dev
2020-03-12 16:13 derick Summary 2.7.0alpha1 cannot debug swoole extension => Add support for debugging with Swoole
2020-03-12 16:13 derick Steps to Reproduce Updated
2020-03-12 16:33 derick Category Remote Debugging => Step Debugging
2020-09-23 17:00 derick Target Version 3.0dev =>
2021-03-17 08:43 derick Assigned To => derick
2021-03-17 08:43 derick Status new => resolved
2021-03-17 08:43 derick Resolution open => won't fix
2021-03-17 08:43 derick Note Added: 0005723