1
0
mirror of https://github.com/php/php-src.git synced 2026-04-30 03:33:17 +02:00

- Added support to break when signaling ctrl+c

This commit is contained in:
Felipe Pena
2013-11-20 17:16:07 -02:00
parent 9ba9abfa2a
commit c3f43f0a6e
3 changed files with 21 additions and 17 deletions
+7 -14
View File
@@ -17,6 +17,9 @@
+----------------------------------------------------------------------+
*/
#ifndef ZEND_SIGNALS
# include <signal.h>
#endif
#include "phpdbg.h"
#include "phpdbg_prompt.h"
#include "phpdbg_bp.h"
@@ -431,13 +434,6 @@ static void phpdbg_welcome(zend_bool cleaning TSRMLS_DC) /* {{{ */
}
} /* }}} */
void phpdbg_sigint_handler(int signo)
{
TSRMLS_FETCH();
PHPDBG_G(flags) |= PHPDBG_IS_SIGNALED;
phpdbg_notice("here");
}
int main(int argc, char **argv) /* {{{ */
{
sapi_module_struct *phpdbg = &phpdbg_sapi_module;
@@ -610,18 +606,15 @@ phpdbg_main:
phpdbg->ini_entries = ini_entries;
if (phpdbg->startup(phpdbg) == SUCCESS) {
#ifdef ZEND_SIGNALS
zend_signal(SIGINT, phpdbg_sigint_handler);
#else
signal(SIGINT, phpdbg_sigint_handler);
#endif
zend_activate(TSRMLS_C);
#ifdef ZEND_SIGNALS
zend_try {
zend_signals_activate(TSRMLS_C);
zend_signal_activate(TSRMLS_C);
zend_signal(SIGINT, phpdbg_sigint_handler TSRMLS_CC);
} zend_end_try();
#else
signal(SIGINT, phpdbg_sigint_handler);
#endif
PG(modules_activated) = 0;
+13
View File
@@ -1087,6 +1087,12 @@ void phpdbg_clean(zend_bool full TSRMLS_DC) /* {{{ */
}
} /* }}} */
void phpdbg_sigint_handler(int signo)
{
TSRMLS_FETCH();
PHPDBG_G(flags) |= PHPDBG_IS_SIGNALED;
}
static inline zend_execute_data *phpdbg_create_execute_data(zend_op_array *op_array, zend_bool nested TSRMLS_DC) /* {{{ */
{
#if PHP_VERSION_ID >= 50500
@@ -1301,6 +1307,13 @@ zend_vm_enter:
}
next:
if (PHPDBG_G(flags) & PHPDBG_IS_SIGNALED) {
phpdbg_writeln(EMPTY);
phpdbg_notice("Program received signal SIGINT");
PHPDBG_G(flags) &= ~PHPDBG_IS_SIGNALED;
DO_INTERACTIVE();
}
PHPDBG_G(vmret) = execute_data->opline->handler(execute_data TSRMLS_CC);
if (PHPDBG_G(vmret) > 0) {
+1 -3
View File
@@ -20,14 +20,12 @@
#ifndef PHPDBG_PROMPT_H
#define PHPDBG_PROMPT_H
/**
* Maximum command length
*/
void phpdbg_init(char *init_file, size_t init_file_len, zend_bool use_default TSRMLS_DC);
int phpdbg_interactive(TSRMLS_D);
void phpdbg_print_opline(zend_execute_data *execute_data, zend_bool ignore_flags TSRMLS_DC);
int phpdbg_compile(TSRMLS_D);
void phpdbg_clean(zend_bool full TSRMLS_DC);
void phpdbg_sigint_handler(int signo);
#if PHP_VERSION_ID >= 50500
void phpdbg_execute_ex(zend_execute_data *execute_data TSRMLS_DC);