Merge branch 'master' of https://github.com/krakjoe/phpdbg into frames

Conflicts:
	phpdbg.h
	phpdbg_prompt.c
This commit is contained in:
Bob Weinand 2013-11-22 18:32:00 +01:00
commit c46a413697
15 changed files with 511 additions and 145 deletions

View file

@ -44,6 +44,9 @@ static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) /* {{{ */
pg->lcmd = NULL;
pg->flags = PHPDBG_DEFAULT_FLAGS;
pg->oplog = NULL;
pg->io[PHPDBG_STDIN] = NULL;
pg->io[PHPDBG_STDOUT] = NULL;
pg->io[PHPDBG_STDERR] = NULL;
memset(&pg->lparam, 0, sizeof(phpdbg_param_t));
pg->frame.num = 0;
} /* }}} */
@ -340,7 +343,9 @@ static inline int php_sapi_phpdbg_ub_write(const char *message, unsigned int len
static inline void php_sapi_phpdbg_flush(void *context) /* {{{ */
{
fflush(stdout);
TSRMLS_FETCH();
fflush(PHPDBG_G(io)[PHPDBG_STDOUT]);
} /* }}} */
/* {{{ sapi_module_struct phpdbg_sapi_module
@ -435,6 +440,23 @@ static void phpdbg_welcome(zend_bool cleaning TSRMLS_DC) /* {{{ */
}
} /* }}} */
static inline void phpdbg_sigint_handler(int signo) /* {{{ */
{
TSRMLS_FETCH();
if (EG(in_execution)) {
/* we don't want to set signalled while phpdbg is interactive */
if (!(PHPDBG_G(flags) & PHPDBG_IS_INTERACTIVE)) {
PHPDBG_G(flags) |= PHPDBG_IS_SIGNALED;
}
} else {
/* if we are not executing then just provide advice */
phpdbg_writeln(EMPTY);
phpdbg_error(
"Please leave phpdbg gracefully !");
}
} /* }}} */
int main(int argc, char **argv) /* {{{ */
{
sapi_module_struct *phpdbg = &phpdbg_sapi_module;
@ -620,6 +642,11 @@ phpdbg_main:
PG(modules_activated) = 0;
/* set up basic io here */
PHPDBG_G(io)[PHPDBG_STDIN] = stdin;
PHPDBG_G(io)[PHPDBG_STDOUT] = stdout;
PHPDBG_G(io)[PHPDBG_STDERR] = stderr;
if (exec) { /* set execution context */
PHPDBG_G(exec) = phpdbg_resolve_path(
exec TSRMLS_CC);