MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001566XdebugRemote Debuggingpublic2018-07-22 05:022018-07-22 05:02
Reporterleonxing 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001566: 2.7.0alpha1 cannot debug swoole extension
Descriptionthis 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 Reproducehere is an example <<simple_http.php>>
-------------------------------------------------------
<?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();
----------------------------------------------------------
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" [^] [^]
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
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2018-07-22 05:02 leonxing New Issue


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker