pthreads icon indicating copy to clipboard operation
pthreads copied to clipboard

Debug support

Open JesusTheHun opened this issue 9 years ago • 11 comments

Hello @krakjoe ,

Is there any chance that phpdbg supports MT debug ? Right now xdebug is just not capable of debugging anything while your extension is loaded. It just hangup.

I've seen your comment in https://github.com/krakjoe/pthreads/issues/69, but there is some uncertainty about what "the profiler in your repo".

JesusTheHun avatar Aug 04 '15 08:08 JesusTheHun

It's on my list ... but my list is so long, that I worry about deforestation ...

Sorry, I can't do better than that right now ...

krakjoe avatar Aug 20 '15 10:08 krakjoe

I've used pthreads with xdebug without issues so far. I can set breakpoints and step though code. I haven't seen the memory consumption problem mentioned in #69 .

PHP 7.1.0-dev (cli) (built: Dec 3 2015 22:00:02) ( ZTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.1.0-dev, Copyright (c) 1998-2015 Zend Technologies with Xdebug v2.4.0rc2-dev, Copyright (c) 2002-2015, by Derick Rethans

RyanNerd avatar Dec 06 '15 07:12 RyanNerd

Excellent ...

Actually, there are changes in v3 that should mean xdebug can handle pthreads just as well as it can handle any other multi-threaded SAPI.

That's not a guarantee that it will work, it's totally untested (by me).

The problem will come when there appears to be bugs in pthreads and or xdebug that effect your ability to use xdebug. pthreads and xdebug are both rather complicated, I don't know that much about xdebug and doubt if Derick knows that much about pthreads.

I have tried to become familiar with xdebug internals in recent months, but not super confident.

I guess we'll cross that bridge when we come to it ...

It would be nice to get some more feedback from others so I can close this issue ...

krakjoe avatar Dec 06 '15 07:12 krakjoe

I'm using Xdebug v2.4.0rc2-dev on PHP 7.1.0-dev
I've been spot testing Xdebug for Derick being an early adopter living on the bleeding edge. I've done MT in C# and this is my first attempt in PHP to wrap my head around pthreads. Just getting PHP compiled from source with the right config switches was challenging enough.

Anyway, do you have a specific methodology for test cases? Debuggers are sometimes difficult to automate or script behavior.

RyanNerd avatar Dec 06 '15 09:12 RyanNerd

I've not had much time to think about it ... about an hour ;)

It's going to be difficult to automate testing, I've had a dig around ...

Another bridge we'll cross when we come to it, I guess ...

krakjoe avatar Dec 06 '15 10:12 krakjoe

:+1: for this.

Actually, there are changes in v3 that should mean xdebug can handle pthreads just as well as it can handle any other multi-threaded SAPI.

Scott

smolinari avatar Mar 29 '16 15:03 smolinari

Cool beans. What is the branch name for this and I'll give it a spin...

On Tue, Mar 29, 2016 at 9:05 AM, Scott [email protected] wrote:

[image: :+1:] for this.

Actually, there are changes in v3 that should mean xdebug can handle pthreads just as well as it can handle any other multi-threaded SAPI.

Scott

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/krakjoe/pthreads/issues/467#issuecomment-202943549

RyanNerd avatar Mar 29 '16 15:03 RyanNerd

@RyanNerd - I think, but am not certain, that master is the branch for V3. You certainly could check out the 3.1.6 tag for the latest V3 version. https://github.com/krakjoe/pthreads/tree/v3.1.6

Scott

smolinari avatar Mar 29 '16 15:03 smolinari

Initial run of HelloWorld (with polyfill option - but using pthreads.so) via PHP 7.1-dev with xdebug v2.4.1-dev works nicely. This is using the bleeding edge of pthreads, xdebug and php :) Great job!!!

Wow. Formerly xdebug was thoroughly confused with pthreads (I can't remember what version I was using) -- now it looks like it works very well with the small testing I've done so far. Xdebug is not easy to automate in a .phpt file, but I'll see what I can do. I'll contact Derick Rethans and see if he has any advice to automate xdebug testing for this.

On Tue, Mar 29, 2016 at 9:11 AM, Scott [email protected] wrote:

@RyanNerd https://github.com/RyanNerd - I think, but am not certain, that master is the branch for V3. You certainly could check out the 3.1.6 tag for the latest V3 version. https://github.com/krakjoe/pthreads/tree/v3.1.6

Scott

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/krakjoe/pthreads/issues/467#issuecomment-202946669

RyanNerd avatar Mar 29 '16 16:03 RyanNerd

Hello,

I know this post is rather old but I haven't found any other link that clearly states the status of php pthread debugging.

The reason I'm asking is that I've been successful compiling php with ZTS and pthread on an Ubuntu 14.04 along with xdebug 2.6.

All in all, it is working very well!

Working from phpstorm IDE, I can hit breakpoints in the main thread's code and step forward, but breakpoints in a thread's code itself never stop the IDE and the program is finishing as if no breakpoints were set.

So before asking IntelliJ... just wanted to know what's the official status of debugging php threads and how you guys did setup xdebug to make it work.

Thanks!

nbsoftware avatar Apr 17 '18 14:04 nbsoftware

@nbsoftware as far as I can remember, you need to config IntelliJ accept multiple debug connections, so the thread's code can connect to your IDE.

edit : just seen the date of your post, I don't know why i've been notified... weird but at least new comers can see the answser.

JesusTheHun avatar Jan 02 '19 09:01 JesusTheHun