+----------------------------------------------------------------------+
*/
+#ifndef ZEND_SIGNALS
+# include <signal.h>
+#endif
#include "phpdbg.h"
#include "phpdbg_prompt.h"
#include "phpdbg_bp.h"
}
} /* }}} */
-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;
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;
}
} /* }}} */
+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
}
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) {
#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);