summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg.c
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2014-01-18 13:52:27 +0100
committerJohannes Schlüter <johannes@php.net>2014-01-18 13:52:27 +0100
commit8ff4d61f0864fbca7b2905f14de76fd400d9b3df (patch)
tree0b7513b2b81fe50e76522365d55297a53955fe72 /sapi/phpdbg/phpdbg.c
parent43a8f4f81439455d22471822bfa5f61708a2dc17 (diff)
parentc205a6f3de9d8923c2be6e16b1edc332981313a3 (diff)
downloadphp-git-8ff4d61f0864fbca7b2905f14de76fd400d9b3df.tar.gz
Merge branch 'phpdbg' into PHP-5.6
Diffstat (limited to 'sapi/phpdbg/phpdbg.c')
-rw-r--r--sapi/phpdbg/phpdbg.c66
1 files changed, 38 insertions, 28 deletions
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index deb7be6e2b..e7f841c0bc 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -653,8 +653,11 @@ static inline void phpdbg_sigint_handler(int signo) /* {{{ */
PHPDBG_G(flags) |= PHPDBG_IS_SIGNALED;
}
} else {
- PHPDBG_G(flags) |= PHPDBG_IS_QUITTING;
- zend_bailout();
+ /* we quit remote consoles on recv SIGINT */
+ if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE) {
+ PHPDBG_G(flags) |= PHPDBG_IS_QUITTING;
+ zend_bailout();
+ }
}
} /* }}} */
@@ -1198,17 +1201,17 @@ phpdbg_main:
} zend_end_try();
/* initialize from file */
+ PHPDBG_G(flags) |= PHPDBG_IS_INITIALIZING;
zend_try {
- PHPDBG_G(flags) |= PHPDBG_IS_INITIALIZING;
phpdbg_init(init_file, init_file_len, init_file_default TSRMLS_CC);
phpdbg_try_file_init(bp_tmp_file, strlen(bp_tmp_file), 0 TSRMLS_CC);
- PHPDBG_G(flags) &= ~PHPDBG_IS_INITIALIZING;
- } zend_catch {
- PHPDBG_G(flags) &= ~PHPDBG_IS_INITIALIZING;
- if (PHPDBG_G(flags) & PHPDBG_IS_QUITTING) {
- goto phpdbg_out;
- }
} zend_end_try();
+ PHPDBG_G(flags) &= ~PHPDBG_IS_INITIALIZING;
+
+ /* quit if init says so */
+ if (PHPDBG_G(flags) & PHPDBG_IS_QUITTING) {
+ goto phpdbg_out;
+ }
/* step from here, not through init */
if (step) {
@@ -1235,39 +1238,46 @@ phpdbg_interact:
phpdbg_export_breakpoints(bp_tmp_fp TSRMLS_CC);
fclose(bp_tmp_fp);
cleaning = 1;
- goto phpdbg_out;
} else {
cleaning = 0;
}
-#ifndef _WIN32
- /* remote client disconnected */
- if ((PHPDBG_G(flags) & PHPDBG_IS_DISCONNECTED)) {
- /* renegociate connections */
- phpdbg_open_sockets(
- address, listen, &server, &socket, streams);
+#ifndef _WIN32
+ if (!cleaning) {
+ /* remote client disconnected */
+ if ((PHPDBG_G(flags) & PHPDBG_IS_DISCONNECTED)) {
- /* set streams */
- if (streams[0] && streams[1]) {
- PHPDBG_G(flags) &= ~PHPDBG_IS_QUITTING;
+ if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE) {
+ /* renegociate connections */
+ phpdbg_open_sockets(
+ address, listen, &server, &socket, streams);
+
+ /* set streams */
+ if (streams[0] && streams[1]) {
+ PHPDBG_G(flags) &= ~PHPDBG_IS_QUITTING;
+ }
+
+ /* this must be forced */
+ CG(unclean_shutdown) = 0;
+ } else {
+ /* local consoles cannot disconnect, ignore EOF */
+ PHPDBG_G(flags) &= ~PHPDBG_IS_DISCONNECTED;
+ }
}
-
- /* this must be forced */
- CG(unclean_shutdown) = 0;
}
#endif
- if (PHPDBG_G(flags) & PHPDBG_IS_QUITTING) {
- goto phpdbg_out;
- }
} zend_end_try();
- } while(!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING));
+ } while(!cleaning && !(PHPDBG_G(flags) & PHPDBG_IS_QUITTING));
/* this must be forced */
CG(unclean_shutdown) = 0;
+ /* this is just helpful */
+ PG(report_memleaks) = 0;
+
phpdbg_out:
#ifndef _WIN32
- if (PHPDBG_G(flags) & PHPDBG_IS_DISCONNECTED) {
+ if ((PHPDBG_G(flags) & PHPDBG_IS_DISCONNECTED)) {
PHPDBG_G(flags) &= ~PHPDBG_IS_DISCONNECTED;
goto phpdbg_interact;
}
@@ -1316,7 +1326,7 @@ phpdbg_out:
if (cleaning || remote) {
goto phpdbg_main;
}
-
+
#ifdef ZTS
/* bugggy */
/* tsrm_shutdown(); */