mirror of
https://github.com/php/php-src.git
synced 2026-04-23 16:08:35 +02:00
...
This commit is contained in:
@@ -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));
|
||||
} /* }}} */
|
||||
|
||||
@@ -339,7 +342,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
|
||||
@@ -636,6 +641,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);
|
||||
|
||||
@@ -112,6 +112,11 @@
|
||||
#define PHPDBG_ISSUES "http://github.com/krakjoe/phpdbg/issues"
|
||||
#define PHPDBG_VERSION "0.0.2-dev" /* }}} */
|
||||
|
||||
/* {{{ output descriptors */
|
||||
#define PHPDBG_STDIN 0
|
||||
#define PHPDBG_STDOUT 1
|
||||
#define PHPDBG_STDERR 2 /* }}} */
|
||||
|
||||
/* {{{ structs */
|
||||
ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
|
||||
HashTable bp[PHPDBG_BREAK_TABLES]; /* break points */
|
||||
@@ -127,6 +132,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
|
||||
HashTable seek; /* seek oplines */
|
||||
zend_ulong flags; /* phpdbg flags */
|
||||
HashTable registered; /* registered */
|
||||
FILE *io[3]; /* stdin/stdout/stderr */
|
||||
ZEND_END_MODULE_GLOBALS(phpdbg) /* }}} */
|
||||
|
||||
#endif /* PHPDBG_H */
|
||||
|
||||
+1
-1
@@ -218,7 +218,7 @@ phpdbg_input_t *phpdbg_read_input(char *buffered TSRMLS_DC) /* {{{ */
|
||||
#ifndef HAVE_LIBREADLINE
|
||||
char buf[PHPDBG_MAX_CMD];
|
||||
if (!phpdbg_write(PROMPT) ||
|
||||
!fgets(buf, PHPDBG_MAX_CMD, stdin)) {
|
||||
!fgets(buf, PHPDBG_MAX_CMD, PHPDBG_G(io)[PHPDBG_STDIN])) {
|
||||
/* the user has gone away */
|
||||
phpdbg_error("Failed to read console !");
|
||||
PHPDBG_G(flags) |= PHPDBG_IS_QUITTING;
|
||||
|
||||
+6
-6
@@ -44,11 +44,11 @@ enum {
|
||||
|
||||
int phpdbg_print(int TSRMLS_DC, FILE*, const char*, ...);
|
||||
|
||||
#define phpdbg_error(fmt, ...) phpdbg_print(P_ERROR TSRMLS_CC, stdout, fmt, ##__VA_ARGS__)
|
||||
#define phpdbg_notice(fmt, ...) phpdbg_print(P_NOTICE TSRMLS_CC, stdout, fmt, ##__VA_ARGS__)
|
||||
#define phpdbg_writeln(fmt, ...) phpdbg_print(P_WRITELN TSRMLS_CC, stdout, fmt, ##__VA_ARGS__)
|
||||
#define phpdbg_write(fmt, ...) phpdbg_print(P_WRITE TSRMLS_CC, stdout, fmt, ##__VA_ARGS__)
|
||||
#define phpdbg_log(fmt, ...) phpdbg_print(P_LOG TSRMLS_CC, stdout, fmt, ##__VA_ARGS__)
|
||||
#define phpdbg_error(fmt, ...) phpdbg_print(P_ERROR TSRMLS_CC, PHPDBG_G(io)[PHPDBG_STDOUT], fmt, ##__VA_ARGS__)
|
||||
#define phpdbg_notice(fmt, ...) phpdbg_print(P_NOTICE TSRMLS_CC, PHPDBG_G(io)[PHPDBG_STDOUT], fmt, ##__VA_ARGS__)
|
||||
#define phpdbg_writeln(fmt, ...) phpdbg_print(P_WRITELN TSRMLS_CC, PHPDBG_G(io)[PHPDBG_STDOUT], fmt, ##__VA_ARGS__)
|
||||
#define phpdbg_write(fmt, ...) phpdbg_print(P_WRITE TSRMLS_CC, PHPDBG_G(io)[PHPDBG_STDOUT], fmt, ##__VA_ARGS__)
|
||||
#define phpdbg_log(fmt, ...) phpdbg_print(P_LOG TSRMLS_CC, PHPDBG_G(io)[PHPDBG_STDOUT], fmt, ##__VA_ARGS__)
|
||||
|
||||
#define phpdbg_error_ex(out, fmt, ...) phpdbg_print(P_ERROR TSRMLS_CC, out, fmt, ##__VA_ARGS__)
|
||||
#define phpdbg_notice_ex(out, fmt, ...) phpdbg_print(P_NOTICE TSRMLS_CC, out, fmt, ##__VA_ARGS__)
|
||||
@@ -57,7 +57,7 @@ int phpdbg_print(int TSRMLS_DC, FILE*, const char*, ...);
|
||||
#define phpdbg_log_ex(out, fmt, ...) phpdbg_print(P_LOG TSRMLS_CC, out, fmt, ##__VA_ARGS__)
|
||||
|
||||
#if PHPDBG_DEBUG
|
||||
# define phpdbg_debug(fmt, ...) phpdbg_print(P_LOG TSRMLS_CC, stderr, fmt, ##__VA_ARGS__)
|
||||
# define phpdbg_debug(fmt, ...) phpdbg_print(P_LOG TSRMLS_CC, PHPDBG_G(io)[PHPDBG_STDERR], fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
# define phpdbg_debug(fmt, ...)
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user