NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Is debugged application running on its own thread?


Joined: 11 Jun 2011
Posts: 3
Reply with quote
I think it's important for debugged application to have its own thread, otherwise Phped isn't going to get user input when the code has infinite loop. I haven't actually tried this because it's pretty scary.
View user's profileFind all posts by renairenairenaiSend private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
PhpED is a multi-threaded application (as are probably nearly all Windows applications) and the debugged 'application' is running in a separate process (eg NuSphere Server or Apache, and PHP itself which can run as an additional process).

However, that still does not mean you can 'break' into debugged PHP code that is running in an infinite loop. If you turn off PHP script timeouts and cause an infinite loop in your PHP code, you might have to kill the host process for PHP (eg Server or the Apache httpd process). PhpED might appear to hang while the code is looping, but killing the PHP host process normally allows you to regain control of PhpED.

I don't use the NuSphere Server, but I seem to remember it has a fixed timeout of some sort. I also don't use PHP with IIS, but you can probably place the web server in its own IIS application pool and recycling the pool will reset the corresponding process.
View user's profileFind all posts by plugnplaySend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8335
Reply with quote
> you can 'break' into debugged PHP code that is running in an infinite loop

in fact you can. That's what PAUSE button for.
It breaks, not so fast, but it works and breaks infinite loops.

what it can't break is such thing as hanged up connections, long SQL query, and stalled read/write operation -- whereever no loops in php happen.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
I've just entered this code and debugged the page:

Code:
  while (true) {
    $x=$x+1;
  }


I can see the httpd process looping away, but in PhpED the Pause button is disabled.

Ahh, I see. It looks like I had to have at least one breakpoint actually happen before the Pause button become enabled.

Is there a way of getting Pause to work without having a breakpoint?
View user's profileFind all posts by plugnplaySend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8335
Reply with quote
You don't need any breakpoints to have the Pause working. What you need is your code running with debugger. If you don't run with debugger, the debugger has nothing to do with your code execution flow.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
If I click the Run in debugger (F9) button, the browser appears, the code runs and the pause button stays disabled.

If I have a break point get executed before or within the loop, the pause button is disabled, execution stops, then when I continue execution the pause buttons enables. I can then click the pause button.
View user's profileFind all posts by plugnplaySend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8335
Reply with quote
if it is not enabled, means that the code finished. Check View->Debug windows->Debug Session
If it is empty, there is no debug session running with this IDE and therefore Pause button has nothing to pause.
Also this button is inactive when the debugger is waiting for your input such as Step-In, Continue, etc, so it's effectively paused and it can't be paused more than this.

Anyway I'm telling you how it's supposed to work and actually works for me. If you experienced something else and you think it's a bug, submit a ticket here: http://www.nusphere.com/contact_us/

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8335
Reply with quote
update:
regarding status of the buttons while running scripts with and without breakpoints. Please check View->Debug Windows->Debug Sessions. It may happen that debug session was started but didn't come in to foreground (remain in-active). Try to double-click it.

update:
the situation with inability to Pause or correctly Stop endless or long loops is fixed phped v6 6029/dbg 4.0.4
See changelog changes60.htm

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Is debugged application running on its own thread?
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic